Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 590752 - media-video/ffmpeg absence of flags of intel qsv which are responsible for support
Summary: media-video/ffmpeg absence of flags of intel qsv which are responsible for su...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal minor with 4 votes (vote)
Assignee: media-video herd
Keywords: PullRequest
Depends on: 778875
  Show dependency tree
Reported: 2016-08-08 10:55 UTC by andrey
Modified: 2021-11-29 15:14 UTC (History)
9 users (show)

See Also:
Package list:
Runtime testing required: ---

mfx-dispatch-1.21.ebuild (mfx-dispatch-1.21.ebuild,901 bytes, text/plain)
2017-03-27 20:18 UTC, Wojciech Myrda
ffmpeg-3.2.4.ebuild (ffmpeg-3.2.4.ebuild,14.71 KB, text/plain)
2017-03-27 20:54 UTC, Wojciech Myrda
ffmpeg-3.3.2.ebuild (ffmpeg-3.3.2.ebuild,15.01 KB, text/plain)
2017-07-03 10:42 UTC, Wojciech Myrda
mfx-dispatch-9999.ebuild (mfx-dispatch-9999.ebuild,826 bytes, text/plain)
2018-08-05 08:22 UTC, Wojciech Myrda
media-video/ffmpeg (ffmpeg-4.2.2.ebuild,17.58 KB, text/plain)
2020-01-25 08:53 UTC, Reva Denis
x11-libs/libva-intel-media-driver (libva-intel-media-driver-19.4.0-r2.ebuild,1001 bytes, text/plain)
2020-01-25 08:54 UTC, Reva Denis
media-libs/intel-mediasdk (intel-mediasdk-19.4.0.ebuild,1.24 KB, text/plain)
2020-01-25 08:55 UTC, Reva Denis
media-libs/gmmlib (gmmlib-19.4.1.ebuild,832 bytes, text/plain)
2020-01-25 08:56 UTC, Reva Denis
media-video/libva-utils (libva-utils-2.6.0.ebuild,1.24 KB, text/plain)
2020-01-25 08:58 UTC, Reva Denis
difference between my and standart (diff.txt,769 bytes, text/plain)
2020-02-03 09:57 UTC, Reva Denis

