Open LKSeng opened 2 years ago
After some investigation, the following were elucidated:
Setting frame_rate
> 30 causes frames to be published at ~30.5s, but the above error does not show anymore.
Setting frame_rate
== 30 causes frames to be published at ~30.1s, but the above error does appear occasionally.
Setting frame_rate
< 30 causes the above error to appear more periodically.
I read a stackexchange answer suggesting that the frame rates are fixed by the device, and [sic] it is the user's responsibility to read at a higher rate [/sic] (when using h264
).
Therefore, when h264
is used, please set the frame rate to something slightly larger than the framerate allowable by the device.
i.e.
$ v4l2-ctl -d /dev/video4 --list-formats-ext
You'll see something like:
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
[0]: 'H264' (H.264, compressed)
Size: Discrete 1920x1080
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 1280x720
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 640x480
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 640x360
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 1920x1080
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.033s (30.000 fps)
So set the frame_rate
to, say, 31 fps when using h264_yuv420p
.
If you device supports MJPEG, do consider using the stream mentioned in #2 as a workaround instead. It seems that the MJPEG stream is less picky on the read interval as compared to H264.
Example error:
[ERROR] [1647765946.2751156857]: Webcam: expected picture but didn't get it...