前提:已經成功安裝了intel media sdk,可參考unbuntu12.04上安裝intel linux media SDK。 linux
測試使用SDK提供的編碼例程(/opt/intel/mediasdk/samples/_bin/x64/sample_encode_drm) ide
下面是簡單的測試記錄: 測試
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
spa