Skip to content

Keylost/jetson-ffmpeg

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  • ✅ - Fully supported.
  • 🔵 - Not tested.
  • ❌ - Not supported.
  • 🔶 - There is no JetPack version available for this platform.
TK1 TX1 TX2 TX2i Nano AGX Xavier Xavier NX AGX Orin Orin NX Orin Nano
JetPack 1.0.x 🔵 🔶 🔶 🔶 🔶 🔶 🔶 🔶 🔶 🔶
JetPack 1.1.x 🔵 🔶 🔶 🔶 🔶 🔶 🔶 🔶 🔶 🔶
JetPack 1.2.x 🔵 🔶 🔶 🔶 🔶 🔶 🔶 🔶 🔶 🔶
JetPack 2.0.x 🔵 🔵 🔶 🔶 🔶 🔶 🔶 🔶 🔶 🔶
JetPack 2.1.x 🔵 🔵 🔶 🔶 🔶 🔶 🔶 🔶 🔶 🔶
JetPack 2.2.x 🔵 🔵 🔶 🔶 🔶 🔶 🔶 🔶 🔶 🔶
JetPack 2.3.x 🔵 🔵 🔶 🔶 🔶 🔶 🔶 🔶 🔶 🔶
JetPack 3.0.x 🔵 🔵 🔵 🔶 🔶 🔶 🔶 🔶 🔶 🔶
JetPack 3.1.x 🔵 🔵 🔵 🔶 🔶 🔶 🔶 🔶 🔶 🔶
JetPack 3.2.x 🔶 🔵 🔵 🔵 🔶 🔶 🔶 🔶 🔶 🔶
JetPack 3.3.x 🔶 🔵 🔵 🔵 🔶 🔶 🔶 🔶 🔶 🔶
JetPack 4.1.x 🔶 🔶 🔶 🔶 🔶 🔵 🔶 🔶 🔶 🔶
JetPack 4.2.x 🔶 🔵 🔵 🔵 🔵 🔵 🔶 🔶 🔶 🔶
JetPack 4.3.x 🔶 🔵 🔵 🔵 🔵 🔵 🔶 🔶 🔶 🔶
JetPack 4.4.x 🔶 🔵 🔵 🔵 🔵 🔵 🔵 🔶 🔶 🔶
JetPack 4.5.x 🔶 🔵 🔵 🔵 🔶 🔶 🔶
JetPack 4.6.x 🔶 🔵 🔵 🔵 🔶 🔶 🔶
JetPack 5.0.x 🔶 🔶 🔶 🔶 🔶 🔶 🔶
JetPack 5.1.x 🔶 🔶 🔶 🔶 🔶
JetPack 6.0.x 🔶 🔶 🔶 🔶 🔶 🔶 🔶 🔵 🔵 🔵
JetPack 6.1.x 🔶 🔶 🔶 🔶 🔶 🔶 🔶 🔵 🔵 🔵

FFmpeg support list

  • Currently the library is compatible with FFmpeg 4.2, 4.4 and 6.0.

Supports Decoding

  • H.264/AVC (ffmpeg codec name: h264_nvmpi)
  • H.265/HEVC (ffmpeg codec name: hevc_nvmpi)
  • MPEG2 (ffmpeg codec name: mpeg2_nvmpi)
  • MPEG4 (ffmpeg codec name: mpeg4_nvmpi)
  • VP8 (ffmpeg codec name: vp8_nvmpi)
  • VP9 (ffmpeg codec name: vp9_nvmpi)

Supports Encoding

  • H.264/AVC (ffmpeg codec name: h264_nvmpi)
  • H.265/HEVC (ffmpeg codec name: hevc_nvmpi)

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:

  • -DJETSON_MULTIMEDIA_API_DIR=<path_to_dir> Path to custom Jetson Multimedia API headers and common sources directory. Default: /usr/src/jetson_multimedia_api.
  • -DJETSON_MULTIMEDIA_LIB_DIR=<path_to_dir> Path to custom Jetson Multimedia libraries directory. Default: /usr/lib/aarch64-linux-gnu/tegra.
  • -DCUDA_INCLUDE_DIR=<path_to_dir> Path to custom CUDA headers directory. Default: /usr/local/cuda/include.
  • -DCUDA_LIB_DIR=<path_to_dir> Path to custom CUDA libraries directory. Default: /usr/local/cuda/lib64.
  • -DWITH_STUBS=[ON/OFF] Build nvmpi library and link stubs instead of original libraries. Default: OFF. Could be user to create automated builds or Docker images. See #9 for details and script example.

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
git clone git://source.ffmpeg.org/ffmpeg.git -b release/4.2 --depth=1
or
git clone git://source.ffmpeg.org/ffmpeg.git -b release/4.4 --depth=1
or
git clone git://source.ffmpeg.org/ffmpeg.git -b release/6.0 --depth=1
cd ffmpeg
get and apply patch for your ffmpeg version
wget -O ffmpeg_nvmpi.patch https://github.com/Keylost/jetson-ffmpeg/raw/master/ffmpeg_patches/ffmpeg4.2_nvmpi.patch
or
wget -O ffmpeg_nvmpi.patch https://github.com/Keylost/jetson-ffmpeg/raw/master/ffmpeg_patches/ffmpeg4.4_nvmpi.patch
or
wget -O ffmpeg_nvmpi.patch https://github.com/Keylost/jetson-ffmpeg/raw/master/ffmpeg_patches/ffmpeg6.0_nvmpi.patch
git apply ffmpeg_nvmpi.patch
./configure --enable-nvmpi
make
sudo make install

3.using

Decode h264 video example

ffmpeg -c:v h264_nvmpi -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 h265_nvmpi <output.mp4>

About

ffmpeg support on nvidia jetson

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Makefile 56.4%
  • C 31.6%
  • C++ 10.5%
  • CMake 1.2%
  • Shell 0.3%