lisamelton / other_video_transcoding

Other tools to transcode videos.
MIT License
544 stars 25 forks source link

Can't get Intel Quick Sync to work on Windows #103

Closed weaverm closed 3 years ago

weaverm commented 3 years ago

I have installed Windows 10 Home 64-bit (version 20H2, OS build 19042.804) on my iMac via Boot Camp. This machine has a Core i5-7600K CPU and a Radeon Pro 580. I have statically linked ffmpeg 4.3.2-2021-02-27 (I've tried both the essentials and full release). When I try to do a --qsv or a --qsv --hevc I get an error.

[h264_qsv @ 000002ac1138b0c0] Error initializing an internal MFX session: unsupported (-3) [hevc_qsv @ 000002330a5ec380] Error initializing an internal MFX session: unsupported (-3)

If I do a --amf or --amf --hevc it works, but very slowly... 15 - 20 fps (with a 1080p blu-ray source mkv) and task manager says the CPU, GPU & disks are nearly idle.

I think I have this installed correctly and I think my Kaby Lake Intel CPU should do Quick Sync encoding. When running macOS 10.14.6 on this machine using Handbrake via Video Transcoding, Apple Video Toolbox does h.264 encodes using Quick Sync.

Surely I must have done something wrong?

I did find this issue: #16 with a similar error message, but on Ubuntu.

PS C:\transcode> ffmpeg.exe -version
ffmpeg version 4.3.2-2021-02-27-essentials_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-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --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-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
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
PS C:\transcode> other-transcode.bat --version
other-transcode 0.8.0
Copyright (c) 2019-2021 Don Melton
PS C:\transcode> other-transcode.bat --qsv 'F:\BlurayRips\TV\DoctorWho\Doctor Who s11e01 The Woman Who Fell to Earth.mkv'
Verifying "ffprobe" availability...
Verifying "ffmpeg" availability...
Verifying "mkvpropedit" availability...
Finding encoders...
Getting muxer capabilities...
Scanning media...
duration = 01:05:58.871
Stream mapping:
 0 = h264_qsv / 6000 Kbps
 1 = ac3 / 640 Kbps
Command line:
ffmpeg -loglevel error -stats -i "F:\BlurayRips\TV\DoctorWho\Doctor Who s11e01 The Woman Who Fell to Earth.mkv" -map 0:0 -c:v h264_qsv -b:v 6000k -look_ahead:v 1 -color_primaries:v bt709 -color_trc:v bt709 -colorspace:v bt709 -metadata:s:v title= -disposition:v default -map 0:1 -c:a:0 ac3 -b:a:0 640k -metadata:s:a:0 title= -disposition:a:0 default -sn -metadata:g title= -default_mode passthrough "Doctor Who s11e01 The Woman Who Fell to Earth.mkv"
Transcoding...
[h264_qsv @ 000001b65951a300] Error initializing an internal MFX session: unsupported (-3)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
C:/Ruby27-x64/bin/other-transcode: transcoding failed: Doctor Who s11e01 The Woman Who Fell to Earth.mkv
PS C:\transcode>
lisamelton commented 3 years ago

@weaverm You might need to add something like --qsv-device 1 to your command line. I've asked The HiveMind™ for other suggestions. Stay tuned...

weaverm commented 3 years ago

I tried --qsv-device 1 on the command line. No luck.

PS C:\transcode> other-transcode.bat --qsv --qsv-device 1 'F:\BlurayRips\TV\DoctorWho\Doctor Who s11e01 The Woman Who Fell to Earth.mkv'
Verifying "ffprobe" availability...
Verifying "ffmpeg" availability...
Verifying "mkvpropedit" availability...
Finding encoders...
Getting muxer capabilities...
Scanning media...
duration = 01:05:58.871
Stream mapping:
 0 = h264_qsv / 6000 Kbps
 1 = ac3 / 640 Kbps
Command line:
ffmpeg -loglevel error -stats -i "F:\BlurayRips\TV\DoctorWho\Doctor Who s11e01 The Woman Who Fell to Earth.mkv" -map 0:0 -c:v h264_qsv -b:v 6000k -look_ahead:v 1 -color_primaries:v bt709 -color_trc:v bt709 -colorspace:v bt709 -metadata:s:v title= -disposition:v default -map 0:1 -c:a:0 ac3 -b:a:0 640k -metadata:s:a:0 title= -disposition:a:0 default -sn -metadata:g title= -default_mode passthrough "Doctor Who s11e01 The Woman Who Fell to Earth.mkv"
Transcoding...
[h264_qsv @ 0000025c24a4d540] Error initializing an internal MFX session: unsupported (-3)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
C:/Ruby27-x64/bin/other-transcode: transcoding failed: Doctor Who s11e01 The Woman Who Fell to Earth.mkv
lisamelton commented 3 years ago

@weaverm Hmmmm, I'm starting to wonder if you have the correct drivers installed.

weaverm commented 3 years ago

I tried a different build of ffmpeg, but got the same failure. (from here: https://github.com/BtbN/FFmpeg-Builds/releases)

PS C:\transcode> ffmpeg.exe -version
ffmpeg version n4.3.2-160-gfbb9368226 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 9.3-win32 (GCC) 20200320
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 --disable-w32threads --enable-pthreads --enable-iconv --enable-zlib --enable-libxml2 --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-opencl --enable-libvmaf --disable-vulkan --enable-libvorbis --enable-amf --enable-libaom --enable-avisynth --enable-libdav1d --enable-libdavs2 --enable-ffnvcodec --enable-cuda-llvm --disable-libglslang --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --disable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libtwolame --enable-libvidstab --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-libs=-lgomp
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
weaverm commented 3 years ago

I wonder about drivers too. What drivers are we even talking about? I created this Boot Camp partition two days ago. I downloaded a Windows 10 Home retail ISO from Microsoft on the same day. MacOS created the partition and kicked off the Windows install from the downloaded ISO. Other than installing Steam, FireFox and Windows Updates, I haven't installed anything.

weaverm commented 3 years ago

There are no red Xs or exclamation marks in Device Manager that would indicate some piece of hardware isn't right.

lisamelton commented 3 years ago

@weaverm If you installed with an official retail version of Windows 10 Home then you probably have the drivers you need. So I have no idea what could be wrong at this point.

samhutchins commented 3 years ago

On my macbook pro, at least, bootcamp turns off the Intel GPU, and only exposes the AMD one. I would imagine it's the same on an iMac

lisamelton commented 3 years ago

@samhutchins Thanks for the information! That explains a LOT. It seems the QSV encoder is not accessible under Boot Camp. Sorry about that, @weaverm.

weaverm commented 3 years ago

I bet you're right. I don't recall seeing an Intel GPU in Device Manager, only the AMD one. Thanks for your help!