2017年3月10日 星期五

ffmpeg h264 vaapi encoder error

心血來潮要看一部影片,發現在小米盒子上要嘛不支援
要嘛解的效果不好
原來這個影片是用h264 10bit格式壓縮
在電腦上看還可以,但總是想舒舒服服的躺在沙發上看影片
所以決定來轉檔

一開始在我的電腦上直接進行轉檔
Brix xm11-3337 Speed: 0.500x
嘗試透過vaapi加速,結果我得到錯誤訊息
impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto-inserted scaler 0'

丟到Raspberry pi 2上進行轉檔,同時開啟h264_omx hardware encoder
Speed: 0.479x

回頭查看看為什麼沒辦法透過vaapi加速
找到這篇文章
refer: https://ffmpeg.org/pipermail/ffmpeg-user/2016-May/032153.html

其中,我使用的vaapi device與文章中提到的不同,實際使用時可能要測試一下
ffmpeg -vaapi_device /dev/dri/card0 -i -vf format=nv12,hwupload -vcodec h264_vaapi -level 41 -acodec copy

透過vaapi加速編碼
Speed: 2.49x

一來速度快多了,二來這個速度已經足夠應付TVHeadend的即時轉碼
可以列入考慮~