Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.
3075 Discussions

does Intel can add the QSV Hardware Accelerated Decode on ffmpeg ?

bordon_l_
Beginner
931 Views

Hello, we are testing the hardware acceleration decoding function on ffmpeg, but we didn't find the acceleration effect.

Our test environment is as follows:
ffmpeg version: the offical 64-bit static for windows
https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20160718-a49ed9e-win64-static.zip

OS: Win2008 x64
CPU: Intel i7 4770K with iGPU driver
GPU: Nvidia Geforce GTX 750 Ti with 368.81 driver

Hardware accelerated decoding command:
ffmpeg.exe -hwaccel qsv  -threads 4 -i G:\video\H264.mkv  -f null - -benchmark

[the command line result]
D:\ffmpeg\ffmpeg-20160726-54a0a52-win64-static\bin>ffmpeg.exe -hwaccel qsv  -threads 4 -i G:\video\H264.mkv  -f null - -benchmark
ffmpeg version N-81128-g54a0a52 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --
enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libc
aca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-
libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspee
x --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-l
ibwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 50.100 / 57. 50.100
  libavformat    57. 44.100 / 57. 44.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 49.100 /  6. 49.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, matroska,webm, from 'G:\video\H264.mkv':
  Metadata:
    encoder         : libebml v0.7.9 + libmatroska v0.8.1
    creation_time   : 2010-03-05 05:04:55
  Duration: 00:03:33.88, start: 0.000000, bitrate: 101250 kb/s
    Stream #0:0: Video: h264 (High), yuv420p, 3840x2160 [SAR 1:1 DAR 16:9], 119.88 fps, 119.88 tbr, 1k tbn, 239.76 tbc (default)
    Stream #0:1: Audio: dts (DTS-ES), 48000 Hz, 6.1, fltp, 768 kb/s (default)
[null @ 000000000062ef00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf57.44.100
    Stream #0:0: Video: wrapped_avframe, yuv420p, 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 119.88 fps, 119.88 tbn, 119.88 tbc (default)
    Metadata:
      encoder         : Lavc57.50.100 wrapped_avframe
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, 6.1, s16, 5376 kb/s (default)
    Metadata:
      encoder         : Lavc57.50.100 pcm_s16le
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native))
  Stream #0:1 -> #0:1 (dts (dca) -> pcm_s16le (native))
Press to stop, [?] for help
frame=  579 fps= 81 q=-0.0 Lsize=N/A time=00:00:04.93 bitrate=N/A speed=0.689x

After the test, I carefully checked the source code of the ffmpeg that QSV decoding, found that it hasn't yet fully realize QSV hardware decoding, such as 'qsvdec_mpeg2.c' in ffmpeg:

static av_cold int qsv_decode_close(AVCodecContext *avctx)
{
    QSVMPEG2Context *s = avctx->priv_data;

    ff_qsv_decode_close(&s->qsv);

    return 0;
}

static av_cold int qsv_decode_init(AVCodecContext *avctx)
{
    return 0;
}

I think the fastest way is that Intel can help to add the function on ffmpeg, Please give me a reply as soon as possible, Thanks.

0 Kudos
2 Replies
Jeffrey_M_Intel1
Employee
931 Views

The code already exists for many general FFmpeg qsv uses with the mpeg2, h264, and h265 codecs.   You can check qsv_decode_init in qsvdec.c for a more complete decode initialization.

However, it is still in active development and, like any project, may have regressions as new code is committed.

While the Media SDK interface is used underneath the *_qsv codec implementations in FFmpeg, FFmpeg is out of the scope of this forum.  Please send FFmpeg questions and issues to the FFmpeg mailing lists.  https://ffmpeg.org/contact.html

 

 

 

0 Kudos
Liu__Chao
Beginner
931 Views

Hi,

Have you tried a command like the following?

ffmpeg -c:v h264_qsv -i XXX

0 Kudos
Reply