Keylost / jetson-ffmpeg

ffmpeg support on nvidia jetson
Other
78 stars 26 forks source link

jetson-ffmpeg

L4T Multimedia API for ffmpeg.
This library provides the ability to use hardware acceleration for video encoding and decoding on Nvidia Jetson platforms with the FFmpeg multimedia framework.

Jetson/JetPack support table

TK1 TX1 TX2 TX2i Nano AGX Xavier Xavier NX AGX Orin Orin NX Orin Nano
JetPack 1.0.x :large_blue_circle: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond:
JetPack 1.1.x :large_blue_circle: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond:
JetPack 1.2.x :large_blue_circle: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond:
JetPack 2.0.x :large_blue_circle: :large_blue_circle: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond:
JetPack 2.1.x :large_blue_circle: :large_blue_circle: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond:
JetPack 2.2.x :large_blue_circle: :large_blue_circle: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond:
JetPack 2.3.x :large_blue_circle: :large_blue_circle: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond:
JetPack 3.0.x :large_blue_circle: :large_blue_circle: :large_blue_circle: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond:
JetPack 3.1.x :large_blue_circle: :large_blue_circle: :large_blue_circle: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond:
JetPack 3.2.x :large_orange_diamond: :large_blue_circle: :large_blue_circle: :large_blue_circle: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond:
JetPack 3.3.x :large_orange_diamond: :large_blue_circle: :large_blue_circle: :large_blue_circle: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond:
JetPack 4.1.x :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_blue_circle: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond:
JetPack 4.2.x :large_orange_diamond: :large_blue_circle: :large_blue_circle: :large_blue_circle: :large_blue_circle: :large_blue_circle: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond:
JetPack 4.3.x :large_orange_diamond: :large_blue_circle: :large_blue_circle: :large_blue_circle: :large_blue_circle: :large_blue_circle: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond:
JetPack 4.4.x :large_orange_diamond: :large_blue_circle: :large_blue_circle: :large_blue_circle: :large_blue_circle: :large_blue_circle: :large_blue_circle: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond:
JetPack 4.5.x :large_orange_diamond: :large_blue_circle: :large_blue_circle: :large_blue_circle: :white_check_mark: :white_check_mark: :white_check_mark: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond:
JetPack 4.6.x :large_orange_diamond: :large_blue_circle: :large_blue_circle: :large_blue_circle: :white_check_mark: :white_check_mark: :white_check_mark: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond:
JetPack 5.0.x :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :white_check_mark: :white_check_mark: :white_check_mark: :large_orange_diamond: :large_orange_diamond:
JetPack 5.1.x :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
JetPack 6.0.x :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_blue_circle: :large_blue_circle: :large_blue_circle:
JetPack 6.1.x :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_orange_diamond: :large_blue_circle: :large_blue_circle: :large_blue_circle:

FFmpeg support list

Supports Decoding

Supports Encoding

Other Features

Building and usage

1.build and install library

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

Cmake options:

Build with stubs and custom dirs example:

cmake -DWITH_STUBS=ON -DJETSON_MULTIMEDIA_API_DIR=/home/user/build_deps/jetson_multimedia_api ..
make

2.patch ffmpeg and build

clone one of supported ffmpeg versions (for example ffmpeg 7.1)
git clone git://source.ffmpeg.org/ffmpeg.git -b release/7.1 --depth=1
Go to the directory with the jetson-ffmpeg sources and patch the ffmpeg using the ffpatch.sh script.
cd jetson-ffmpeg
./ffpatch.sh ../ffmpeg
Go to ffmpeg sources directory configure and build ffmpeg with nvmpi enabled and your custom options 
cd ../ffmpeg
./configure --enable-nvmpi
make
sudo make install

3.using

Decode h264 video example

ffmpeg -c:v h264_nvmpi -i <input.mp4> -f null -

Decode h264 video with fast scaling during decoding example

ffmpeg -c:v h264_nvmpi -resize:v 1920x1080 -i <input.mp4> -f null -

Encode h264 video example

ffmpeg -i <input.mp4> -c:v h264_nvmpi <output.mp4>

Transcode h264 to h265 video example

ffmpeg -c:v h264_nvmpi -i <input.mp4> -c:v hevc_nvmpi <output.mp4>