FFmpeg's installation on The Jetson TX2

Ghulam Mujtaba
2 min readDec 9, 2020

Nvidia officially does not support FFmpeg on Jetson devices (Nano, TX2). The FFmpeg can use Jetson hardware device resources as an encoder and decoder. Using the following steps, we can install the FFmpeg Jetson device.

I have used the Jetson TX2 device with 4.3 Jetpack SDK in this process.

Start

Since FFmpeg built from the source, first install the dependent libraries.

$ sudo apt build-dep ffmpeg

If you get the error following error, then try this.

[sudo] password for mujtaba:
Reading package lists... Done
E: You must put some 'source' URIs in your sources.list

This is because of the source.list does not have the URI to get the source from, as per the error message. Although it is written in the source.list, it is commented out. So you can uncomment it.

Open vi like this and replace it.

:%s/# deb-src/deb-src/
:wq

Now, run again the following commands

$ sudo apt update
$ sudo apt build-dep ffmpeg

Build dependent libraries

$ git clone https://github.com/jocover/jetson-ffmpeg.git
$ cd jetson-ffmpeg
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install
$ sudo ldconfig

FFmpeg patch and build

$ git clone git://source.ffmpeg.org/ffmpeg.git -b release/4.2 --depth=1
$ cd ffmpeg
$ wget https://github.com/jocover/jetson-ffmpeg/raw/master/ffmpeg_nvmpi.patch
$ git apply ffmpeg_nvmpi.patch
$ ./configure --enable-nvmpi
$ make -j4 2>&1 |tee make.log
$ sudo make install
$ which ffmpeg
/usr/local/bin/ffmpeg
$ ffmpeg -codecs |grep 264
ffmpeg version 3eedf15 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04)
configuration: --enable-nvmpi
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_v4l2m2m h264_nvmpi ) (encoders: h264_nvmpi h264_v4l2m2m h264_vaapi )

I have confirmed that h264_nvmpi is included in the H.264 decoder and encoder.

--

--

Ghulam Mujtaba

I am creative, passionate, and try to implement my knowledge to complete the tasks and share them with others. https://www.gmujtaba.com/