Live Streaming over USB on Ubuntu and Linux, NVIDIA Jetson

You may not need everything, but this will install all gstreamer plug-ins.

$ sudo apt-get install libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio libgstreamer-plugins-base1.0-dev

You must adjust the C code for gst_viewer.c to match the /dev/video* device of your particular setup. Likely, you need to set it to /dev/video0. Alternately, you can use the tip by snaffu666 and use the video_nr option of v4l2loopback.

1 Like

Hello again sir,
so I installed the gstramer plug-ins, instanciated the video device as vid99 as suggested and adjusted the C code of gst_viewer.c and still get the same error,
here you can find my pipeline and my error and also the result I get when I inspect h264parse.
Thank you for your help !!!

The gst-launch-1.0 needs to be on a single line.

gst-launch-1.0 v4l2src device=/dev/video99 ! video/x-raw,framerate=30/1 \
! videoconvert \
! videoscale \
! avenc_huffyuv \
! avimux \
! filesink location=raw.hfyu

If you break it up on separate lines, you need to use a \ character.

This document will get you started on using gst-launch-1.0

1 Like

hello, thank you again for all your help!
it really means a lot, so I run the command, it worked and the resulted file is not corrupted! (hallelujah), but it has a problem of speed or fps… the video is not fluid at all, it seems to be accelerated a lot, I have a resulted video of 3seconds when I record for 23 seconds for example

Did you specify the framerate?
If you inspect the video information, does it show the correct information?

I used a stopwatch to take a 31 second clip. The video plays normally. The metadata indicates the correct time.

Post the actual pipeline you are using and encountering a problem.

1 Like

One other interesting aspect. The reason why I used huffman encoding is that I typically see a 30% lossless size reduction. This can be critical when saving to the SD card as there are bandwidth limitations on that front. You can always display directly with something like:

gst-launch-1.0 v4l2src device=/dev/video99 ! video/x-raw,framerate=30/1 \
! videoconvert \
! videoscale \
! xvimagesink


@craig @snafu666
here is what I get after inspection, video of 5sec instead of what’s shown in the terminal

the resulted video seems to be accelerated…

@craig @snafu666
and this is the pipeline in gst_viewer.c :

pipe_proc = "decodebin ! autovideoconvert ! "
		"video/x-raw,format=I420 ! identity drop-allocation=true !"
		"v4l2sink device=/dev/video99 sync=false"; 

And also, I’m still trying this on my Jetson Nano.

1 Like

What version of Jetpack are you using and what type of SDCard on the nano?

Does it work if you display it to source?

gst-launch-1.0 v4l2src device=/dev/video99 ! video/x-raw,framerate=30/1 \
! videoconvert \
! videoscale \
! xvimagesink

The command looks identical.

Do you have the same problem with this?

gst-launch-1.0 v4l2src device=/dev/video99 ! video/x-raw,framerate=30/1
! nvvidconv
! omxh264enc
! h264parse ! matroskamux \
! filesink location=vid99.mkv

Oh my god, the second command managed to save the file in a corrected way, 2 minutes of video for 2 minutes of recording ! thank you so much !!!
The only small problem that I have is that the quality is very bad… (with 3840 x 1920 dimension).

The first command line shows the streams but incorrectly (result is hugely zoomed)

Also, I am considering buying another SD card, which one do you advice me to buy if we assume that I have very good financial resources ?
Or do you think that running the jetsonNano on a hardDrive is better than an SD card ?

I’m personally using the SanDisk card below. It was recommended on a robotics site. I think you should search for “Jetson SDCard recommendation” on Google and see what comes up. I don’t know too much about SDCards, but I believe the speed of the card matters with the Jetson.

I read on the NVIDIA developer forums that it is better to use an SSD when saving video to file. However, I do not have experience with this. I suggest you try posting a question to the NVIDIA forum before you spend money on the SSD.

If you post, and if you have time, link back to this discussion thread in case other people want to experiment with the RICOH THETA.

Your Jetson Nano is acting differently from mine. Are you running JetPack 4.4 from the NVIDIA site?

It seems like there is something missing on your OS installation. Can you put the video file up on some cloud drive such as Google Drive or DropBox and then put the link to the test clip in this forum? It would be good if the clip was fairly small as my daughter is on Zoom classes all day and I have limited bandwidth. Something under 100MB would be nice.

I’m using the jetson-nano-4gb-jp441-sd-card-image as OS, isn’t it an appropriate one ? (available on NVIDIA official website)

We’re using the same OS image from the NVIDIA site.

Does the problem only occur when you try to save the video to the microSD card? Does it display properly to the monitor?

There is a minor difference between your setup and the successful tests. I’m not sure what it is.

I’m using the barrel connector for power, not the USB port.

when I display it with gst_viewer it works perfectly fine,

but not with this command (the resulted video is hugely zoomed)

gst-launch-1.0 v4l2src device=/dev/video99 ! video/x-raw,framerate=30/1
! videoconvert
! videoscale
! xvimagesink

here is a link of one stream recorded via the h264 encoding :

the problem is that it is quite a lot pixelised, which gives a bad result,
The huffman encoding otherwise generates a weired video of one second (seems to be accelerated) but with a good quality

Thank you for help @craig !!

Hello. I am trying to use my Ricoh Theta V as a webcam on my Linux computer.
One main difference of my system is that it’s on Ubuntu 16.04 .

I ran into the problem that i couldn’t run

gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-raw,framerate=30/1
due to the following error:

libv4l2: error getting pixformat: Invalid argument
start, hit any key to stop
Error: Internal data flow error.

I try to search for this error, but couldn’t find any clues. Do you have any ideas on this error?

What I’ve confirmed / did:

1.Theta V is connected on LIVE mode. (lsusb shows ID:05ca: 2712 )
2.modprobe v4l2loopback => /dev/video1 port is assigned.
3.change a line in gst_viewer.c => v4l2sink device=/dev/video1
4.gst_viewer shows the livestreaming successfully.
5.try install libv4l-dev via apt install (not sure if related or not)

Thank you for this topic.
I got an error “Can’t open THETA” It will be so helpful if you know the reason. I use Jetson Xavier and Theta V.


Please verify that the THETA is turned on and in live streaming mode. The word “LIVE” needs to be on the front of the camera.

I am not able to install v4l2loopback on Ubuntu 16.04. Did you install it?