[FFmpeg-devel] Intel QuickSync Video

Sven Dueking sven at nablet.com
Mon Nov 9 15:28:51 CET 2015



> -----Ursprüngliche Nachricht-----
> Von: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] Im Auftrag
> von Sevan Gelici
> Gesendet: Freitag, 6. November 2015 20:35
> An: FFmpeg development discussions and patches
> Betreff: Re: [FFmpeg-devel] Intel QuickSync Video
> 
> @Will Kelleher
> CPU:
> http://ark.intel.com/products/75122/Intel-Core-i7-4770-Processor-8M-
> Cache-up-to-3_90-GHz
> MediaSDK: Intel-linux-media-ocl_generic_16.4.2.1-39163_64bit.tar.gz
> (inside package of mediaserverstudioessentials2015r6.tar.gz)
> Ubuntu 14.04.3 LTS, Codename:       trusty
> 
> 
> 
> @Sven Dueking
> file to file also not working, I made a debug log
> 
> 
> Splitting the commandline.
> Reading option '-y' ... matched as option 'y' (overwrite output files)
> with argument '1'.
> Reading option '-fflags' ... matched as AVOption 'fflags' with argument
> '+genpts'.
> Reading option '-loglevel' ... matched as option 'loglevel' (set
> logging
> level) with argument 'debug'.
> Reading option '-probesize' ... matched as AVOption 'probesize' with
> argument '10000000'.
> Reading option '-analyzeduration' ... matched as AVOption
> 'analyzeduration'
> with argument '15000000'.
> Reading option '-i' ... matched as input file with argument
> 'm84_2.mpg'.
> Reading option '-strict' ...Routing option strict to both codec and
> muxer layer  matched as AVOption 'strict' with argument '-2'.
> Reading option '-dn' ... matched as option 'dn' (disable data) with
> argument '1'.
> Reading option '-vcodec' ... matched as option 'vcodec' (force video
> codec ('copy' to copy stream)) with argument 'h264_qsv'.
> Reading option '-preset' ... matched as AVOption 'preset' with argument
> 'veryfast'.
> Reading option '-profile:v' ... matched as option 'profile' (set
> profile) with argument 'baseline'.
> Reading option '-level' ... matched as AVOption 'level' with argument
> '3.0'.
> Reading option '-acodec' ... matched as option 'acodec' (force audio
> codec ('copy' to copy stream)) with argument 'aac'.
> Reading option '-b:v' ... matched as option 'b' (video bitrate (please
> use
> -b:v)) with argument '1000k'.
> Reading option '-r' ... matched as option 'r' (set frame rate (Hz
> value, fraction or abbreviation)) with argument '25'.
> Reading option '-b:a' ... matched as option 'b' (video bitrate (please
> use
> -b:v)) with argument '128k'.
> Reading option '-minrate' ... matched as AVOption 'minrate' with
> argument '200k'.
> Reading option '-maxrate' ... matched as AVOption 'maxrate' with
> argument '1200k'.
> Reading option '-bufsize' ... matched as AVOption 'bufsize' with
> argument '1200k'.
> Reading option '-vf' ... matched as option 'vf' (set video filters)
> with argument 'scale=720:576'.
> Reading option '-aspect' ... matched as option 'aspect' (set aspect
> ratio (4:3, 16:9 or 1.3333, 1.7777)) with argument '16:9'.
> Reading option '-ar' ... matched as option 'ar' (set audio sampling
> rate (in Hz)) with argument '48000'.
> Reading option '-ac' ... matched as option 'ac' (set number of audio
> channels) with argument '2'.
> Reading option '-f' ... matched as option 'f' (force format) with
> argument 'mpegts'.
> Reading option 'bla.ts' ... matched as output file.
> Finished splitting the commandline.
> Parsing a group of options: global .
> Applying option y (overwrite output files) with argument 1.
> Applying option loglevel (set logging level) with argument debug.
> Successfully parsed a group of options.
> Parsing a group of options: input file m84_2.mpg.
> Successfully parsed a group of options.
> Opening an input file: m84_2.mpg.
> [mpeg @ 0x311aa40] Format mpeg probed with size=2048 and score=26 [mpeg
> @ 0x311aa40] Before avformat_find_stream_info() pos: 0 bytes
> read:32768 seeks:0
> [mpeg @ 0x311aa40] probing stream 0 pp:2500 [mpeg @ 0x311aa40] Probe
> with size=2012, packets=1 detected mpegvideo with
> score=25
> [mpeg @ 0x311aa40] probed stream 0
> [mpeg @ 0x311aa40] Probe buffer size limit of 10000000 bytes reached
> [mpeg @ 0x311aa40] rfps: 30.000000 0.013228 [mpeg @ 0x311aa40] rfps:
> 29.970030 0.000000
>     Last message repeated 1 times
> [mpeg @ 0x311aa40] rfps: 59.940060 0.000000
>     Last message repeated 1 times
> [mpeg @ 0x311aa40] After avformat_find_stream_info() pos: 0 bytes
> read:10473616 seeks:2 frames:399
> Input #0, mpeg, from 'm84_2.mpg':
>   Duration: 00:00:21.99, start: 0.387500, bitrate: 6108 kb/s
>     Stream #0:0[0x1e0], 399, 1/90000: Video: mpeg2video (Main), 1
> reference frame, yuv420p(tv, bt470bg, left), 720x480 [SAR 8:9 DAR 4:3],
> 1001/60000, 6000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
> Successfully opened the file.
> Parsing a group of options: output file bla.ts.
> Applying option dn (disable data) with argument 1.
> Applying option vcodec (force video codec ('copy' to copy stream)) with
> argument h264_qsv.
> Applying option profile:v (set profile) with argument baseline.
> Applying option acodec (force audio codec ('copy' to copy stream)) with
> argument aac.
> Applying option b:v (video bitrate (please use -b:v)) with argument
> 1000k.
> Applying option r (set frame rate (Hz value, fraction or abbreviation))
> with argument 25.
> Applying option b:a (video bitrate (please use -b:v)) with argument
> 128k.
> Applying option vf (set video filters) with argument scale=720:576.
> Applying option aspect (set aspect ratio (4:3, 16:9 or 1.3333, 1.7777))
> with argument 16:9.
> Applying option ar (set audio sampling rate (in Hz)) with argument
> 48000.
> Applying option ac (set number of audio channels) with argument 2.
> Applying option f (force format) with argument mpegts.
> Successfully parsed a group of options.
> Opening an output file: bla.ts.
> Successfully opened the file.
> detected 8 logical cores
> [Parsed_scale_0 @ 0x31226a0] Setting 'w' to value '720'
> [Parsed_scale_0 @ 0x31226a0] Setting 'h' to value '576'
> [Parsed_scale_0 @ 0x31226a0] Setting 'flags' to value 'bicubic'
> [Parsed_scale_0 @ 0x31226a0] w:720 h:576 flags:'bicubic' interl:0
> [graph 0 input from stream 0:0 @ 0x311a2e0] Setting 'video_size' to
> value '720x480'
> [graph 0 input from stream 0:0 @ 0x311a2e0] Setting 'pix_fmt' to value
> '0'
> [graph 0 input from stream 0:0 @ 0x311a2e0] Setting 'time_base' to
> value '1/90000'
> [graph 0 input from stream 0:0 @ 0x311a2e0] Setting 'pixel_aspect' to
> value '8/9'
> [graph 0 input from stream 0:0 @ 0x311a2e0] Setting 'sws_param' to
> value 'flags=2'
> [graph 0 input from stream 0:0 @ 0x311a2e0] Setting 'frame_rate' to
> value '30000/1001'
> [graph 0 input from stream 0:0 @ 0x311a2e0] w:720 h:480 pixfmt:yuv420p
> tb:1/90000 fr:30000/1001 sar:8/9 sws_param:flags=2 [format @ 0x3122d20]
> compat: called with args=[nv12|qsv] [format @ 0x3122d20] Setting
> 'pix_fmts' to value 'nv12|qsv'
> [AVFilterGraph @ 0x31214a0] query_formats: 4 queried, 3 merged, 0
> already done, 0 delayed [Parsed_scale_0 @ 0x31226a0] w:720 h:480
> fmt:yuv420p sar:8/9 -> w:720 h:576
> fmt:nv12 sar:16/15 flags:0x4
> [h264_qsv @ 0x3120880] Error initializing an internal MFX session
> Output #0, mpegts, to 'bla.ts':
>     Stream #0:0, 0, 0/0: Video: h264, 1 reference frame, none, q=2-31,
> 128 kb/s, SAR 64:45 DAR 0:0, 25 fps
>     Metadata:
>       encoder         : Lavc57.14.100 h264_qsv
> Stream mapping:
>   Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (h264_qsv)) Error
> while opening encoder for output stream #0:0 - maybe incorrect
> parameters such as bit_rate, rate, width or height [AVIOContext @
> 0x3121a40] Statistics: 0 seeks, 0 writeouts [AVIOContext @ 0x311b380]
> Statistics: 10473616 bytes read, 2 seeks
> 

