Skip to main content

1. Install ffmpeg

FFmpeg installed via apt is a general software version, while ffmpeg-rockchip is a hardware-accelerated version tailored specifically for the Rockchip (Rockchip Microelectronics) RK35xx series of chips. It supports hardware-accelerated video processing, including MPP hardware encoder and decoder, as well as RGA filter acceleration.

1.1 Install software package dependencies

Execute the following command on the board to install software package dependencies:

sudo apt update
sudo apt install git meson cmake pkg-config gcc libasound2-dev libdrm-dev ninja-build libv4l-dev -y

1.2 Install MPP

This is Rockchip's media processing platform, which directly utilizes the hardware decoder (H.264/HEVC/AV1, etc.) and hardware encoder (H.264/HEVC) within the chip. This enables it to effortlessly handle the decoding or encoding of 8K videos, while the CPU remains almost idle. Execute the following command on the board to compile the MPP library:

mkdir -p ~/ffmpeg && cd ~/ffmpeg
git clone -b jellyfin-mpp --depth=1 https://github.com/nyanmisaka/mpp.git rkmpp
mkdir -p rkmpp/rkmpp_build && cd rkmpp/rkmpp_build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBUILD_TEST=OFF ..
sudo make -j$(nproc)
sudo make install

View rkmpp decoder:

armsom@armsom:~/ffmpeg/rkmpp/rkmpp_build$ ffmpeg -decoders | grep rkmpp
ffmpeg version 03498fe Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04.2)
configuration: --prefix=/usr --enable-gpl --enable-version3 --enable-libdrm --enable-rkmpp --enable-rkrga --enable-alsa --enable-libv4l2
libavutil 58. 29.100 / 58. 29.100
libavcodec 60. 31.102 / 60. 31.102
libavformat 60. 16.100 / 60. 16.100
libavdevice 60. 3.100 / 60. 3.100
libavfilter 9. 12.100 / 9. 12.100
libswscale 7. 5.100 / 7. 5.100
libswresample 4. 12.100 / 4. 12.100
libpostproc 57. 3.100 / 57. 3.100
V..... av1_rkmpp Rockchip MPP (Media Process Platform) AV1 decoder (codec av1)
V..... h263_rkmpp Rockchip MPP (Media Process Platform) H263 decoder (codec h263)
V..... h264_rkmpp Rockchip MPP (Media Process Platform) H264 decoder (codec h264)
V..... hevc_rkmpp Rockchip MPP (Media Process Platform) HEVC decoder (codec hevc)
V..... mjpeg_rkmpp Rockchip MPP (Media Process Platform) MJPEG decoder (codec mjpeg)
V..... mpeg1_rkmpp Rockchip MPP (Media Process Platform) MPEG1VIDEO decoder (codec mpeg1video)
V..... mpeg2_rkmpp Rockchip MPP (Media Process Platform) MPEG2VIDEO decoder (codec mpeg2video)
V..... mpeg4_rkmpp Rockchip MPP (Media Process Platform) MPEG4 decoder (codec mpeg4)
V..... vp8_rkmpp Rockchip MPP (Media Process Platform) VP8 decoder (codec vp8)
V..... vp9_rkmpp Rockchip MPP (Media Process Platform) VP9 decoder (codec vp9)

1.3 Install RGA

This is a 2D graphics acceleration engine. When you need to perform video scaling, format conversion (such as YUV to RGB), cropping, or rotation, RGA can accomplish it instantly like an "acceleration card", much faster than processing with the CPU. Execute the following command on the board to compile the RGA library:

mkdir -p ~/ffmpeg && cd ~/ffmpeg
git clone -b jellyfin-rga --depth=1 https://github.com/nyanmisaka/rk-mirrors.git rkrga
meson setup rkrga rkrga_build --prefix=/usr --libdir=lib --buildtype=release -Dcpp_args=-fpermissive -Dlibdrm=false -Dlibrga_demo=false
meson configure rkrga_build
sudo ninja -C rkrga_build install

