昨年12月に続いてASRock H97 Pro4にXeon E3-1265L v3を載せたHaswellでのQSVなハードウェアエンコードの続き。
h264_vaapiなffmpegの準備。2017年に倣ってbuildしないとなぁ…と思ってたんだけれども、
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developersaptで導入されたffmpegでもVAAPI対応しているみたいだ。
built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
configuration: --extra-libs='-lpthread -lm' --enable-libmfx --enable-gpl --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'
root@haswell:~# ffmpeg -encoders 2>/dev/null | grep vaapi
V..... h264_vaapi H.264/AVC (VAAPI) (codec h264)
V..... hevc_vaapi H.265/HEVC (VAAPI) (codec hevc)
V..... mjpeg_vaapi MJPEG (VAAPI) (codec mjpeg)
V..... mpeg2_vaapi MPEG-2 (VAAPI) (codec mpeg2video)
V..... vp8_vaapi VP8 (VAAPI) (codec vp8)
V..... vp9_vaapi VP9 (VAAPI) (codec vp9)
root@haswell:~#
とりあえず↓あたりで試してみたところ15倍速くらいでエンコードできた。
root@haswell:~# ${FFMPEG} -vaapi_device /dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -i ${INPUTFILE} -vf 'format=nv12|vaapi,hwupload,scale_vaapi=w=720:h=480' -c:v h264_vaapi -profile:v 100 -level 40 -qp 20 -aspect 16:9 -c:a copy -y out.mp4
~~
frame= 9883 fps=466 q=-0.0 Lsize= 48007kB time=00:05:29.69 bitrate=1192.8kbits/s dup=17 drop=0 speed=15.5x
video:42022kB audio:5790kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.407860%
root@haswell:~#
【参照】
●web net FORCE https://webnetforce.net/
┗UbuntuでQSVを利用したエンコードでtsをmp4に爆速変換 2018年7月8日
●mecablog https://blog.misosi.ru/
┗VAAPIとDockerでDebianでもQSVを使ったh.264エンコードを行う 2017年4月25日
●Qiita https://qiita.com/
┗QSV 対応 Intel CPU で H.264 のハードウェアエンコード on Linux 2016年9月25日
●FFmpeg https://ffmpeg.org/
┣https://ffmpeg.org/releases/ffmpeg-4.3.1.tar.gz
┗CompilationGuide/Ubuntu
●Wikipedia https://en.wikipedia.org/wiki/
┗Video Acceleration API