Mh, this means that MFX_Init fails.
According to the spec "the function cannot find the desired SDK implementation or version".

Did you try to use the MediaSDK samples, just to see that this issue is not related to your installation or platform ? And, can you provide the output of unnamed -a ? 

Please check following:
1. /opt/intel/mediasdk/lib64 does contain MediaSDK files.
If there are no files, check MediaSdk installation, seems some script was not executed.

2. try to run super user command prompt (by 'su', not by 'sudo') and try to execute ffmpeg under root console.
If it will work under root, then most likely you missed this step:
==========
. Add the user(s) who will run Intel Media Server Studio – SDK applications to the video group 
$ usermod -a -G video [LOGIN]
==========

Just for info: My work machine for qsv developing/testing is centos 7.1, media sdk is latest, 2015 R6.
To compile ffmpeg I do NOT use opensource wrapper at all, instead the following steps after installation Media SDK were performed:
1. libmfx.pc was copied into  /usr/lib64/pkgconfig  (same directory as libdrm.pc)
It is txt file, you can correct it if necssary

2. Copy mediasdk include files from /opt/intel/mediasdk/include to /opt/intel/mediasdk/include/mxf:
# mkdir -p /opt/intel/mediasdk/include/mfx
# cp /opt/intel/mediasdk/include/*.h /opt/intel/mediasdk/include/mfx/

3. configure ffmpeg:
$ ./configure --enable-libmfx


> 
> 2015-11-06 15:58 GMT+01:00 Will Kelleher <wkelleher at gogoair.com>:
> 
> > > Hello,
> > >
> > > I try to transcode with quick sync, but it doesn't work.
> > > I did follow:  https://ffmpeg.org/general.html#Intel-QuickSync-
> Video
> > >
> > >
> > > I get this error
> > > [h264_qsv @ 0x3017580] Error initializing an internal MFX session
> > > Error while opening encoder for output stream #0:0 - maybe
> incorrect
> > > parameters such as bit_rate, rate, width or height
> > >
> > > How can I solve this please?
> >
> > Unfortunately this error can be caused by a variety of things.  To
> > start, can you share your exact CPU model and the Media SDK version
> > that you're using?
> >
> > Also, what platform are you on?
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



More information about the ffmpeg-devel mailing list