Gstreamer error; not able to run videocapture

Hi team

I am trying to capture a video using logitech c270 camera in jetson tx2(JP 4.6.4). but I am facing the below error.

Python 3.6.9 (default, Mar 10 2023, 16:46:00)
[GCC 8.4.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import cv2
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (933) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
<VideoCapture 0x7f8e2e8650>

Kindly help me to resolve this issue

I also referred the below link but issue remains the same.

Please check the steps in Jetson Nano FAQ

Q: I have a USB camera. How can I launch it on Jetson Nano?

to launch USB camera.

Hi @DaneLLL

Thanks, I will work and get back to you

Hi @DaneLLL

$ gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' ! nvoverlaysink

I was able to run the above command succesfully.

but the error persist with the same error(mentioned in the 1st cell of this thread).

You may try this python sample:
V4l2src using OpenCV Gstreamer is not working in Jetson Xavier NX - #3 by DaneLLL

If it does not work, it seems like you don’t use the OpenCV package installed through SDKManager.

For information, please share which Jetpack version you are using.

I am using jetpack version 4.6.4

Please change width, height, frame rate, format in the sample according to your camera source. If the python sample can not be successfully run, you may re-flash system image and SDK components through SDKManager. And try again.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.