我购买了 Intel ARC A770,目的是在 Linux 下测试使用 AV1 和 HEVC 的硬件编码。由于对 ffmpeg 还不熟悉,我需要帮助构建 ffmpeg 语句,以便使用 ARC 卡为 HEVC 和 AV1 启用 Intel QSV 编码器。感谢您的时间和考虑。经过大量研究,这是我目前所弄清楚的。
操作系统以及库和 ffmpeg 都是在过去几周内从源代码编译的。
FFMpeg-编译时-libvpl
启用标志以接合oneVPL API堆栈。
软件 x265 编码工作正常。我成功运行了这个-
ffmpeg -y -v verbose -i "Input.mkv" -max_muxing_queue_size 1024 -filter_complex "[0:0]scale=1920:-2:flags=lanczos,setsar=1:1,zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=reinhard:desat=2,zscale=t=bt709:m=bt709:r=tv,format=yuv420p[v]" -map "[v]" -c:v libx265 -crf:v 18 -preset:v slow Output.mkv
HEVC_QSV 硬件编码有效,但我真的不确定这里使用的是哪种编码路径。尤其是必须使用硬件过滤器从系统内存复制到 GPU。我倾向于使用最新的 OneVPL API 路径来使用最新的工具集。我成功地用 hevc_qvc 编码器运行了这个-
ffmpeg -init_hw_device qsv=hw -filter_hw_device hw -v verbose -i Input.mkv -filter:v "scale=1920:-2,flags=lanczos,unsharp=5:5:.03:5:5:0.0" -c:v hevc_qsv -preset veryslow -extbrc 1 -look_ahead_depth 99 -b_strategy 1 -bf 7 -mbbrc 1 -rdo 1 -low_power 0 -adaptive_i 1 -adaptive_b 1 -async_depth 7 -b:v 25M -color_range tv -color_primaries:v bt709 -color_trc:v bt709 -colorspace:v bt709 Output.mkv
Video Card- ARC Sparkle A770
Linux Kernel- 6.6.10-1-default
LSCPU- Xeon- 2019 Xeon 12/24 cores including HT
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 46 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 24
On-line CPU(s) list: 0-23
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) Silver 4214 CPU @ 2.20GHz
CPU family: 6
Model: 85
Thread(s) per core: 2
Core(s) per socket: 12
Socket(s): 1
Stepping: 7
VAINFO-
trying display: wayland
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
Trying display: x11
error: can't connect to X server!
Trying display: drm
libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_20
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.20 (libva 2.20.1)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 23.4.3 ()
vainfo: Supported profile and entrypoints
VAProfileNone : VAEntrypointVideoProc
VAProfileNone : VAEntrypointStats
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSliceLP
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSliceLP
VAProfileJPEGBaseline : VAEntrypointVLD
VAProfileJPEGBaseline : VAEntrypointEncPicture
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
VAProfileHEVCMain : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointEncSliceLP
VAProfileHEVCMain10 : VAEntrypointVLD
VAProfileHEVCMain10 : VAEntrypointEncSliceLP
VAProfileVP9Profile0 : VAEntrypointVLD
VAProfileVP9Profile0 : VAEntrypointEncSliceLP
VAProfileVP9Profile1 : VAEntrypointVLD
VAProfileVP9Profile1 : VAEntrypointEncSliceLP
VAProfileVP9Profile2 : VAEntrypointVLD
VAProfileVP9Profile2 : VAEntrypointEncSliceLP
VAProfileVP9Profile3 : VAEntrypointVLD
VAProfileVP9Profile3 : VAEntrypointEncSliceLP
VAProfileHEVCMain12 : VAEntrypointVLD
VAProfileHEVCMain422_10 : VAEntrypointVLD
VAProfileHEVCMain422_10 : VAEntrypointEncSliceLP
VAProfileHEVCMain422_12 : VAEntrypointVLD
VAProfileHEVCMain444 : VAEntrypointVLD
VAProfileHEVCMain444 : VAEntrypointEncSliceLP
VAProfileHEVCMain444_10 : VAEntrypointVLD
VAProfileHEVCMain444_10 : VAEntrypointEncSliceLP
VAProfileHEVCMain444_12 : VAEntrypointVLD
VAProfileHEVCSccMain : VAEntrypointVLD
VAProfileHEVCSccMain : VAEntrypointEncSliceLP
VAProfileHEVCSccMain10 : VAEntrypointVLD
VAProfileHEVCSccMain10 : VAEntrypointEncSliceLP
VAProfileHEVCSccMain444 : VAEntrypointVLD
VAProfileHEVCSccMain444 : VAEntrypointEncSliceLP
VAProfileAV1Profile0 : VAEntrypointVLD
VAProfileAV1Profile0 : VAEntrypointEncSliceLP
VAProfileHEVCSccMain444_10 : VAEntrypointVLD
VAProfileHEVCSccMain444_10 : VAEntrypointEncSliceLP
FFMpeg version-
ffmpeg version N-113416-gcb6a488fba Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 13 (SUSE Linux)
configuration: --disable-debug --disable-doc --sws-max-filter-size=256 --host-os='SUSE Linux' --enable-gpl --enable-nonfree --enable-libzimg --enable-libplacebo --enable-libass --enable-ladspa --enable-libfdk-aac --enable-libvmaf --enable-libopus --enable-libbluray --enable-libsvtav1 --enable-librav1e --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvpl --enable-libopenjpeg --enable-vulkan --enable-opencl --enable-openssl --disable-nvdec --disable-nvenc --disable-vdpau
libavutil 58. 36.101 / 58. 36.101
libavcodec 60. 38.100 / 60. 38.100
libavformat 60. 20.100 / 60. 20.100
libavdevice 60. 4.100 / 60. 4.100
libavfilter 9. 17.100 / 9. 17.100
libswscale 7. 6.100 / 7. 6.100
libswresample 4. 13.100 / 4. 13.100
libpostproc 57. 4.100 / 57. 4.100
FFMPEG -hwaccels
Hardware acceleration methods:
vaapi
qsv
drm
opencl
vulkan
fmpeg -hide_banner -encoders|grep av1
V....D librav1e librav1e AV1 (codec av1)
V..... libsvtav1 SVT-AV1(Scalable Video Technology for AV1) encoder (codec av1)
V..... av1_qsv AV1 (Intel Quick Sync Video acceleration) (codec av1)
V....D av1_vaapi AV1 (VAAPI) (codec av1)
ffmpeg -hide_banner -decoders|grep av1
V....D av1 Alliance for Open Media AV1
V....D av1_qsv AV1 video (Intel Quick Sync Video acceleration) (codec av1)
ffmpeg -hide_banner -encoders|grep hevc
V....D libx265 libx265 H.265 / HEVC (codec hevc)
V..... hevc_qsv HEVC (Intel Quick Sync Video acceleration) (codec hevc)
V....D hevc_vaapi H.265/HEVC (VAAPI) (codec hevc)
ffmpeg -hide_banner -codecs|grep hevc
DEV.L. hevc H.265 / HEVC (High Efficiency Video Coding) (decoders: hevc hevc_qsv hevc_v4l2m2m) (encoders: libx265 hevc_qsv hevc_v4l2m2m
hevc_vaapi)
ffmpeg -hide_banner -codecs|grep av1
DEV.L. av1 Alliance for Open Media AV1 (decoders: av1 av1_qsv) (encoders: librav1e libsvtav1 av1_qsv av1_vaapi)
答案1
这组参数在 SUSE Linux 上使用英特尔 ARC 卡启用了从 h264 源到 h265 目标的完整 QSV 硬件转码管道。
fmpeg -y -v verbose -hwaccel qsv -hwaccel_output_format qsv -c:v h264_qsv -i input.mkv -vf "scale_qsv=w=1920:h=1080" -c:v h265_qsv -preset veryslow -global_quality 18 output.mkv