0

I'm trying to use ffmpeg to encode VP9 using vp9_qsv on windows 10. My CPU supports QuickSync (i7 11700k). I am aware of the multi monitor issue of vp9_qsv and found a way to work around the [vp9_qsv] Selected ratecontrol mode is unsupported error by setting bitrate and maxrate.

I'm using this commandline: fmpeg.exe -i input.mp4 -b:v 10M -maxrate:v 10M -c:v vp9_qsv -c:a copy output.mp4

I get the following error:

ffmpeg version n4.4-80-g262a744a0a-20210720 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10-win32 (GCC) 20210408
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --enable-shared --disable-static --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libvmaf --enable-vulkan --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-libglslang --enable-libgme --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20210720
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2021-07-01T10:28:31.000000Z
    encoder         : HandBrake 1.0.7 2017040900
  Duration: 00:01:21.02, start: 0.000000, bitrate: 30597 kb/s
  Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 30430 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2021-07-01T10:28:31.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)
    Metadata:
      creation_time   : 2021-07-01T10:28:31.000000Z
      handler_name    : Stereo
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> vp9 (vp9_qsv))
  Stream #0:1 -> #0:1 (copy)
[vp9_qsv @ 000001fdf9f7dcc0] Error during encoding: NULL pointer (-2)

If i swap vp9_qsv with h264_qsv or hevc_qsv encoding works fine.

Its a self-built ffmpeg from latest 4.4, the same happens with latest master.

kiw
  • 173
  • 1
  • 6
  • @llogan added more info – kiw Jul 20 '21 at 16:57
  • Does it happen with one of [Gyan's](https://www.gyan.dev/ffmpeg/builds/) or [BtbN's](https://github.com/BtbN/FFmpeg-Builds) builds? (I'm assuming they support vp9_qsv). – llogan Jul 20 '21 at 21:34
  • Its a BtbN build, but also happens with both those ready-made builds. – kiw Jul 21 '21 at 08:33

1 Answers1

0

Same problem here, I fixed it by adding some options on the start and a filter to the command Following your command:

fmpeg.exe -i input.mp4 -b:v 10M -maxrate:v 10M -c:v vp9_qsv -c:a copy output.mp4

I added -init_hw_device qsv=hw -filter_hw_device hw before the input file and I added the filter -vf hwupload=extra_hw_frames=64,format=qsv:

fmpeg.exe -init_hw_device qsv=hw -filter_hw_device hw -i input.mp4 -b:v 10M -maxrate:v 10M -c:v vp9_qsv -c:a copy -vf hwupload=extra_hw_frames=64,format=qsv output.webm

According to the QSV trac ffmpeg page, those options are used when initializing a filter to use with QSV encoders, I kind of thought that might be the solution and it was. I also noticed you used mp4 when using a VP-X codec, I'm pretty sure mp4 cannot contain VP-X codecs.

I notced on my test file that the audio isn't working, I'll figure something out.