usb_cam outbuf size mismatch; possibly different format?

asked 2017-10-24 19:12:33 -0500

clyde gravatar image

I'm using usb_cam with a camera that supports mjpeg, but I'm getting errors. The camera supports these formats:

$ v4l2-ctl --device=0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Index       : 0
Type        : Video Capture
Pixel Format: 'MJPG' (compressed)
Name        : Motion-JPEG
    Size: Discrete 1920x1080
        Interval: Discrete 0.033s (30.000 fps)
        Interval: Discrete 0.040s (25.000 fps)
        Interval: Discrete 0.067s (15.000 fps)
    Size: Discrete 1280x720
        Interval: Discrete 0.033s (30.000 fps)
        Interval: Discrete 0.040s (25.000 fps)
        Interval: Discrete 0.067s (15.000 fps)
    Size: Discrete 800x600
        Interval: Discrete 0.033s (30.000 fps)
        Interval: Discrete 0.040s (25.000 fps)
        Interval: Discrete 0.067s (15.000 fps)
    Size: Discrete 640x480
        Interval: Discrete 0.033s (30.000 fps)
        Interval: Discrete 0.040s (25.000 fps)
        Interval: Discrete 0.067s (15.000 fps)
    Size: Discrete 640x360
        Interval: Discrete 0.033s (30.000 fps)
        Interval: Discrete 0.040s (25.000 fps)
        Interval: Discrete 0.067s (15.000 fps)
    Size: Discrete 352x288
        Interval: Discrete 0.033s (30.000 fps)
        Interval: Discrete 0.040s (25.000 fps)
        Interval: Discrete 0.067s (15.000 fps)
    Size: Discrete 320x240
        Interval: Discrete 0.033s (30.000 fps)
        Interval: Discrete 0.040s (25.000 fps)
        Interval: Discrete 0.067s (15.000 fps)
    Size: Discrete 1920x1080
        Interval: Discrete 0.033s (30.000 fps)
        Interval: Discrete 0.040s (25.000 fps)
        Interval: Discrete 0.067s (15.000 fps)

Index       : 1
Type        : Video Capture
Pixel Format: 'YUYV'
Name        : YUYV 4:2:2
    Size: Discrete 640x480
        Interval: Discrete 0.033s (30.000 fps)
        Interval: Discrete 0.040s (25.000 fps)
        Interval: Discrete 0.067s (15.000 fps)
    Size: Discrete 800x600
        Interval: Discrete 0.067s (15.000 fps)
    Size: Discrete 640x360
        Interval: Discrete 0.033s (30.000 fps)
        Interval: Discrete 0.040s (25.000 fps)
        Interval: Discrete 0.067s (15.000 fps)
    Size: Discrete 352x288
        Interval: Discrete 0.033s (30.000 fps)
        Interval: Discrete 0.040s (25.000 fps)
        Interval: Discrete 0.067s (15.000 fps)
    Size: Discrete 320x240
        Interval: Discrete 0.033s (30.000 fps)
        Interval: Discrete 0.040s (25.000 fps)
        Interval: Discrete 0.067s (15.000 fps)
    Size: Discrete 640x480
        Interval: Discrete 0.033s (30.000 fps)
        Interval: Discrete 0.040s (25.000 fps)
        Interval: Discrete 0.067s (15.000 fps)

Here's my launch file:

<launch>

  <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" >
    <param name="video_device" value="/dev/video0" />
    <param name="image_width" value="640" />
    <param name="image_height" value="480" />
    <param name="pixel_format" value="mjpeg" />
    <param name="camera_frame_id" value="usb_cam" />
    <param name="io_method" value="mmap"/>
  </node>

  <node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen">
    <remap from="image" to="/usb_cam/image_raw"/>
    <param name="autosize" value="true" />
  </node>

</launch>

At 640x480 I get an image, but I also get lots of messages like this:

[swscaler @ 0x1433780] deprecated pixel format used, make sure you did set range correctly

At 800x600 (and above) I do not get an image, but I do get lots of these messages:

[ERROR] ros.usb_cam: outbuf size mismatch.  pic_size: 720000 bufsize: 960000

Interestingly ... (more)

edit retag flag offensive close merge delete

Comments

1

I was able to work around this by modifying usb_cam. I opened bug #79.

clyde gravatar image clyde  ( 2017-10-24 23:52:31 -0500 )edit