VPU/zh

From FriendlyELEC WiKi
Revision as of 10:11, 17 January 2024 by Tzs (Talk | contribs) (updated by API)

Jump to: navigation, search

English

1 How to test VPU

1.1 OS

Tested on the following OS:

1.1.1 Debian11 (bullseye)

  • rk3588-sd-debian-bullseye-desktop-6.1-arm64-20240116.img.gz
  • rk3568-sd-debian-bullseye-desktop-6.1-arm64-20231113.img.gz

1.1.2 Ubuntu20 (focal)

  • rk3588-sd-ubuntu-focal-desktop-6.1-arm64-20240116.img.gz

1.1.3 Buildroot

  • rk3588-sd-buildroot-5.10-arm64-20240117.img.gz

1.2 Debian/Ubuntu下重新编译mpp(可选)

在开发板上操作:

sudo apt update
sudo apt install gcc g++ cmake make
cd ~
git clone https://github.com/friendlyarm/mpp
    # 或者 git clone https://github.com/rockchip-linux/mpp.git
cd mpp/build/linux/aarch64/
sed -i 's/aarch64-linux-gnu-gcc/gcc/g' ./arm.linux.cross.cmake
sed -i 's/aarch64-linux-gnu-g++/g++/g' ./arm.linux.cross.cmake
./make-Makefiles.bash
make -j$(nproc)
sudo make install
cd test
sudo cp mpp_info_test /usr/local/bin/mpp_info_test
sudo cp mpi_dec_test /usr/local/bin/mpi_dec_test
sudo cp mpi_enc_test /usr/local/bin/mpi_enc_test

1.3 Buildroot下重新编译mpp(可选)

在电脑上操作:

export PATH=/path/to/your/buildroot-rk3588/buildroot/output/rockchip_rk3588/host/bin/:$PATH
cd buildroot-rk3588/external/mpp/build/linux/aarch64
sed -i 's/aarch64-linux-gnu-gcc/aarch64-linux-gcc/g' ./arm.linux.cross.cmake
sed -i 's/aarch64-linux-gnu-g++/aarch64-linux-g++/g' ./arm.linux.cross.cmake
./make-Makefiles.bash
make -j$(nproc)
cd test

进入mpp目录,将librockchip_mpp.so.0拷到开发板上:

wget http://YourIP/files/mpp/librockchip_mpp.so.0 -O /usr/lib/librockchip_mpp.so.0

进入test目录下,将mpp_info_test,mpi_dec_test,mpi_enc_test拷到开发板上:

wget http://YourIP/files/mpp/mpp_info_test -O /usr/bin/mpp_info_test
wget http://YourIP/files/mpp/mpi_dec_test -O /usr/bin/mpi_dec_test
wget http://YourIP/files/mpp/mpi_enc_test -O /usr/bin/mpi_enc_test

1.4 查看mpp版本

mpp_info_test
tail /var/log/messages

1.5 测试硬解码

wget http://112.124.9.243/test/200frames_count.h264 -O 200frames_count.h264
mpi_dec_test -t 7 -i 200frames_count.h264
tail /var/log/messages

1.6 测试硬编码

将nv12祼视频流编码成h264:

wget http://112.124.9.243/test/4k_nv12.yuv.tar.gz -O 4k_nv12.yuv.tar.gz
tar xzf 4k_nv12.yuv.tar.gz
mpi_enc_test -w 3840 -h 2160 -t 7 -i 4k_nv12.yuv -f 0 -o 4k_nv12.h264
tail /var/log/messages

打包成可播放的mp4文件:

ffmpeg -i 4k_nv12.h264 -vcodec copy -f mp4 4k_nv12.mp4

注:上面的视频流文件4k_nv12.yuv是在T6上通过HDMI-In抓取的,命令如下:

v4l2-ctl  -d /dev/video0 --set-fmt-video=width=3840,height=2160,pixelformat='NV12' --stream-mmap=4 --stream-skip=10  --stream-to=/tmp/4k_nv12.yuv --stream-count=240 --stream-poll