usb camera cannot set width and height

[b]Hi all,

I want to use a logitech c920 with TX2.
The camera is working when I use this command[/b]

gst-launch-1.0 v4l2src device=/dev/video1 ! ‘video/x-raw, framerate=30/1’ ! videoconvert ! xvimagesink

But I got error when I want to specify width and height

tx2@tx2-desktop:~/Desktop/helmet/test$ gst-launch-1.0 v4l2src device=/dev/video1 ! ‘video/x-raw, width=(int)1280, height=(int)720, framerate=30/1’ ! videoconvert ! xvimagesink
Setting pipeline to PAUSED …
Pipeline is live and does not need PREROLL …
Setting pipeline to PLAYING …
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.001171349
Setting pipeline to PAUSED …
Setting pipeline to READY …
Setting pipeline to NULL …
Freeing pipeline …

I double checked with
v4l2-ctl -d /dev/video1 --list-formats-ext
and sure the camera supports the size.


The Logitech C920 does not support 720p30 in raw format, you can check the camera capabilities by printing out the descriptors as follow:

sudo lsusb -v -d 046d:082d

This will give you a long list of all supported formats (YUY2, MJPEG, and H264) and all the supported resolutions/frame-rates for each one. For the case of YUY2 720p you get the following:

VideoStreaming Interface Descriptor:
        bLength                            38
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                        15
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                           1280
        wHeight                           720
        dwMinBitRate                 73728000
        dwMaxBitRate                147456000
        dwMaxVideoFrameBufferSize     1843200
        dwDefaultFrameInterval        1000000
        bFrameIntervalType                  3
        dwFrameInterval( 0)           1000000
        dwFrameInterval( 1)           1333333
        dwFrameInterval( 2)           2000000

Notice the listed FrameIntervals, the maximum framerate for this resolution/format is:

MAX_FPS = 1000000000ns / (1000000 * 100ns) = 10fps

You can reach 720p30 in MJPEG and H264 format, though.

Best Regards,

Hi MarcoMadrigal,

Thanks for answering my question.

gst-launch-1.0 v4l2src device=/dev/video1 ! ‘video/x-raw, width=(int)864, height=(int)480, framerate=30/1’ ! videoconvert ! xvimagesink

is working after I changed the size to 864 x 480.
But when I put this into python and want it work with opencv, it keep failing capture the image
I am using opencv 3.2.0 and my code looks like this

gst_str = ("v4l2src device=/dev/video1 ! "
"video/x-raw, width=(int)864, height=(int)480, framerate=10/1 ! "
“videoconvert ! xvimagesink”)
cap = cv2.VideoCapture(gst_str, cv2.CAP_GSTREAMER)
ret,img =

DO you have ideal what fails my gstreamer ?


Could you provide the output of your error message?

If you are planning to capture from the camera within OpenCV then you might need to replace the xvimagesink for appsink to allow OpenCV to capture the frames.

These posts might be helpful:

Best Regards,

[b]Hi MarcoMadrigal,

Thanks for replying me again.

Actually, there is no error message but
ret,img =

[b]captured nothing and returns NoneType to img.

Seems like appsink is one place I have to change but not the only one [/b]


Sorry for the slow response. Did you have a chance to test with appsink and maybe use any of the proposed posts to create a simple application for testing?

Is it failing the same way?

Best Regards,

I find out the problem myself.
I reinstalled the OS to TX2 through Nvidia SDK Manager. The OS was reinstalled successfully but I cannot install SDK Tools through SDK Manager at that time.
So I manually installed Gstreamer through apt-get and this made me missed some dependency of Gstreamer.