Archive: 2021/01/24

VAAPIとffmpeg

昨年12月に続いてASRock H97 Pro4にXeon E3-1265L v3を載せたHaswellでのQSVなハードウェアエンコードの続き。

h264_vaapiffmpegの準備。2017年に倣ってbuildしないとなぁ…と思ってたんだけれども、

ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
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:~#
aptで導入されたffmpegでもVAAPI対応しているみたいだ。

Ubuntu20.04

2014年6月にUbuntu 14.04 (Trusty)にアップデートしたbravotouring.comのサーバ。

Hugo乗り換えを大義名分に先送りにしていたアップデートを、気の迷いで1月13日未明にうっかり実施。大胆にもdo-release-upgradeを3回繰り返し、LTS最新版のUbuntu 20.04 (Focal Fossa)という荒業にチャレンジしたメモ。

まず、spamassassinが起動に失敗。うん、CPANが追いついてないので無理だよね、というわけでひとまずuninstallして首絞め。

続いて、DKIMNSDも起動に失敗していて、メールが送受信できない事に気づいて軽く慌てはじめる。/var/log/syslog

Jan 13 03:59:56 vps nsd[2349728]: Error in SSL_CTX use_certificate_file
crypto error:140AB18F:SSL routines:SSL_CTX_use_certificate:ee key too small
というエラーに気づいた。ググってみるとOpenSSL 1.1.1/changelog[28 May 2019]で
Change the default RSA, DSA and DH size to 2048 bit instead of 1024. This changes the size when using the genpkey command when no size is given. It fixes an omission in earlier changes that changed all RSA, DSA and DH generation commands to use 2048 bits by default.
と、鍵長が2048ビット以上でないとダメになったようなので、nsd-control-setupで鍵を作り直してみた。
root@vps:/etc/nsd# nsd-control-setup
setup in directory /etc/nsd
nsd_server.key exists
nsd_control.key exists

create nsd_server.pem (self signed certificate)
create nsd_control.pem (signed client certificate)
Signature ok
subject=CN = nsd-control
Getting CA Private Key
Setup success. Certificates created.
root@vps:/etc/nsd#