samples: encode-decode workflow issues

samples: encode-decode workflow issues

Hi, I have issue with encoding followed by decoding: the correct video file (h264/AVC format) was encoded using sample_encode, and encoding result was decoded by sample_decode using h264 codec. The decoded output was impossible to play (using VLC media player) or see its details in MediaInfo browser.
I tryed to repeate encoding-decoding workflow for the same file without audio codec, but result was the same(audio codec, was removed by ffmpeg with "failed for stream 0, codec copy" notice).My workflow description:|1. Encoding for test.avi: "sample_encode.exe h264 -i test.avi -o test.out -w 480 -h 272"|2. Decoding:sample_decode.exe h264 -i test.out -o test_out.avi|Other questions:I tryed to use HW optimization for sample_encode.exe (-hw option) but application returned errors, what may be the possible reason for that ? Does -sw option utilizes Sandy Bridge technology for transcoding?|My system has i7-2600 CPU and 2 graphic cards Intel (disable onboard card) and Nvidia GT430 - main graphic card.|May be you have had experience with SW/HW transcoding acceleration factors relative to any reference CPU/GPU system ?|Input video file details from MediaInfo:===================================================================GeneralComplete name : C:\\Program Files\\Intel\\Media SDK\\3.0.442.32245 Beta3\\samples\\_build\\x64\\Debug\\test.aviFormat : AVIFormat/Info : Audio Video InterleaveFile size : 637 MiBDuration : 2mn 10sOverall bit rate : 41.0 MbpsWriting library : VirtualDub build 32842/releaseVideoID : 0Format : AVCFormat/Info : Advanced Video CodecFormat profile : High 4:4:4 Predictive@L3.1Format settings, CABAC : YesFormat settings, ReFrames : 1 frameCodec ID : H264Duration : 2mn 10sBit rate : 41.0 MbpsWidth : 480 pixelsHeight : 270 pixelsDisplay aspect ratio : 16:9Frame rate : 50.000 fpsColor space : YUVChroma subsampling : 4:2:0Bit depth : 8 bitsScan type : ProgressiveBits/(Pixel*Frame) : 6.329Stream size : 636 MiB (100%)Writing library : x264 core 811799308Sep 8 2010Encoding settings : cabac=1 / ref=1 / deblock=0:0:0 / analyse=0x3:0x113 / me=hex / subme=5 / psy=1 / psy_rd=0.0:0.0 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=1 / cqm=0 / deadzone=21,11 / chroma_qp_offset=0 / threads=6 / nr=0 / decimate=1 / mbaff=0 / bframes=0 / keyint=250 / keyint_min=1 / scenecut=40 / rc=cqp / mbtree=0 / qp=0=================================================================

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi fzeev,

The way you are using the Media SDK samples it will unfortunately not work.Media SDK operates on elementary streams (ES) and raw frame data. In your usage you are using media containers. Please refer to the Media SDK manual and Developer Guide for expanded details on how to use Media SDK and the samples.

You are feeding the encode sample an avi media container file. This will not work since the encoder requires RAW frame data input (encode sample expects input YUV data file). Decode sample expects ES input.

Some other notes:- Common media players does not normally play back ES well- You are using a discrete graphics card. By default this configuration will not work if you want to use HW acceleration. To make it work you will have to make some changes to the sample code and connect a secondary monitor associated with Intel processor graphics. There are more info on this in the manual.


Thanks a lot for you response, I'm very new for Intel Media SDK, after I've finished to read Media Developers Guide and tryed to run examples. Probably the correct workflow to run examples (in my case) should be like:AVI->YUV->sample_encode->ES->sample_decode->YUV->AVI
May be you can reference me how to convert avi to YUV and vice versa using Intel Media SDK (if that possible at all ...)Other question, does sw option utilizes Sandy Bridge technology of CPU and how sw transcoding may be slow relative to hw one - I'm not looking for exact numbers any estimation will be good for me

Best Reply

Hi fzeev,

It seems you expect AVI container file to cointain raw data? This is not the case. Containers such as avi, mp4 or mpeg2 contain compressed media streams such as h.264 ES and AAC audio.

An example transcode (h.264 -> mpeg) pipeline would look something like this:mp4 (containing h.264 ES) -> splitter(demuxer) -> h.264 ES -> Media SDK Decoder -> raw YUV -> Media SDK Encoder -> mpeg ES -> muxer -> mpeg container
Note that muxing and demuxing is out of scope of the Media SDK product.

The Media SDK developer guide have some information on how to extract ES from containers. You can also check out free tools such as YAMB for this purpose.

I cannot provide specific data on SW vs. HW performance. The results will vary wildly depending on type of video stream and platform configuration.


Hi Petter,
You are very patient for my questions and I'm very grateful to you for that !
Probably (I hope so) this's last question:
Intel Media SDK session may be initialized by HW or SW flag, when used HW flag, probably will be used graphic card capabilities for parallel computation. My question regarding to SW mode, does Media SDK function are optimized per CPU (for example if function is running on i7-2600 CPU, does will it utilize GPU capabilities of the CPU) or optimization is more universal, like to usage in SSE2/3 instructions for CPU, without to take into account capabilities of the current CPU ? Does optimization support older families of Intel CPUs?

Thanks in advance,

Hi Ze'ev,

If Media SDK is initialized with HW flag it means that Intel GPU fixed function HW will be used to accelerate codec. Note that HW acceleration is not available on all Intel platforms. This is where things may seem a bit confusing, since the recent Intel platforms such as the 2nd generation Intel core processors (also code named Sandy Bridge) have GPU and CPU integrated on the same silicon. When we refer to the GPU on such a platform we often refer to Intel Processor Graphics.

If Media SDK is initialized with SW flag it means that the codec workload will be executed on the CPU only. And yes, CPU codec execution is optimized for the specific CPU architecture.

And again, keep in mind that if you have a discrete graphics card installed, Media SDK HW acceleration will not work by default.



Login to leave a comment.