Webcam not opening in Ubuntu 18.04 ... on a TX2

742 views Asked by At

I'm new to ubuntu and the tx2.
I just flashed my TX2 with Ubuntu 18.04 and the latest Jetpack release.

I'm having trouble opening up and displaying the webcam.
The webcam is being recognized by lsusb and ls /dev/video* as /video1.
I'm trying to follow along this tutorial as well as this one and this one.

I've been able to install " gstreamer1.0-plugins-bad-faad but not gstreamer1.0-plugins-bad-videoparsers (I got an error ... which I think can be ignored because it should only be needed for IP cameras).

Either way, when I run my test script, I get the error: ... GStreamer: pipeline have not been created, along with a "could not read from resource" and "unable to start pipeline" error.

When trying to open Cheese, the camera is listed under "Devices" ... but greyed out.

I have xvfb installed and v4l-utils.

I get a pop up window that looks like an old TV test transmission when running this pipeline: gst-launch-1.0 -v v4l2src device=/dev/video1 ! image/jpeg, format=MJPG, width=640, height=480, framerate=30/1 ! nvjpegdec ! 'video/x-raw(memory:NVMM), format=I420' ! nvvidconv ! xvimagesink.

After running this pipeline, I get an "Pipeline is live and does not need PREROLL ... ERROR: from element /GstPipeline:pipeline0/GstV4l25Src:v4l2src0: Internal data stream error." and "ERROR: pipeline doesn't want to preroll.".

Using some MATLAB code i'm able to turn the webcam 'on', ie, the light comes on, but don't see any output. Also not getting output when trying to use the OpenCV code from above ...

Any help would be appreciated.

EDIT: I am able to open/stream from my webcam using nvgstcapture-1.0 --cap-dev-node=0 --camsrc=0

So this sounds like an error with gstreamer ... I think.

1

There are 1 answers

0
Alper Kucukkomurler On

I am assuming that you are using the onboard cameras on Jetson.

Jetson CSI cameras use the the ISP on the Tegra chips and are usually accessed through nvcamerasrc or nvarguscamerasrc elements instead of v4l2src.

So we should start with nvcamerasrc element, the output of the Tegra ISP is video/x-raw(memory:NVMM), then we need to download it to regular buffer with nvvidconv in order to display with xvimagesink.

The following pipe should do this.

gst-launch-1.0 -v nvcamerasrc !  'video/x-raw(memory:NVMM), width=(int)2592, height=(int)1458, format=(string)I420, framerate=(fraction)30/1' ! nvvidconv ! xvimagesink