How to get an mjpeg stream with 30 fps? [closed]
Hi,
I bought two webcam modules and they are said to be able to deliver 1280x720 with 30 frames per second with mjpg compression.
When I now set it up with libuvc_camera node:
<node pkg="libuvc_camera" type="camera_node" name="cam" required="true">
<!-- Parameters used to find the camera -->
<param name="vendor" value="0x0ac8"/>
<param name="product" value="0x3470"/>
<param name="serial" value=""/>
<!-- If the above parameters aren't unique, choose the first match: -->
<param name="index" value="0"/>
<!-- Image size and type -->
<param name="width" value="1280"/>
<param name="height" value="720"/>
<!-- choose whichever uncompressed format the camera supports: -->
<param name="video_mode" value="jpeg"/> <!-- format, yuyv (yuyv): YUYV, uyvy (uyvy): UYVY, rgb (rgb): RGB, jpeg (jpeg): JPEG/MJPEG -->
<param name="frame_rate" value="30"/>
<param name="timestamp_method" value="start"/> <!-- start of frame -->
<param name="camera_info_url" value=""/>
<param name="auto_exposure" value="0"/> <!-- use aperture_priority auto exposure -->
<param name="auto_white_balance" value="1"/>
</node>
I always get:
uvc_get_stream_ctrl_format_size: Invalid mode (-51) ================================================================================REQUIRED process [cam-2] has died! process has died ...
Also v4l2-ctl tells me it should able to stream that:
v4l2-ctl --list-formats-ext -d /dev/video1
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: 'MJPG' (compressed)
Name : MJPEG
Size: Discrete 1280x720
Interval: Discrete 0.033s (30.000 fps) <-------------- HERE
Size: Discrete 640x480
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 1600x1200
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 800x600
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 1920x1080
Interval: Discrete 0.067s (15.000 fps)
Index : 1
Type : Video Capture
Pixel Format: 'YUYV'
Name : YUV 4:2:2 (YUYV)
Size: Discrete 1280x720
Interval: Discrete 0.100s (10.000 fps)
Size: Discrete 640x480
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 352x288
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 320x240
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 160x120
Interval: Discrete 0.033s (30.000 fps)
Size: Discrete 1600x1200
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 1920x1080
Interval: Discrete 0.133s (7.500 fps)
Can anybody tell me what I am doing wrong? Lower frequencies sometimes seem to work,
For example 10 fps does:
<param name="frame_rate" value="10"/>
But 15 fps for example also do not work.
Is there any of those tons of settings here, I have to set to make it work? http://wiki.ros.org/libuvc_camera
Camera module is a DELOCK 95953 if that does help.
Thanks, Regards,
Christian
[UPDATE]
Meanwhile I found out, how to use it with vlc
vlc v4l2:///dev/video1:width=1280:height=720 :v4l2-chroma=MJPG :v4l2-fps=30
So the framerate and the encoding do acutally work with that camera. Sometimes it hangs for some seconds...
using usb cam now instead of libuvc_camera. Seems to work fine.