USB_CAM error with low resolution on RaspiCam

asked 2018-09-09 03:02:53 -0500

Gil404 gravatar image

updated 2018-09-09 05:04:22 -0500

Hi Guys,

When trying to run the USB_CAM with a raspberry pi cam connected with a flex cable I am getting the following error:

***[ERROR] [1536479863.709252536]: VIDIOC_S_FMT error 22, Invalid argument***

This is the 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="yuyv" />
    <param name="camera_frame_id" value="usb_cam" />
    <param name="framerate" value="30" />
    <param name="io_method" value="mmap"/>
  </node>
</launch>

When changing the resolution to 1024x768 it works fine.

when running: v4l2-ctl --list-formats-ext

ioctl: VIDIOC_ENUM_FMT
    Index       : 0
    Type        : Video Capture
    Pixel Format: 'YU12'
    Name        : Planar YUV 4:2:0
        Size: Stepwise 32x32 - 3280x2464 with step 2/2

    Index       : 1
    Type        : Video Capture
    Pixel Format: 'YUYV'
    Name        : YUYV 4:2:2
        Size: Stepwise 32x32 - 3280x2464 with step 2/2

    Index       : 2
    Type        : Video Capture
    Pixel Format: 'RGB3'
    Name        : 24-bit RGB 8-8-8
        Size: Stepwise 32x32 - 3280x2464 with step 2/2

    Index       : 3
    Type        : Video Capture
    Pixel Format: 'JPEG' (compressed)
    Name        : JFIF JPEG
        Size: Stepwise 32x32 - 3280x2464 with step 2/2

    Index       : 4
    Type        : Video Capture
    Pixel Format: 'H264' (compressed)
    Name        : H.264
        Size: Stepwise 32x32 - 3280x2464 with step 2/2

    Index       : 5
    Type        : Video Capture
    Pixel Format: 'MJPG' (compressed)
    Name        : Motion-JPEG
        Size: Stepwise 32x32 - 3280x2464 with step 2/2

    Index       : 6
    Type        : Video Capture
    Pixel Format: 'YVYU'
    Name        : YVYU 4:2:2
        Size: Stepwise 32x32 - 3280x2464 with step 2/2

    Index       : 7
    Type        : Video Capture
    Pixel Format: 'VYUY'
    Name        : VYUY 4:2:2
        Size: Stepwise 32x32 - 3280x2464 with step 2/2

    Index       : 8
    Type        : Video Capture
    Pixel Format: 'UYVY'
    Name        : UYVY 4:2:2
        Size: Stepwise 32x32 - 3280x2464 with step 2/2

    Index       : 9
    Type        : Video Capture
    Pixel Format: 'NV12'
    Name        : Y/CbCr 4:2:0
        Size: Stepwise 32x32 - 3280x2464 with step 2/2

    Index       : 10
    Type        : Video Capture
    Pixel Format: 'BGR3'
    Name        : 24-bit BGR 8-8-8
        Size: Stepwise 32x32 - 3280x2464 with step 2/2

    Index       : 11
    Type        : Video Capture
    Pixel Format: 'YV12'
    Name        : Planar YVU 4:2:0
        Size: Stepwise 32x32 - 3280x2464 with step 2/2

    Index       : 12
    Type        : Video Capture
    Pixel Format: 'NV21'
    Name        : Y/CrCb 4:2:0
        Size: Stepwise 32x32 - 3280x2464 with step 2/2

    Index       : 13
    Type        : Video Capture
    Pixel Format: 'BGR4'
    Name        : 32-bit BGRA/X 8-8-8-8
        Size: Stepwise 32x32 - 3280x2464 with step 2/2

How can I lower the resolution to 640x480??

edit retag flag offensive close merge delete

Comments

Hi Gil404, have you managed this, I'm having the same need.

My error is: Unable to convert 'bgr8' image for display: 'Image is wrongly formed: height * step != size or 308 * 1230 != 399360'

And my launcher file is: camerav2_410x308_30fps.launch (it came with the installation)

Lucas Veljacic gravatar image Lucas Veljacic  ( 2019-02-17 21:34:57 -0500 )edit