6.1 多媒体能力测试

6.1.1 数据准备

执行以下命令,下载数据:

pip3 install dfss --force-reinstall
python3 -m dfss --url=open@sophgo.com:test/video_decode_encode_test/data.tgz
python3 -m dfss --url=open@sophgo.com:test/video_decode_encode_test/scripts.tgz

下载的内容包括:

.data

├── 1080p-3Mbps-h264.mkv # 1080p 3Mbps码率 h264视频
├── 1080p-3Mbps-hevc.mkv # 1080p 3Mbps码率 h265视频
├── 4k-4Mbps-h264.mkv # 4k 4Mbps码率 h264视频
├── 4k-4Mbps-hevc.mkv # 4k 4Mbps码率 h265视频
├── 720p-2Mbps-h264.mkv # 720p 2Mbps码率 h264视频
├── 720p-2Mbps-hevc.mkv # 720p 2Mbps码率 h265视频
├── 8k-8Mbps-h264.mkv # 8k 8Mbps码率 h264视频
├── 8k-8Mbps-hevc.mkv # 8k 8Mbps码率 h265视频
└──test.264 # 转码测试文件

.scripts
├── 4k-8k-decode.sh # 4k、8k视频解码
├── 4k-8k-encode.sh # 4k、8k视频编码
├── decode.sh # 解码测试脚本
├── encode.sh # 编码测试脚本
├── transcode-1Mbps.sh # 转码1Mbps测试脚本
└── transcode-32kbps.sh # 转码32kbps测试脚本

6.1.2 解码能力测试

使用1080P视频测试解码能力,需要指定输入的视频、使用的tpu id(SoC形态上,只能输入0)、测试线程数。

以1080P视频、0号TPU、16线程为例:

$ bash decode.sh

video:1080p-3Mbps-h264.mkv

tpu_id:0

thread_num:16

Start Wait End...

nohup: redirecting stderr to stdout ...

Start Calc fps...

tpu_id: 0

total_frames: 14400

avg_time: 19.3676

speed: 743.51

如上,可以看到总共16个线程,总的解码速度为743.51fps。可以保证16路1080P数据30fps的解码。

6.1.3 编码能力测试

使用1080P视频测试编码能力,需要指定输入的视频、使用的tpu id(SoC形态上,只能输入0)、测试线程数。

以1080P视频、0号TPU、12线程为例:

$ bash encode.sh

video:1080p-3Mbps-h264.mkv

tpu_id:0

thread_num:12

encode_type(h264_bm / hevc_bm):h264_bm

nohup: redirecting stderr to stdout

Start Wait End... ...

Start Calc fps...

tpu_id: 0

total_frames: 10800

avg_time: 29.5306

speed: 365.72

如上,可以看到总共12个线程,总的编码速度为365.72fps。可以保证12路1080P数据30fps的编码。