View previous topic :: View next topic |
Author |
Message |
trumee Guru
Joined: 02 Mar 2003 Posts: 551 Location: London,UK
|
Posted: Fri Feb 16, 2018 4:28 am Post subject: Intel quicksync video and ffmpeg |
|
|
I am trying to use quick sync video encoding with ffmpeg.
It fails like so
Code: |
$ffmpeg -hwaccel qsv -hwaccel_device qsv -i his_girl_friday.mpeg -c:v h264_qsv qsv.mkv
ffmpeg version 3.3.6 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.4.0 (Gentoo 6.4.0-r1 p1.3)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --docdir=/usr/share/doc/ffmpeg-3.3.6/html --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-O2 -pipe -march=native' --disable-static --enable-avfilter --enable-avresample --disable-stripping --disable-indev=oss --disable-indev=jack --disable-outdev=oss --enable-nonfree --enable-bzlib --disable-runtime-cpudetect --disable-debug --disable-gcrypt --disable-gnutls --disable-gmp --enable-gpl --enable-hardcoded-tables --enable-iconv --disable-lzma --enable-network --disable-cuda --disable-cuvid --disable-openssl --enable-postproc --disable-libsmbclient --enable-ffplay --enable-sdl2 --enable-vaapi --enable-vdpau --enable-xlib --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --enable-zlib --disable-libcdio --disable-libiec61883 --disable-libdc1394 --disable-libcaca --disable-openal --enable-opengl --enable-libv4l2 --disable-libpulse --disable-libopencore-amrwb --disable-libopencore-amrnb --enable-libfdk-aac --disable-libopenjpeg --disable-libbluray --disable-libcelt --disable-libgme --disable-libgsm --disable-mmal --disable-libmodplug --disable-libopus --disable-libilbc --disable-librtmp --disable-libssh --disable-libschroedinger --enable-libspeex --enable-libvorbis --enable-libvpx --disable-libzvbi --disable-libbs2b --disable-chromaprint --disable-libflite --disable-frei0r --disable-libfribidi --disable-fontconfig --disable-ladspa --disable-libass --enable-libfreetype --disable-librubberband --disable-netcdf --disable-libzmq --disable-libzimg --disable-libsoxr --enable-pthreads --disable-libvo-amrwbenc --enable-libmp3lame --disable-libkvazaar --disable-nvenc --disable-libopenh264 --disable-libsnappy --enable-libmfx --enable-libtheora --disable-libtwolame --disable-libwavpack --disable-libwebp --enable-libx264 --disable-libx265 --disable-libxvid --disable-amd3dnow --disable-amd3dnowext --disable-fma4 --disable-xop --cpu=host --disable-doc --disable-htmlpages --enable-manpages
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
Input #0, mpeg, from 'his_girl_friday.mpeg':
Duration: 01:31:44.17, start: 0.223733, bitrate: 4784 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, top first), 720x480 [SAR 8:9 DAR 4:3], 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
Stream #0:2[0x1bf]: Data: dvd_nav_packet
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (h264_qsv))
Stream #0:1 -> #0:1 (ac3 (native) -> vorbis (libvorbis))
Press [q] to stop, [?] for help
[h264_qsv @ 0x5585128f7fc0] 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
Conversion failed!
|
ffmpeg has qsv built in
Code: |
$ffmpeg -hwaccels
Hardware acceleration methods:
vdpau
qsv
vaapi
$ffmpeg -encoders|grep qsv
V..... h264_qsv H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (Intel Quick Sync Video acceleration) (codec h264)
V..... hevc_qsv HEVC (Intel Quick Sync Video acceleration) (codec hevc)
V..... mpeg2_qsv MPEG-2 video (Intel Quick Sync Video acceleration) (codec mpeg2video)
|
I applied the following patch to build ffmpeg with qsv support,
Code: |
$ diff /usr/local/portage/media-video/ffmpeg/ffmpeg-3.3.6.ebuild /usr/portage/media-video/ffmpeg/ffmpeg-3.3.6.ebuild
66c66
< +gpl +hardcoded-tables +iconv lzma +network nvidia:cuda nvidia:cuvid openssl +postproc
---
> +gpl +hardcoded-tables +iconv lzma +network openssl +postproc
94c94
< openh264:libopenh264 snappy:libsnappy qsv:libmfx theora:libtheora twolame:libtwolame
---
> openh264:libopenh264 snappy:libsnappy theora:libtheora twolame:libtwolame
188d187
< qsv? ( >=media-libs/mfx-dispatch-1.19[${MULTILIB_USEDEP}] )
|
The mfx-dispatch ebuild was from this bug report.
Code: |
$ vainfo
error: can't connect to X server!
libva info: VA-API version 0.39.4
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/va/drivers/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.39 (libva 1.7.3)
vainfo: Driver version: Intel i965 driver for Intel(R) Kabylake - 1.7.3
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Simple : VAEntrypointEncSlice
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointEncSlice
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSlice
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSlice
VAProfileH264MultiviewHigh : VAEntrypointVLD
VAProfileH264MultiviewHigh : VAEntrypointEncSlice
VAProfileH264StereoHigh : VAEntrypointVLD
VAProfileH264StereoHigh : VAEntrypointEncSlice
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
VAProfileNone : VAEntrypointVideoProc
VAProfileJPEGBaseline : VAEntrypointVLD
VAProfileJPEGBaseline : VAEntrypointEncPicture
VAProfileVP8Version0_3 : VAEntrypointVLD
VAProfileVP8Version0_3 : VAEntrypointEncSlice
VAProfileHEVCMain : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointEncSlice
VAProfileHEVCMain10 : VAEntrypointVLD
VAProfileHEVCMain10 : VAEntrypointEncSlice
VAProfileVP9Profile0 : VAEntrypointVLD
VAProfileVP9Profile0 : VAEntrypointEncSlice
VAProfileVP9Profile2 : VAEntrypointVLD
# lspci|grep VGA
00:02.0 VGA compatible controller: Intel Corporation Device 591d (rev 04)
|
Is there any way to make this work? |
|
Back to top |
|
|
bunder Bodhisattva
Joined: 10 Apr 2004 Posts: 5933
|
Posted: Mon Feb 19, 2018 4:35 am Post subject: |
|
|
i had problems getting quick sync to work in obs...
i think the problem boils down to firmware. intel's firmware ships 3 components, DMC, GUC and HUC. afaik linux only supports loading the DMC at the moment. |
|
Back to top |
|
|
ryszardzonk Apprentice
Joined: 18 Dec 2003 Posts: 225 Location: Rzeszów, POLAND
|
Posted: Sat Aug 04, 2018 1:01 pm Post subject: |
|
|
I tried to get it to work and problem lies somewhere else than in firmware as I did get HuC loaded on Skylake
Code: | [ 0.000000] Kernel command line: BOOT_IMAGE=/vmlinuz-4.17.12 root=/dev/sdb2 ro rootfstype=ext4 pcie_aspm=force acpi_enforce_resources=lax nopti nospectre_v2 intel_iommu=on nospec_store_bypass_disable i915.enable_dc=6 i915.enable_fbc=1 intel_pstate=skylake_hwp i915.enable_guc=2
[ 0.069156] smpboot: Max logical packages: 1
[ 3.114089] i915 0000:00:02.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=io+mem:owns=io+mem
[ 3.114127] i915 0000:00:02.0: Failed to load DMC firmware i915/skl_dmc_ver1_27.bin. Disabling runtime power management.
[ 3.114127] i915 0000:00:02.0: DMC firmware homepage: https://01.org/linuxgraphics/downloads/firmware
[ 3.124540] [drm] HuC: Loaded firmware i915/skl_huc_ver01_07_1398.bin (version 1.7)
[ 3.135024] [drm] GuC: Loaded firmware i915/skl_guc_ver9_33.bin (version 9.33)
[ 3.146012] i915 0000:00:02.0: GuC firmware version 9.33
[ 3.146013] i915 0000:00:02.0: GuC submission disabled
[ 3.146014] i915 0000:00:02.0: HuC enabled
[ 3.146709] [drm] Initialized i915 1.6.0 20180308 for 0000:00:02.0 on minor 0
[ 3.290459] i915 0000:00:02.0: fb0: inteldrmfb frame buffer device |
i915.enable_guc=2 was required to load video encoding part, as i915.enable_guc=-1 to load both GuC & HuC resulted in number of gpu hangs and unusable desktop
Anyways with of without those firmware loaded I got the same error trying to encode video even with the use of updated mfx library https://github.com/lu-zero/mfx_dispatch/releases/tag/1.23 and ffmpeg 4.0.2
I will try my chances with git as API is updated there over release https://github.com/lu-zero/mfx_dispatch/commit/613c5c7aadf09b590ec135302bf8974a3eccb880 Hopefully that helps
EDIT: After more searching I found this https://lists.freedesktop.org/archives/intel-gfx/2016-January/084897.html which if I understand it right means that one needs both GuC & HuC working "The HuC authentication is done by host2guc call. The HuC RSA keys
are sent to GuC for authentication." _________________ Sky is not the limit... |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|