Rosanswers logo

I am using ubuntu mate 20.04 focal and i have installed ros noetic, I am trying to use a logitech c920 webcam, however when i run rosrun usb_cam usb_cam_node i get the following error [swscaler @ 0x229f390] no accelerated colorspace conversion from yuv422p to rgb24, [swscaler@ 0x229f390] deprecated pixel format used, make sure you set the range correctly

i read that these are just warnings however, when i run rosrun rviz rviz it doesn't display the image from the webcam

the webcam does work though if i open it through Cheese or vlc it displays just fine

i have tried using the fixes found here


and here


and here


however, no of these solutions have seemed to work i've also tried changing the ffmpeg code in the usb_cam.cpp code but i haven't been able to get that to work either.... when i run v4l2-ctl --list-formats-ext -d /dev/video0 i get the following
ioctl: VIDIOC_ENUM_FMT Type: Video Capture

[0]: 'YUYV' (YUYV 4:2:2)
    Size: Discrete 640x480
        Interval: Discrete 0.033s (30.000 fps)
        Interval: Discrete 0.042s (24.000 fps)
        Interval: Discrete 0.050s (20.000 fps)
        Interval: Discrete 0.067s (15.000 fps)
        Interval: Discrete 0.100s (10.000 fps)
        Interval: Discrete 0.133s (7.500 fps)
        Interval: Discrete 0.200s (5.000 fps)

i think the problem is that it's using deprecated ffmpeg code to try and convert it from yuyv to mjpeg? but i'm not sure if i'm right about this....

how do i fix this? please help..... is there another ros package that i could try?

Originally posted by golferGuy1145 on ROS Answers with karma: 1 on 2021-04-15

Post score: 0


1 Answer 1


Rosanswers logo

I had the same problem, I solved it by adding _pixel_format:="yuyv" to the rosrun command. I hope this helps.

Originally posted by SamRodriguez with karma: 61 on 2021-11-16

This answer was ACCEPTED on the original site

Post score: 1


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.