Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Zhizhen_T_Intel
Employee
461 Views

how to run ffmpeg qsv decoder?

hi,

I downloaded ffmpeg-2.7 release. and found qsv h264 decoder on libavcodec. so I want to try it performance on ubuntu 12.04. I use as follows steps to build qsv decoder environment, then I run qsv h264 decoder to decode one h264 local stream, it failed.

Steps:

1. install mfx library

git clone https://git.videolan.org/?p=mfx_dispatch.git

cd mfx_dispatch-master

./configue --prefix=/usr

make

sudo make install

2. build ffmpeg-2.7 release

tar -xjf ffmpeg-2.7.tar.bz2

cd ffmpeg-2.7

./configure --enable-libmfx --enable-memalign-hack --extra-libs="-lsupc++ -lstdc++"

make

then I use blue_sky.h264 to test. run command "./ffmpeg -vcodec h264_qsv -i blue_sky.h264 1.yuv", the console reported as follows:

media@media-Z87X-UD5H:~/ffmpeg-2.7$ ./ffmpeg -vcodec h264_qsv -i /home/media/blue_sky_480p.h264 1.yuv
ffmpeg version 2.7 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-libmfx --enable-memalign-hack --extra-libs='-lsupc++ -lstdc++'
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
[h264_qsv @ 0x3209700] Packet header is not contained in global extradata, corrupted stream or invalid MP4/AVCC bitstream
Segmentation fault (core dumped)

I have some question, Does the qsv h264 decoder work well now? how to build h264 qsv decoder environment?

Thanks.

 

0 Kudos
4 Replies
Naoya_O_
Beginner
461 Views

Hi.

Does you install Intel Media SDK(MSDK) to your system?

Install MSDK to your system.

You does not have to install open-source mfx-dispatch.

mfx-dispatch is only dispatcher. Does not have MFX feature.

If you install MSDK, but configure script will not found libmfx.

Because configure script require pkg-config. But MSDK installer does not create pkg-config settings.

You need to create a configuration file in the hands of your own.

https://software.intel.com/en-us/forums/topic/560507

 

See below docs.

https://software.intel.com/sites/default/files/mediasdk-man.pdf

P25 - Working with VA API  Application -

ffmpeg does not use  MFXVideoCORE_SetHandle().

so, ffmpeg on linux cannot use MSDK.

I'm trying to use QSV on ffmpeg, VLC, HandBreak projects.

This is my test platform result.

$ uname -r
3.10.0-229.1.2.39163.MSSr4.el7.centos.x86_64

$ ./ffmpeg -i ~/101.mpg -vcodec h264_qsv -acodec none  test.mp4
ffmpeg version N-73245-gca3b274 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.8.3 (GCC) 20140911 (Red Hat 4.8.3-9)
  configuration: --prefix=/home/naoyan/ffmpeg-bin --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --enable-runtime-cpudetect --enable-libmfx
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 45.101 / 56. 45.101
  libavformat    56. 39.100 / 56. 39.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 19.100 /  5. 19.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
[mp2 @ 0x1391160] Header missing
[mpeg @ 0x13902c0] decoding for stream 0 failed
[mpeg @ 0x13902c0] Could not find codec parameters for stream 0 (Audio: mp2, 0 channels, s16p): unspecified frame size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpeg, from '/home/naoyan/101.mpg':
  Duration: 00:01:00.23, start: 0.500000, bitrate: 17234 kb/s
    Stream #0:0[0x1c0]: Audio: mp2, 0 channels, s16p
    Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], max. 24000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
File 'test.mp4' already exists. Overwrite ? [y/N] y
libva info: VA-API version 0.35.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'iHD'
libva info: Trying to open /opt/intel/mediasdk/lib64/iHD_drv_video.so
libva info: Found init function __vaDriverInit_0_32
libva info: va_openDriver() returns 0
Output #0, mp4, to 'test.mp4':
  Metadata:
    encoder         : Lavf56.39.100
    Stream #0:0: Video: h264 (h264_qsv) ([33][0][0][0] / 0x0021), nv12, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 1000 kb/s, 29.97 fps, 30k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc56.45.101 h264_qsv
Stream mapping:
  Stream #0:1 -> #0:0 (mpeg2video (native) -> h264 (h264_qsv))
Press to stop, [?] for help
[mpeg2video @ 0x14a2660] ac-tex damaged at 53 270:00:58.62 bitrate=4600.9kbits/s
[mpeg2video @ 0x14a2660] Warning MVs not available
[mpeg2video @ 0x14a2660] concealing 4919 DC, 4919 AC, 4919 MV errors in P frame
frame= 1783 fps=159 q=0.0 Lsize=   33014kB time=00:00:59.45 bitrate=4548.5kbits/s dup=2 drop=0
video:32997kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.051395%

Encoding H264 is working. But decoder is not working.

Thanks.

The_T_
Beginner
461 Views

Hi,

take a look at https://github.com/TheTroll/ffmpeg.

It calls MFXVideoCORE_SetHandle + it uses the decoder from drocon11

Naoya_O_
Beginner
461 Views

Hi,

I'm fix some issue. take a look at https://github.com/naoya-oyama/mfx_dispatch

If use this mfx_dispatch you don't have to call MFXVideoCORE_SetHandle()

 

 

The_T_
Beginner
461 Views

Hi,

does it fix the fact that the libmfx cannot be used in dynamic mode ?

I mean, I have to use libmfx.a statically linked with FFMPEG instead of libmfx.so.

 

Thanks

 

Reply