Check rkrga:

armsom@armsom:~/ffmpeg$ ffmpeg -filters | grep rkrga
ffmpeg version 03498fe Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04.2)
configuration: --prefix=/usr --enable-gpl --enable-version3 --enable-libdrm --enable-rkmpp --enable-rkrga --enable-alsa --enable-libv4l2
libavutil 58. 29.100 / 58. 29.100
libavcodec 60. 31.102 / 60. 31.102
libavformat 60. 16.100 / 60. 16.100
libavdevice 60. 3.100 / 60. 3.100
libavfilter 9. 12.100 / 9. 12.100
libswscale 7. 5.100 / 7. 5.100
libswresample 4. 12.100 / 4. 12.100
libpostproc 57. 3.100 / 57. 3.100
... overlay_rkrga VV->V Rockchip RGA (2D Raster Graphic Acceleration) video compositor
... scale_rkrga V->V Rockchip RGA (2D Raster Graphic Acceleration) video resizer and format converter
... vpp_rkrga V->V Rockchip RGA (2D Raster Graphic Acceleration) video post-process (scale/crop/transpose)

1.4 Install ffmpeg-rockchip

If you are using devices equipped with Rockchip chips such as RK3576 and RK3588, and need to perform high-resolution video transcoding, real-time streaming media processing (such as setting up home surveillance or live streaming), or wish to significantly reduce CPU load, then this version is the only choice. Execute the following command on the board to compile ffmpeg-rockchip:

mkdir -p ~/ffmpeg && cd ~/ffmpeg
git clone --depth=1 https://github.com/nyanmisaka/ffmpeg-rockchip.git ffmpeg-rockchip
cd ffmpeg-rockchip
./configure --prefix=/usr --enable-gpl --enable-version3 --enable-libdrm --enable-rkmpp --enable-rkrga --enable-alsa --enable-libv4l2
make -j$(nproc)
sudo make install

Verify support after installation:

armsom@armsom:~/ffmpeg/ffmpeg-rockchip$ ffmpeg -decoders | grep rkmpp
ffmpeg version 03498fe Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04.2)
configuration: --prefix=/usr --enable-gpl --enable-version3 --enable-libdrm --enable-rkmpp --enable-rkrga --enable-alsa --enable-libv4l2
libavutil 58. 29.100 / 58. 29.100
libavcodec 60. 31.102 / 60. 31.102
libavformat 60. 16.100 / 60. 16.100
libavdevice 60. 3.100 / 60. 3.100
libavfilter 9. 12.100 / 9. 12.100
libswscale 7. 5.100 / 7. 5.100
libswresample 4. 12.100 / 4. 12.100
libpostproc 57. 3.100 / 57. 3.100
V..... av1_rkmpp Rockchip MPP (Media Process Platform) AV1 decoder (codec av1)
V..... h263_rkmpp Rockchip MPP (Media Process Platform) H263 decoder (codec h263)
V..... h264_rkmpp Rockchip MPP (Media Process Platform) H264 decoder (codec h264)
V..... hevc_rkmpp Rockchip MPP (Media Process Platform) HEVC decoder (codec hevc)
V..... mjpeg_rkmpp Rockchip MPP (Media Process Platform) MJPEG decoder (codec mjpeg)
V..... mpeg1_rkmpp Rockchip MPP (Media Process Platform) MPEG1VIDEO decoder (codec mpeg1video)
V..... mpeg2_rkmpp Rockchip MPP (Media Process Platform) MPEG2VIDEO decoder (codec mpeg2video)
V..... mpeg4_rkmpp Rockchip MPP (Media Process Platform) MPEG4 decoder (codec mpeg4)
V..... vp8_rkmpp Rockchip MPP (Media Process Platform) VP8 decoder (codec vp8)
V..... vp9_rkmpp Rockchip MPP (Media Process Platform) VP9 decoder (codec vp9)