Данный пост навеян вопросами
https://www.linux.org.ru/forum/linux-hardware/14748819
Как правильно транскодить на AMD при помщи VAAPI?
https://www.linux.org.ru/forum/desktop/14459465
Низкая скорость кодирования H264 в RX 580 это нормально?
h264_vaapi - пробовал под убунтой 19.10 x64
Результат: скорость (fps) такая же как и у CPU
Решил сделать пару простейших тестов их родных amd кодеков h264_amf
и hevc_amf
Насколько я понял, под линукс эти кодеки тоже есть (https://github.com/GPUOpen-LibrariesAndSDKs/AMF/releases), но я их не тестил в убунте.
Запуск из консоли под Windows10.
ffmpeg version git-2019-12-14-24424a6
Тестировал с десяток видосов, выложил три теста.
Тест 1. Codec: x264. Video: 960x540. CPU: 155fps / GPU: 193fps
Исходник: https://workupload.com/file/VAGLrpnK
cpu encoding:
ffmpeg -i 8m.mp4 -y -b:v 3M -c:v libx264 -c:a libmp3lame -profile:v high -vf scale=960:540 out.mp4
frame= 814 fps=155 q=-1.0 Lsize= 9775kB time=00:00:27.06 bitrate=2959.3kbits/s speed=5.17x
gpu encoding: ffmpeg -hwaccel dxva2 -i 8m.mp4 -y -b:v 3M -c:v h264_amf -c:a libmp3lame -profile:v high -vf scale=960:540 out.mp4
output: https://workupload.com/file/eLQ6N68D
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '8m.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.35.101
Duration: 00:00:27.16, start: 0.000000, bitrate: 8090 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], 8089 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
handler_name : ?Mainconcept Video Media Handler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_amf))
Press [q] to stop, [?] for help
Output #0, mp4, to 'out.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.35.101
Stream #0:0(eng): Video: h264 (h264_amf) (avc1 / 0x31637661), nv12, 960x540 [SAR 1:1 DAR 16:9], q=-1--1, 3000 kb/s, 29.97 fps, 30k tbn, 29.97 tbc (default)
Metadata:
handler_name : ?Mainconcept Video Media Handler
encoder : Lavc58.65.100 h264_amf
frame= 814 fps=193 q=-0.0 Lsize= 10291kB time=00:00:27.12 bitrate=3107.7kbits/s speed=6.45x
video:10287kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.040603%
Тест 2. Codec: x264. Video: 1080p. CPU: 60fps / GPU: 119fps
Исходник: https://www.videvo.net/video/top-view-of-traffic-on-freeway/455564/
cpu encoding:
ffmpeg -i in.mp4 -y -b:v 3M -c:v libx264 -c:a libmp3lame -profile:v high -vf scale=1920:1080 out.mp4
frame= 1016 fps= 60 q=-1.0 Lsize= 16139kB time=00:00:42.40 bitrate=3117.5kbits/s speed=2.51x
gpu encoding: ffmpeg -hwaccel dxva2 -i in.mp4 -y -b:v 3M -c:v h264_amf -c:a libmp3lame -profile:v high -vf scale=1920:1080 out.mp4
output: https://workupload.com/file/EJLS9r3j
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'in.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
creation_time : 2018-11-22T18:17:07.000000Z
Duration: 00:00:42.41, start: 0.000000, bitrate: 29875 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 29576 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
Metadata:
creation_time : 2018-11-22T18:17:07.000000Z
handler_name : ?Mainconcept Video Media Handler
encoder : AVC Coding
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
Metadata:
creation_time : 2018-11-22T18:17:07.000000Z
handler_name : #Mainconcept MP4 Sound Media Handler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_amf))
Stream #0:1 -> #0:1 (aac (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Output #0, mp4, to 'out.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
encoder : Lavf58.35.101
Stream #0:0(eng): Video: h264 (h264_amf) (avc1 / 0x31637661), nv12, 1920x1080, q=-1--1, 3000 kb/s, 23.98 fps, 24k tbn, 23.98 tbc (default)
Metadata:
creation_time : 2018-11-22T18:17:07.000000Z
handler_name : ?Mainconcept Video Media Handler
encoder : Lavc58.65.100 h264_amf
Stream #0:1(eng): Audio: mp3 (libmp3lame) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp (default)
Metadata:
creation_time : 2018-11-22T18:17:07.000000Z
handler_name : #Mainconcept MP4 Sound Media Handler
encoder : Lavc58.65.100 libmp3lame
frame= 1016 fps=119 q=-0.0 Lsize= 16531kB time=00:00:42.40 bitrate=3193.3kbits/s speed=4.97x
video:15849kB audio:663kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.118027%
Тест 3. Codec: x265. Video: 4K. CPU: 45fps/ GPU: 52fps.
Исходник: https://www.videvo.net/video/flying-up-and-away-from-stadio-olimpico/456950/
cpu encoding:
ffmpeg -i in.mp4 -y -b:v 3M -c:v libx264 -c:a libmp3lame -vf scale=1920:1080 out.mp4
frame= 718 fps= 45 q=-1.0 Lsize= 10518kB time=00:00:29.82 bitrate=2889.3kbits/s speed=1.87x
gpu encoding: ffmpeg -hwaccel dxva2 -i in.mp4 -y -b:v 3M -c:v hevc_amf -c:a libmp3lame -vf scale=1920:1080 out.mp4
output: https://workupload.com/file/Kt58wMyA
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'in.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
creation_time : 2019-04-11T15:13:32.000000Z
Duration: 00:00:34.53, start: 0.000000, bitrate: 60521 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 3840x2160, 60516 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
Metadata:
creation_time : 2019-04-11T15:13:32.000000Z
handler_name : ?Mainconcept Video Media Handler
encoder : AVC Coding
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> hevc (hevc_amf))
Press [q] to stop, [?] for help
Output #0, mp4, to 'out.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
encoder : Lavf58.35.101
Stream #0:0(eng): Video: hevc (hevc_amf) (hev1 / 0x31766568), nv12, 1920x1080, q=2-31, 3000 kb/s, 23.98 fps, 24k tbn, 23.98 tbc (default)
Metadata:
creation_time : 2019-04-11T15:13:32.000000Z
handler_name : ?Mainconcept Video Media Handler
encoder : Lavc58.65.100 hevc_amf
frame= 828 fps= 52 q=-0.0 Lsize= 13459kB time=00:00:34.49 bitrate=3196.5kbits/s speed=2.17x
video:13455kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.032124%