1. First checks
- Leave
"cameraName" out (or empty) once. The driver prints the list of available video devices of the machine and does not start capturing. Copy the exact name from the list.
- Then leave
"format" out once, with cameraName set. The driver prints the pixel formats and options the camera offers (it opens the camera to do so).
- Check the start-up report. On success the driver prints
FFMPegDriver: Stream '<name>' Init success followed by the platform (dshow on Windows, video4linux2 on Linux, avfoundation on macOS), resolution, pixel format, framerate and buffer size.
- Test the same camera settings outside the engine, for example on Windows
ffplay -f dshow -video_size 640x480 -framerate 30 -vcodec mjpeg -i video="Camera name", on Linux v4l2-ctl --list-devices and ffmpeg -f v4l2 -input_format mjpeg -i /dev/video0 .... If it does not work there, it will not work in the engine.
- Check the block counters of the input block in DIPanel or System Layout.
2. Message reference
| Message | Cause | What to do |
FFMPegDriver: Stream '<name>' Must specify Device name. Printing avaliable devices: (error) | cameraName is missing or empty. The driver lists the video devices instead of starting. This is the discovery mode. | Copy the device name from the printed list into cameraName. See section 4. |
FFMPegDriver: Stream '<name>' Must specify format. Printing avaliable formats for device '<camera>': (error) | format is missing or empty. | Pick a pixel format (for example yuvj422p, yuyv422, mjpeg) from the printed list and set format. See section 5. |
FFMPegDriver: Stream '<name>' Failed to init. (error) | The camera could not be opened or started with the settings given. The driver gives no further detail in the report. Possible reasons, in order of likelihood: wrong name, camera busy, resolution / fps / format not supported by the camera, no video stream found, no decoder available for the stream. | Work through section 3. Look at the console: FFmpeg prints its own text there. |
Failed to open device: <ffmpeg error text> (console) | Printed while listing formats: FFmpeg could not open the camera (name wrong, camera busy). | Check the name and close other programs using the camera. |
Failed to open camera <name> (console) | Same, from the format listing. | Same. |
Input format <dshow|video4linux2|...> not found. / Error listing devices: ... (console) | This FFmpeg build does not contain the capture back end (device library not built in). | Use an FFmpeg build with avdevice and the DirectShow / V4L2 input (the bundled ffmpeg-win64-shared package has them). |
FFMPegStream: stream '<name>', Bad LRU name '<lru>' not in database (error) | The block name in streams.json refers to an LRU that does not exist. | Block names are written LRU.block; use names that exist in the ICD / LRU database. |
ExternalModelDeviceStream: stream '<name>', Bad block name '<block>' not in LRU '<lru>' (error) | The block does not exist in that LRU. (The FFMpeg stream reuses this text; the prefix says ExternalModelDeviceStream.) | Fix the block name. |
Stream: '<name>': block '<block>': timing <N>us > system minor frame <M>us; data may be lost. (warning) | An input block has a numeric framePerMS longer than the minor frame. | See section 7. |
3. "Failed to init": what to check
| Cause | How to recognize it | Fix |
| Camera name wrong | FFmpeg prints a "could not find video device" or similar line on the console. | Use the exact name from the discovery list, including capitals and spaces. On Windows the driver prefixes video= itself; do not add it. |
| Camera busy (Teams, Zoom, browser, camera app, another engine instance) | "Could not run graph" or an access error; the camera LED may be on. | Close the other program. Only one program can normally open a USB camera on DirectShow. |
| Resolution not supported | Works in the camera app, fails in the engine; the list of options shows other sizes. | Use a size the camera lists (width, height). The driver passes it as video_size. |
| fps not supported at that resolution/format | Many cameras offer 30 fps at 640x480 but only 5-15 fps at full HD in raw formats. | Lower fps, or choose a compressed format such as mjpeg which usually allows higher rates over USB. |
| Pixel format not supported | Init fails only with that format. | See section 5. |
| USB bandwidth | Works with one camera, fails with two on the same hub; or raw formats fail but MJPEG works. | Use separate USB controllers, a lower resolution, or MJPEG. |
| FFmpeg DLLs missing | The engine does not start, or reports a missing avcodec, avformat, avdevice, swscale, avutil DLL. | Copy the FFmpeg shared DLLs (from ffmpeg-win64-shared) next to the executable. Use 64-bit DLLs for a 64-bit engine, and keep all DLLs from the same FFmpeg version. |
| Permission denied (Linux) | "Permission denied" on /dev/video0. | Add the user to the video group and log in again. |
4. Camera names: DirectShow and V4L2
- Windows (DirectShow,
dshow): cameraName is the device's friendly name, for example "Lenovo FHD Webcam". The driver builds video=<cameraName>. Names can change when a driver is updated; two identical cameras show the same name with a suffix.
- Linux (V4L2,
video4linux2): use the device path, for example "/dev/video0". A single USB camera often creates two nodes (/dev/video0 and /dev/video1): the second one usually delivers metadata only and fails to open. v4l2-ctl --list-devices shows which is which. The names can swap after a reboot; use the stable links under /dev/v4l/by-id/.
- macOS (
avfoundation): the device index or name as FFmpeg lists it.
- On Linux the format listing helper of the driver still builds the name with a
video= prefix. If listing formats fails there, use v4l2-ctl --list-formats-ext -d /dev/video0 instead.
format is passed to FFmpeg as the camera's input_format (for example mjpeg, yuyv422, yuvj422p). It is the format the camera sends. Use a name from the printed list.
- If the camera sends a compressed format (MJPEG), the driver decodes it and the block receives the decoded raw pixels in the decoder's pixel format (printed as
Format in the init report). No colour conversion is applied: the block holds the planes exactly as FFmpeg outputs them (planar for yuvj422p / yuv420p, packed for yuyv422).
- The printed
Resolution and Framerate are the values you configured; the real decoded size is what the decoder reports. If the camera substitutes a different size the block size still must match the real frame (section 6).
- A lower
fps than the camera can deliver gives fewer new frames per second; a higher one than it supports fails the init.
6. Frame size versus ICD block size
The input block that receives the video must be large enough for one decoded frame. The size of a frame is:
| Pixel format | Bytes per frame (width x height) |
yuyv422 (packed 4:2:2) | width x height x 2 |
yuvj422p / yuv422p (planar 4:2:2) | width x height x 2 |
yuv420p / yuvj420p / nv12 (4:2:0) | width x height x 1.5 |
rgb24 / bgr24 | width x height x 3 |
gray | width x height |
- The driver asks FFmpeg for the exact size of the decoded frame and copies it into the block. Make the block (or its array field) at least that size; 640x480 in
yuvj422p needs 614,400 bytes. The driver itself does not check the block size against the frame, so a block that is too small risks overwriting memory next to it, and a block that is too large simply has unused bytes at the end.
- If the real frame size differs from the configured width and height (camera chose another mode), the block size computed from your ICD is wrong. Compare the printed init report with the ICD.
- If a frame cannot be decoded or does not fit the destination, the read returns an error and no new frame is written.
7. framePerMS for input blocks and dropped frames
For an input block ("direction": "in") the rule is:
-1: the stream checks every minor frame. Recommended.
0: the block is disabled; no video, no error.
- a number (ms or
Nhz): the camera is read only at that rate. If the period is longer than the camera's frame period, frames pile up in the buffer and are dropped, and a warning is printed.
See the note on framePerMS. Important for this driver: reading a frame waits until the camera delivers one
(the read is blocking). With -1 and a minor frame faster than the camera's frame rate, the engine thread waits for each frame and the whole stream can run at the camera's rate.
If the rest of the simulation must keep its own rate, use a numeric framePerMS that matches the camera (for example 33 for 30 fps) so the read is the pacing element, and accept the warning, or run the video in its own stream.
Buffer size and dropped frames
bufferSizeMB sets the capture buffer (rtbufsize, in megabytes) of the DirectShow back end. The default is 10 when the field is missing. It is a buffer between the camera and the engine.
- Too small for the frame size and rate (for example 1080p raw at 30 fps = about 60 MB/s): when the engine reads slowly, the camera has no room and frames are dropped. Symptoms: stuttering video, FFmpeg console text such as "real-time buffer ... too full or near too full ... frame dropped!".
- Fix: raise
bufferSizeMB (for example 50-256), lower the resolution/fps, or use MJPEG; and read every minor frame (-1).
- A big buffer also adds latency: frames wait in the buffer. If the picture lags behind real life, the engine is reading slower than the camera produces, and the buffer holds the backlog. The driver already sets
nobuffer and low_delay to keep latency low.
bufferSizeMB is used by the Windows (DirectShow) back end; on other platforms it has no effect.
8. Other problems
| Symptom | Cause | Fix |
| Init succeeds, block stays zero / old data | Input block has framePerMS: 0, or the frame size is unknown (the decoder has not delivered a frame yet) or the block is smaller than the frame. | Use -1; check the block size (section 6); look at the console for FFmpeg errors. |
| Image looks green / pink / skewed | The consumer interprets the planes with a different pixel format or stride than the data (for example treating planar yuvj422p as packed RGB). | Treat the block bytes exactly in the format printed in the init report; there is no stride padding (rows are packed). |
| Image is stretched or sheared | Width/height in the consumer differ from the real decoded size. | Use the size the camera actually produces (init report and discovery list). |
| Simulation runs slower than expected after adding the camera | Blocking read waits for each frame. | See section 7. |
| Frame rate lower than configured | Camera lowers the rate in low light (auto exposure), or the USB link cannot carry the format. | Increase lighting or switch off auto exposure/low-light compensation in the camera settings; use MJPEG. |
| Camera works once, fails after an engine reset | The previous session still holds the camera or was not released. | Stop and start the engine; check that no stale process remains in Task Manager. |
| Sending video out of the engine | The driver is input only: writing to an output block returns an error (not supported). | Use a different driver for output. |
| Industrial camera (GigE Vision / USB3 Vision, global shutter, hardware trigger) | DirectShow / V4L2 webcam path has no trigger and little control. | Use the GenICam driver: Troubleshoot: GenICam Driver. |