OpenCV4Tegra 2.4.13 (New JetPack release) bug

I’ve downloaded and flashed the new JetPack package to my TX1, and having the following problem with opencv4tegra. I am unable to set the resolution of my usb webcam using the following code:

cv::VideoCapture capture(CAMERA_INDEX);

I receive the following error:


After googling it appears the error is related to compiling OpenCV without V4L… It also seems like this has been an error in previous opencv4tegra releases:

The video feed is still captured correctly, but at the wrong resolution.

What are the alternatives for getting live frame data into OpenCV4Tegra? For example, I can get native resolution (1920x1200) data live from my usb camera using the following command:

gst-launch v4l2src device="/dev/video1" ! xvimagesink -e

But OpenCV4Tegra will only give me 640x480 frames. Is there any other way/what is the best way to stream frames into OpenCV4Tegra? Thanks.


I have not worked with OpenCV, but with V4L2. The cause of the problem might be that the v4l2-driver does not support the cropping ioctl. Do you necessarily need to crop? Otherwise it might be a workaround to just comment out the cropping commands in our OpenCV application?
If you need to scale the video, you might also use other functions or (from a GStreamer view) the nvvidconv or videoscale GStreamer plugin (videoscale is software-based and slow, while nvvidconv is hardware-accelerated and faster but only works in certain conditions).

I don’t know how fluent you are with GStreamer, this is an example of a pipeline with scaling that works for me:

gst-launch-1.0 v4l2src device="/dev/video1" ! videoscale ! 'video/x-raw, width=1920, height=1080' ! xvimagesink -e


I am not doing any cropping… which is why it is strange that I am receiving a cropping error. The only parameters I am trying to set are width and height in OpenCV4Tegra (see the code in the first post).

This bug remains long from the TK1 era.

Hi kelbyg,

V4L2 camera support level depends on kernel driver mostly. We do not exclude OpenCV issue for the particular case, but most probably, some IOCTLs are not implemented for particular camera and that’s why you cannot change camera resolution.

As possible solution, please, try to set resolution before or after cv::VideoCaprute::open call.

And, “HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP” is reported for all cameras we’ve ever tried. It does not affect camera functionality.



my camera V4L2 Driver support multi resolutions (1280x720, 1280x800, etc)

so i use VideoCapture Class set 1280x800. but it is not working

check video0 configure use v4l2-ctl -d /dev/video0 --all command

it is changed 1280x720 …

so my camera V4L2 driver changed default resolution from 1280x720 to 1280x800.

it is working

um… OpenCV4Tegra is not support change resolution on current version.


Please provide your pipeline to us. Thanks.