Note You need to log in before you can comment on or make changes to this bug.
Description andrey 2016-08-08 10:55:10 UTC
lack of the flags answering for --enable-libmfx --enable-memalign-hack
Also there is no library for satisfaction of dependences of this (mfx library
Comment 1 Anton 2016-12-03 18:34:51 UTC
Intel Quick Sync Video is available since 2011, it's time to support it in Gentoo
Comment 2 John5788 2017-02-02 22:07:28 UTC
I believe we also would need to have Intel Media Server Studio in portage as a dependency for --enable-libmfx
Comment 3 Luigi 'Comio' Mantellini 2017-02-22 11:52:35 UTC
QSV support is a true nightmare:

- Requires outdated and heavy patched libraries.
- Requires outdated kernel in order to apply all required patches.

(lu_zero is also the mfx_dispacth's mantainer

Intel doesn't provide any kind of support on mediasdk community support.

VA-API works fine and offers the same performance level.


Comment 4 Wojciech Myrda 2017-03-27 05:14:00 UTC
(In reply to Luigi 'Comio' Mantellini from comment #3)
> QSV support is a true nightmare:

Perhaps for the full support of the tools one needs Intel Media Server Studio, but for ffmpeg it says otherwise. "FFmpeg QSV support relies on libmfx" and then "Requriments on Linux: ... or use a recent enough supported system, with the libva and libdrm libraries, the libva Intel drivers, and the libmfx library packaged by lu_zero."

see here:

Therefore adding it to Gentoo should be as easy as adding libmfx library and --enable-libmfx flag to ffmpeg.
Comment 5 Wojciech Myrda 2017-03-27 20:18:23 UTC
Created attachment 468486 [details]

With this ebuild QSV library downloaded and built successfully for me.
Comment 6 Wojciech Myrda 2017-03-27 20:54:39 UTC
Created attachment 468490 [details]

With simple addition of below

--- /usr/portage/media-video/ffmpeg/ffmpeg-3.2.4.ebuild	2017-03-20 21:24:35.000000000 +0100
+++ /usr/local/portage/media-video/ffmpeg/ffmpeg-3.2.4.ebuild	2017-03-27 22:39:35.559946221 +0200
@@ -91,7 +91,7 @@
 	amrenc:libvo-amrwbenc mp3:libmp3lame
 	kvazaar:libkvazaar nvenc:nvenc
-	openh264:libopenh264 snappy:libsnappy theora:libtheora twolame:libtwolame
+	openh264:libopenh264 snappy:libsnappy qsv:libmfx theora:libtheora twolame:libtwolame
 	wavpack:libwavpack webp:libwebp x264:libx264 x265:libx265 xvid:libxvid
@@ -169,6 +169,7 @@
 		nvenc? ( media-video/nvidia_video_sdk )
 		openh264? ( >=media-libs/openh264-1.4.0-r1[${MULTILIB_USEDEP}] )
 		snappy? ( >=app-arch/snappy-1.1.2-r1[${MULTILIB_USEDEP}] )
+		qsv? ( >=media-libs/mfx-dispatch-1.19[${MULTILIB_USEDEP}] )
 		theora? (

I got ffmpeg compiled with Intel Quick Sync Video. I used QSV as use flag as it seemed more appropriate than less understandable MFX.

BTW I was unable to find licence specific for Intel and BSD3 therefore added new one under name BSD-3-Intel in the mfx-dispatch ebuild taken from
Comment 7 Wojciech Myrda 2017-04-18 05:09:48 UTC
Any particular reason why QSV has not been added to portage for new ffmpeg-3.3? You guys know it is mainly used for fast encoding not decoding right?
Comment 8 Wojciech Myrda 2017-07-03 10:42:09 UTC
Created attachment 480106 [details]

Not only QSV flag is not added but also there is no nvidia flag for ffmpeg. This results in cuvid being installed on PCs with Intel only platforms!

Results of USE="-nvidia qsv" emerge ffmpeg 
(unfixed ebuild)

Enabled hwaccels:
h263_vaapi              mpeg1_cuvid             vc1_cuvid
h264_cuvid              mpeg1_vdpau             vc1_vaapi
h264_vaapi              mpeg2_cuvid             vc1_vdpau
h264_vdpau              mpeg2_vaapi             vp8_cuvid
hevc_cuvid              mpeg2_vdpau             vp9_cuvid
hevc_vaapi              mpeg4_cuvid             vp9_vaapi
hevc_vdpau              mpeg4_vaapi             wmv3_vaapi
mjpeg_cuvid             mpeg4_vdpau             wmv3_vdpau

Results of USE="-nvidia qsv" emerge ffmpeg 
(fixed ebuild )

Enabled hwaccels:
h263_vaapi		mpeg1_vdpau		vc1_vaapi
h264_qsv		mpeg2_qsv		vc1_vdpau
h264_vaapi		mpeg2_vaapi		vp8_qsv
h264_vdpau		mpeg2_vdpau		vp9_vaapi
hevc_qsv		mpeg4_vaapi		wmv3_vaapi
hevc_vaapi		mpeg4_vdpau		wmv3_vdpau
hevc_vdpau		vc1_qsv

Please fix it!
Comment 9 Rajil Saraswat 2018-02-16 04:31:20 UTC
Unfortunately, it failed for me. Full report is at

$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
Comment 10 Wojciech Myrda 2018-08-05 08:22:13 UTC
Created attachment 542452 [details]

(In reply to Rajil Saraswat from comment #9)
> Unfortunately, it failed for me. Full report is at
I actually tried to encode using quick sync, but I failed with the same error You have (more in the forum). I also failed with git version which also add several new Intel platforms (see new attachment), but  maybe you or others will have more luck.

I think bunder in the forum was right and it all comes down to whether all firmware on your platform works properly or not.
Make use to check module options for your kernel version as their names change. In 4.17 it is "i915.enable_guc=2". You may also try "i915.enable_guc=-1" but it almost hanged my desktop, YMMV.
Comment 11 georgia_tech_swagger 2019-12-28 16:47:21 UTC
Bumping.   There's no good reason not to have the MFX ebuild and ffmpeg with +QSV USE flags in the tree.   Intel-MediaSDK is already in the tree.
Comment 13 Reva Denis 2020-01-12 17:37:29 UTC
depends on
Comment 14 Reva Denis 2020-01-14 06:44:29 UTC
Comment 15 Reva Denis 2020-01-16 06:36:34 UTC
I has got first working version of ported. I'll pulling its when I test ones
Comment 16 Reva Denis 2020-01-25 08:53:20 UTC
Created attachment 604224 [details]

With qsv on x86_64
Comment 17 Reva Denis 2020-01-25 08:54:29 UTC
Created attachment 604226 [details]
Comment 18 Reva Denis 2020-01-25 08:55:34 UTC
Created attachment 604228 [details]

Comment 19 Reva Denis 2020-01-25 08:56:28 UTC
Created attachment 604230 [details]

Deps to mediasdk
Comment 20 Reva Denis 2020-01-25 08:58:22 UTC
Created attachment 604232 [details]
Comment 21 Reva Denis 2020-01-25 08:58:44 UTC
(In reply to Reva Denis from comment #20)
> Created attachment 604232 [details]
> media-video/libva-utils

Comment 22 Reva Denis 2020-02-03 09:57:57 UTC
Created attachment 611178 [details]
difference between my and standart
Comment 23 Reva Denis 2021-11-29 07:38:06 UTC
It the anyone interested in?
Comment 24 Leho Kraav (:macmaN @lkraav) 2021-11-29 14:29:10 UTC
(In reply to Reva Denis from comment #23)
> It the anyone interested in?

I am. Currently successfully running a locally patched USE +qsv ebuild on my laptop, works great.
Comment 25 Reva Denis 2021-11-29 15:14:20 UTC
Leho Kraav, I've lost access to Intel GPU, so I'm not sure I can help. I also no more interesting in. Feel free to modify my contributions.