Problem with gstream and camera logitech c270 in python (jetson nano)

Hi, I’m try to open logitech c270 usb cam with python and gstreamer. I’m using the next pipeline in the script of python, and the camera doesn’t work:

v4l2src device=/dev/video0 ! video/x-raw, width=640, height=480, framerate=30/1,format=YUY2 ! nvvidconv ! video/x-raw(memory:NVMM) ! nvvidconv ! video/x-raw, format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink"

The terminal show the next error:

Can not open video stream at video0

When I use the next command in the jetsnon nano terminal, the camera work fine.

gst-launch-1.0 v4l2src device="/dev/video0" name=e ! ‘video/x-raw, width=640, height=480’ ! videoconvert ! ‘video/x-raw, width=640, height=480, format=(string)YUY2’ ! xvimagesink

How can I solve the problem?

thanks

hello diego.costanzo29,

may I know which JetPack release version you’re working with, what’s your use-case?
you should have a try to copy your workable pipeline into python script to launch the camera sensor.
thanks

1 Like

Hi Jerry, I’m using JetPack 4.5.1. I used the workable pipeline in python script, but it didn’t work, the terminal showed the same error.

@diego.costanzo29

check the following in terminal
ls /dev

and check the video id if it is Video0 or video1 and change it in the code. your pipeline should work.
mostly the video0 is for CSI camera and usb camera will have Video1 ,so changing Video0 to video1 will work for you

1 Like

Hi Aravind_Seenu. I changed the Video0 for Video 1 and this worked! Thanks!

1 Like