H264_QSV可正常解码但VP9_QSV解码失败的Intel Quick Sync (QSV)技术问题求助
我使用支持Intel QSV的解码器、编码器和滤镜已经有一年了,H264格式基本都能正常工作,但像很多人反馈的那样,HEVC和VP9格式一直存在问题。最近我遇到的新问题是:想要解码VP9并编码为H264,却失败了。
Intel官方说明vp9_qsv同时支持解码和编码,我的FFmpeg版本也显示已支持该解码器:
查询H264_QSV解码器信息
I:\Downloads>ffmpeg -hide_banner -h decoder=h264_qsv Decoder h264_qsv [H264 video (Intel Quick Sync Video acceleration)]: General capabilities: dr1 delay avoidprobe hybrid Threading capabilities: none Supported hardware devices: qsv Supported pixel formats: nv12 p010le qsv h264_qsv AVOptions: -async_depth <int> .D.V....... Internal parallelization depth, the higher the value the higher the latency. (from 1 to INT_MAX) (default 4) -gpu_copy <int> .D.V....... A GPU-accelerated copy between video and system memory (from 0 to 2) (default default) default 0 .D.V....... on 1 .D.V....... off 2 .D.V.......
查询VP9_QSV解码器信息
I:\Downloads>ffmpeg -h decoder=vp9_qsv ffmpeg version 4.4-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers built with gcc 10.2.0 (Rev6, Built by MSYS2 project) configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 / 58.134.100 libavformat 58. 76.100 / 58. 76.100 libavdevice 58. 13.100 / 58. 13.100 libavfilter 7.110.100 / 7.110.100 libswscale 5. 9.100 / 5. 9.100 libswresample 3. 9.100 / 3. 9.100 libpostproc 55. 9.100 / 55. 9.100 Decoder vp9_qsv [VP9 video (Intel Quick Sync Video acceleration)]: General capabilities: dr1 delay avoidprobe hybrid Threading capabilities: none Supported hardware devices: qsv Supported pixel formats: nv12 p010le qsv vp9_qsv AVOptions: -async_depth <int> .D.V....... Internal parallelization depth, the higher the value the higher the latency. (from 1 to INT_MAX) (default 4) -gpu_copy <int> .D.V....... A GPU-accelerated copy between video and system memory (from 0 to 2) (default default) default 0 .D.V....... on 1 .D.V....... off 2 .D.V.......
H264输入文件测试(可正常运行)
当处理H264/AVC输入文件时,这条命令完全正常运行——FFmpeg日志显示QSV解码器和编码器都在工作,GPU-Z也显示GPU处于忙碌状态:
ffmpeg -y -hide_banner -err_detect aggressive -loglevel verbose -stats -benchmark ^ -init_hw_device qsv:hw,child_device_type=qsv -hwaccel qsv -hwaccel_output_format qsv ^ -vcodec h264_qsv -to 00:10:00.000 -i "h264_input_file.mkv" -strict normal ^ -c:a aac -q:a 0.9 ^ -vf "hwupload=extra_hw_frames=128,vpp_qsv=w=1696:h=954" ^ -c:v h264_qsv -preset veryslow -q:v 32 -movflags +faststart ^ "h264_output_file.mp4"
虽然偶尔QSV解码器会因为对输入格式过于挑剔而卡住,但这至少证明了QSV组件已正确安装并能正常工作——我可以用QSV完成解码、滤镜处理和编码的全流程。
VP9输入文件测试(报错)
但换成VP9输入文件时,使用几乎相同的命令却会出现大量错误:
VP9测试命令
ffmpeg -y -hide_banner -err_detect aggressive -loglevel verbose -stats -benchmark ^ -init_hw_device qsv:hw,child_device_type=qsv -hwaccel qsv -hwaccel_output_format qsv ^ -vcodec vp9_qsv -to 00:10:00.000 -i "vp9_input_file.mkv" -strict normal ^ -c:a aac -q:a 0.9 ^ -vf "hwupload=extra_hw_frames=128,vpp_qsv=w=1696:h=954" ^ -c:v h264_qsv -preset veryslow -q:v 32 -movflags +faststart ^ "h264_output_file.mp4"
错误输出
ffmpeg -y -hide_banner -err_detect aggressive -loglevel verbose -stats -benchmark -init_hw_device qsv:hw,child_device_type=qsv -hwaccel qsv -hwaccel_output_format qsv -vcodec vp9_qsv -to 00:10:00.000 -i "VIEW 360: Taking a FLIRT to the Workshop in Drammen part 2 of 2.mkv" -strict normal -c:a aac -q:a 0.9 -vf "hwupload=extra_hw_frames=128,vpp_qsv=w=1696:h=954" -c:v h264_qsv -preset veryslow -q:v 32 -movflags +faststart "VP9 test.mp4" Routing option err_detect to both codec and muxer layer Routing option strict to both codec and muxer layer [AVHWDeviceContext @ 00000000003e9500] Using D3D9Ex device. [AVHWDeviceContext @ 00000000003e9300] Initialize MFX session: API version is 1.34, implementation version is 1.11 Input #0, matroska,webm, from 'vp9_input_file.mkv': Metadata: ENCODER : Lavf58.76.100 Duration: 02:30:37.56, start: -0.007000, bitrate: 17668 kb/s Stream #0:0(eng): Video: vp9 (Profile 0), 1 reference frame, yuv420p(tv, bt709), 3840x2160, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc (default) Metadata: DURATION : 02:30:37.535000000 Side data: stereo3d: 2D Stream #0:1(eng): Audio: opus, 48000 Hz, stereo, fltp, delay 312 (default) Metadata: DURATION : 02:30:37.561000000 Stream mapping: Stream #0:0 -> #0:0 (vp9 (vp9_qsv) -> h264 (h264_qsv)) Stream #0:1 -> #0:1 (opus (native) -> aac (native)) Press [q] to stop, [?] for help [graph_1_in_0_1 @ 0000000000431b80] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3 [AVHWDeviceContext @ 0000000000413900] Using D3D9Ex device. [AVHWDeviceContext @ 0000000000413880] Initialize MFX session: API version is 1.34, implementation version is 1.11 [vp9_qsv @ 0000000002cbc780] Decoder: output is video memory surface [vp9_qsv @ 0000000002cbc780] Could not load the requested plugin 'a922394d8d87452f878c51f2fc9b4131': specified object was not found (-9) [vp9_qsv @ 0000000002cbc780] Error loading plugins [vp9_qsv @ 0000000002cbc780] Error initializing an MFX session [vp9_qsv @ 0000000002cbc780] Error initializing the MFX video decoder: invalid handle (-6) Error while decoding stream #0:0: Invalid argument [vp9_qsv @ 0000000002cbc780] Decoder: output is video memory surface [vp9_qsv @ 0000000002cbc780] Could not load the requested plugin 'a922394d8d87452f878c51f2fc9b4131': specified object was not found (-9) [vp9_qsv @ 0000000002cbc780] Error loading plugins [vp9_qsv @ 0000000002cbc780] Error initializing an MFX session [vp9_qsv @ 0000000002cbc780] Error initializing the MFX video decoder: invalid handle (-6) Error while decoding stream #0:0: Invalid argument [vp9_qsv @ 0000000002cbc780] Decoder: output is video memory surface
我已经安装了Intel最新的驱动程序,所有非QSV相关的FFmpeg命令都能正常工作,h264_qsv的解码和编码也完全没问题。我在两台Windows 7系统和一台Windows 10系统上都测试过,这些系统搭载不同的Intel处理器,但结果完全一致。
我在很多论坛上都看到过类似的问题,但从来没有找到明确的解决方案。
想请教大家:为什么FFmpeg无法“加载请求的插件”?是不是Intel的QSV软件存在未公开的问题?
或者我应该问一个更基础的问题:有没有人真的在Windows 7系统上成功使用过hevc_qsv或vp9_qsv进行解码或编码?我看到很多提问,但从来没见过有人贴出实际测试有效的示例,都是理论上“应该可行”的代码。我应该继续尝试解决这个问题,还是说Intel提供的软件本身就有问题,根本无法正常工作?
备注:内容来源于stack exchange,提问作者Bart Lederman

