The Linux Page

Playing a video with your Jetson TX1/TX2/AGX from the command line

I got a Jetson TX2 not too long ago and was first looking into how to play a 4K video using the full accelerated GPU to see that it would be all smooth and play with the correct colors, etc.

My first experience with SBCs was with a Raspberry Pi and that board would display really crappy videos.

The first test I tried was to go to Chrome, the browser, and then attempt to play the video from there. Unfortunately, Chrome has difficulties to find the right wayt to accelerate video decompression and thus it did everything in software. It would use a good 100% of the 6 CPUs and  the video was still choppy. Hmmm.... Not too surprising since 4K is a pretty large amount of data to deal with. (See video example below)

Searching a little more, I finally found out that nVidia supports G-Streamer and has that command line pre-installed. So all you have to do is run that nVidia version as in:

nvgstplayer -i <video-filename>

That command line tool will open a window at the size of the video (so pretty much full size with a 4K video) and start playing your video. It's also possible to connect to a server playing a video on another computer. Assuming your network has enough bandwidth, it should work like a charm.

The framerate was around 23.97 throughout the entire movie even though I moved the windows, had my console over the G-Stream window, change the window size multiple times. While changing the size of my console, it was slow to respond, but the framerate on the video playback was constant. So they have a way to prioritize that over other X-Windows functions.

In any event, this looked just perfect.

Now here is the old video with the Chrome movie player. It works, but every now and then, it blocks for a second or so, which looks really bad. It would certainly work okay with a 2K video, though.

For the newer version (Jetson AGX Xaview), I used the following command line to make the video 100% fullscreen:

gst-launch-1.0 filesrc location='4K Aquarium.mp4' ! \
     qtdemux name=demux ! h264parse ! omxh264dec ! nvoverlaysink -e

The following command works too, but it's not 100% fullscreen. You still see the menu bar at the top, and the icon bar on the left (or wherever you placed your icon bar):

gst-launch-1.0 filesrc location='4K Aquarium.mp4' ! \
     qtdemux name=demux demux.video_0 ! queue ! h264parse ! omxh264dec ! \
     nveglglessink -e

Nvidia provides a document about gstreamer, but it's not freely accessible. You need to have an account to see it. You find the link on this NVidia page (first answer at time of writing).


I ran in a problem where the screen goes to red.

To get out of the fullscreen mode, I use the Alt-Tab trick to come back to the terminal I used to start the command. From there I can do things such as 'q' or Ctrl-C to exit. But the Alt-Tab transforms the screen to red and whatever I do next it looks like it's dead. The screen remains red.

If found what looks like a solution on the NVidia forum. It says to add this parameter to the X11 configuration file. So first do:

vim /etc/X11/xorg.conf

Then in the Section "Device" block, add:

    Option "TegraReserveDisplayBandwidth" "false"

Now it should look like this:

Section "Device"
    Identifier  "Tegra0"
    Driver      "nvidia"
    Option      "AllowEmptyInitialConfiguration" "true"
    Option      "TegraReserveDisplayBandwidth" "false"

The docs say that you should not use that option if at all possible. So... if you can remove it later once your software is all up and running and you do not get a red screen, try to remember to remove the option.

WARNING: This is only for Tegra boards.