编译RKMPP库+编解码测试+QT中mpp环境搭建

环境搭建和编译

RK官方MPP库地址:

https://github.com/rockchip-linux/mpp

移动到板子上,解压。

cd /home/mpp-develop/build/linux/aarch64     //根据操作系统选择相应的路径

vim arm.linux.cross.cmake   //根据实际路径指定编译器gcc和g++(如下是对的)
添加如下两行内容:
SET(CMAKE_C_COMPILER "/usr/bin/gcc")
SET(CMAKE_CXX_COMPILER "/usr/bin/g++")

./make-Makefiles.bash

make

cd test

官方提供了一些测试程序。测试程序的输出打印在/var/log/syslog。

//打开一个新终端,监控输出
tail -f /var/log/syslog

//转原终端,运行测试程序
./mpp_info_test

监控终端的输出如下:

Jul 12 21:08:43 kylinos mpp[5443]: mpp_info_test: normal version log:
Jul 12 21:08:43 kylinos mpp[5443]: mpp_info: mpp version: unknown mpp version for missing VCS info
Jul 12 21:08:43 kylinos mpp[5443]: mpp_info_test: history version log:
Jul 12 21:08:43 kylinos mpp[5443]: mpp_info: mpp version history 0:
Jul 12 21:08:43 kylinos mpp[5443]: mpp_compat: id| name -- mpp compat info
Jul 12 21:08:43 kylinos mpp[5443]: mpp_compat: 0 | increase decoder fbc buffer size
Jul 12 21:08:43 kylinos mpp[5443]: mpp_compat: 1 | support encoder async input mode

解码测试

解码H264,原视频分辨率1920x1080,fps25,总计250帧。解码指令为

sudo ./mpi_dec_test -i /home/xxx.h264 -t 7 -n 250 -o /home/xxx.yuv -w 1920 -h 1080

解码H265,原视频分辨率640x480,fps25,总计250帧。解码指令为

sudo ./mpi_dec_test -i /home/xxx.h265 -t 16777220 -n 250 -o /home/xxx.yuv -w 640 -h 480

其中,参数-t表明视频格式为h264;

-n为解码总帧数;

采用专用yuv播放器验证视频。或者ffplay播放;

编码测试

调用mpi_enc_test,编码视频,将yuv转为h264。先查看参数说明

将上文解码出的yuv视频转成h264,分辨率1920x1080,fps25,总帧数250。

编码指令为

sudo ./mpi_enc_test -i /home/xxx.yuv -t 7 -n 250 -o /home/xxx.h264 -w 1920 -h 1080 -fps 25

还可以实时编码摄像头的视频转h265,编码摄像头/dev/video11,分辨率640x480,fps25,总帧数250。

编码指令为

sudo ./mpi_enc_test -i /dev/video11 -t 16777220 -n 250 -o /home/xxx.h265 -w 640 -h 480 -fps 25

QT中mpp环境搭建

讯为RK3588的ubuntu自带mpp源码和库文件
qt的.pro文件:

INCLUDEPATH += /usr/include/rockchip/
LIBS += /usr/lib/aarch64-linux-gnu/librockchip_mpp.so

添加自己编译的mpp库环境:

INCLUDEPATH += /home/mpp-develop/mpp/inc/ \
               /home/mpp-develop/osal/inc/ \
			   /home/mpp-develop/inc/ \
			   /home/mpp-develop/mpp/base/inc/ \
			   /home/mpp-develop/mpp/codec/inc/ \
			   /home/mpp-develop/
LIBS += /usr/local/lib/libopencv_*.so \
        /home/mpp-develop/build/linux/aarch64/mpp/librockchip_mpp.so  \
        /home/mpp-develop/build/linux/aarch64/mpp/librockchip_mpp.so.0  \
        /home/mpp-develop/build/linux/aarch64/mpp/librockchip_mpp.so.1  \
        /home/mpp-develop/build/linux/aarch64/mpp/legacy/librockchip_vpu.so
        /home/mpp-develop/build/linux/aarch64/mpp/legacy/librockchip_vpu.so.0
        /home/mpp-develop/build/linux/aarch64/mpp/legacy/librockchip_vpu.so.1

你可能感兴趣的:(QT,rk3588,qt,ffmpeg,linux,音视频)