rk3588 mpp video hard codec test

rk3588 mpp demo usage record.

1 Download source code

The official address for MPP source code release: https://github.com/rockchip-linux/mpp
The release branch is the release branch, the development branch is the develop branch, and the default is the development branch.
Download command: git clone https://github.com/rockchip-linux/mpp.git

2 compile

The MPP source code compilation script is cmake, which needs to rely on version 2.8.12 or above. It is recommended to use version 2.8.12. Using higher versions of the cmake
tool may generate more warnings.

2.1 Android platform cross-compilation

Compiling the Android library requires the use of the ndk environment, and the default script is compiled using android-ndk-r10d.
The download path of r10d ndk can be found in the build/android/ndk_links.md file in the source code directory.
Unzip the downloaded ndk to /home/pub/ndk/android-ndk-r10d, or manually modify the ANDROID_NDK variable
path of the env_setup.sh script in the build/android/ directory.
Enter the build/android/arm/ directory, run the make-Android.bash script to generate the Makefile for compilation, and run make –j16 to
compile.

2.2 Compilation for Unix/Linux platform

First configure the tool chain in the arm.linux.cross.cmake file in the build/linux/arm/ directory, then run the make-Makefiles.bash script to
generate the Makefile through cmake, and finally run make –j16 to compile.
MPP also supports compiling directly on Debian running on the development board.

3 Copy the compiled files and corresponding libraries to the device

4 Instructions

mpi_enc_test 的命令参数中,图像宽度(w)图像高度(h),码流类型(t)为强制要求参数,
其他参数如输入文件(i),输出文件(o),编码帧数(n)等为可选参数。
如果没有指定输入文件,mpi_enc_test会生成默认彩条图像进行编码。
以编码/sdcard 下的 soccer_720x480_30fps.yuv 文件 10 帧为例,对 demo 和输出进行说明。

运行的命令为:
mpi_enc_test -w 720 -h 480 -t 7 -i /sdcard/soccer_720x480_30fps.yuv -o /sdcard/out.h264 -n 10
mpi_dec_test 的命令参数中,输入文件(i),码流类型(t)为强制要求的参数,其他参数如输出文件(o),图像宽度(w)图像高度(h),
解码帧数(n)等为可选参数,影响不大。
后面的打印显示了 MPP 库支持的 coding 格式,支持 MPEG2/4,H.263/4/5,VP8/9 的解码,id 后的数字为格式对应的-t 项后的参数值。
参数值来源于 OMX 的定义,HEVC 和 AVS 的格式参数值与其他的格式参数值区别较大,需要留意。
然后以/sdcard/下的 tennis200.h264 解码 10 帧为例,对 demo 和输出进行说明。

运行的命令为:
mpi_dec_test -t 7 -i /sdcard/tennis200.h264 -n 10
-t 7 表示是 H.264 码流,-i 表示输入文件,-n 10 表示解码 10 帧

5 Convert video to YUV format for encoding and decoding

Convert using ffmpeg tool in linux server

将 mp4 格式转换成 yuv
ffmpeg -i input.mp4 -s 640x480 -pix_fmt yuv420p output.yuv 
备注:-i 表示设定输入流-s 设定画面的宽与高(此项很重要)-pix_fmt 设定的像素格式

播放 yuv 视频
ffplay -video_size 640x480 -i output.yuv-video_size 
播放的视频文件的帧宽度和帧高度(此项需和前面转换的 “-s 640x480” 保持一致)-i 表示指定的输入文件

Guess you like

Origin blog.csdn.net/weixin_43069863/article/details/132212568