2019独角兽企业重金招聘Python工程师标准>>>
前提:已经成功安装了intel media sdk,可参考unbuntu12.04上安装intel linux media SDK。
测试使用SDK提供的编码例程(/opt/intel/mediasdk/samples/_bin/x64/sample_encode_drm)
下面是简单的测试记录:
1.编一路1080P视频, 例程占20%左右的CPU,0.4%的内存,且比较稳定。
tvie@tvie:/opt/intel/mediasdk/samples/_bin/x64$ time sudo ./sample_encode_drm h264 -i /home/tvie/fcl.yuv -o es2.h264 -w 1920 -h 1080 -hw
Input file format YUV420
Output video AVC
Source picture:
Resolution 1920x1088
Crop X,Y,W,H 0,0,1920,1080
Destination picture:
Resolution 1920x1088
Crop X,Y,W,H 0,0,1920,1080
Frame rate 30.00
Bit rate(Kbps) 3757
Target usage balanced
Memory type system
Media SDK impl hw
Media SDK version 1.6
Processing started
Frame number: 1732
Processing finished
real 0m42.350s
user 0m5.816s
sys 0m3.536s
2. 同时编两路1080P视频, 每个例程占20%左右的CPU,0.4%的内存,且比较稳定。
Processing started
Frame number: 1732
Processing finished
real 0m44.012s
user 0m5.428s
sys 0m2.444s
=================
Processing started
Frame number: 1732
Processing finished
real 0m45.285s
user 0m5.312s
sys 0m2.300s
同时编2路1080P视频, 时间和一路差不多。
3. 同时编4路1080P视频, 每个例程占22%左右的CPU,0.4%的内存,且比较稳定。
real 0m29.013s
user 0m5.340s
sys 0m1.420s
=======
real 0m30.265s
user 0m5.304s
sys 0m1.456s
======
real 0m30.427s
user 0m5.364s
sys 0m1.368s
======
real 0m30.026s
user 0m5.212s
sys 0m1.520s
居然更快了!!! 好神奇
4. 同时编6路1080P视频,有点奇怪,6个例程中前4个先各占28%左右的CPU,后两个占3%的CPU,内存均占用0.4%。
real 0m30.751s
user 0m6.084s
sys 0m2.004s
======
real 0m30.661s
user 0m6.036s
sys 0m1.900s
======
real 0m30.627s
user 0m6.136s
sys 0m1.928s
======
real 0m30.020s
user 0m5.952s
sys 0m1.956s
======
Processing started
Frame number: 100
Return on error: error code -17, /msdk/validation/linux_val/validation/ww11.3_Linux-HSW-16.3.1_vc21_Ubuntu_12.04/samples/sample_encode/src/pipeline_encode.cpp 1305
ERROR: Hardware device was lost or returned an unexpected error. Recovering...
Frame number: 1722
Processing finished
real 0m48.319s
user 0m5.856s
sys 0m1.672s
======
Processing started
Frame number: 200
Return on error: error code -17, /msdk/validation/linux_val/validation/ww11.3_Linux-HSW-16.3.1_vc21_Ubuntu_12.04/samples/sample_encode/src/pipeline_encode.cpp 1305
ERROR: Hardware device was lost or returned an unexpected error. Recovering...
Frame number: 1722
Processing finished
real 0m48.255s
user 0m5.852s
sys 0m1.696s
5. 调整编码参数,测试编码速度和编码质量。
1080P的视频需要码率2M以上才能保证良好效果。
测试1080P编码速度可达10倍速。
tvie@tvie:/opt/intel/mediasdk/samples/_bin/x64$ time sudo ./sample_encode_drm h264 -i /home/tvie/fcl.yuv -o es31.h264 -w 1920 -h 1080 -hw -f 25 -b 2000 -u speed
Input file format YUV420
Output video AVC
Source picture:
Resolution 1920x1088
Crop X,Y,W,H 0,0,1920,1080
Destination picture:
Resolution 1920x1088
Crop X,Y,W,H 0,0,1920,1080
Frame rate 25.00
Bit rate(Kbps) 2000
Target usage speed
Memory type system
Media SDK impl hw
Media SDK version 1.6
Processing started
Frame number: 1732
Processing finished
real 0m6.650s
user 0m5.328s
sys 0m1.292s