Intel Media SDK tutorial: encode-decode check

Intel Media SDK tutorial: encode-decode check

I've been trying the examples in the Intel Media SDK tutorial:

However, I found that when trying to take a sample raw YUV4  video (such as "coastguard" from which plays correctly in VLC, encode it with simple_3_encode, and decode it with simple_2_decode (which should give me back a lossy version of the original YUV), the final video looks quite different in VLC.  See the attachments below.  Furthermore, MediaInfo can't read any metadata in the final output.

  • No changes to the source for simple_3_encode nor simple_2_decode were made other than changing the input resolution of simple_3_encode to match CIF format.
  • The same issue happens for the variants of simple_3_encode (and simple_2_decode) such as simple_3_decode - d3d.
  • The same issue happens for larger YUV4 videos such as 1920 x 1080 "pedestrian_area" from
  • I also tried playing encoder's output file ".264" directly in VLC but it did not play at all.

What could be the problem?

Downloadimage/png good-input.png208.03 KB
Downloadimage/png bad-output.png74.78 KB
4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Richard,

I picked up the first raw YUV frame of the "coastguard" content from here, (the two first links are broken) and encoded it to H.264 using simple_3_encode project without issues. The YUV file is of resolution 352x288, so you have to change the inputWidth and inputHeight in the code.

I do not recommend using typical end user media players (such as VLC or WMP) to play back elementary streams(ES). Such players were developed with container decode (not ES) in focus and it will often fail to decode pure ES.

If you want to play back (render) pure ES check out Media SDK sample_decode sample or video tools such as Elecard StreamEye, FFmpeg and many others.

Elecard also have a nice YUV viewer tool whihc you can use to validate YUV content before feeding it into any encoder.

I do not believe the "pedestrian" content is of typical YUV type color space format since I do see some drifting shadows. You would likely have to convert color space first if you want to use this clip.


I had made the change to the resolution parameters for 352 x 288.  I have tried your suggestion of using ffmpeg.  However, when I extract the frames of the encoded h264 file (or view with ffplay), the result has a strange vertical line and the video seems to "scroll sideways" (see attachment).  The ffmpeg command I use is:

ffmpeg -i test.264 -vframes 300 out%d.png

or simply:

ffplay test.264

See attachment for examples.  Is there something I am missing?


Downloadimage/png out1.png152.92 KB
Downloadimage/png out50.png154.86 KB
Downloadimage/png out100.png187.92 KB

Hi Richard,

I see nothing wrong with the coastguard YUV content. I suspect that in the process of merging the coastguard YUV files you may have introduced some additional padding, thus the scrolling issue.

I joined the first 12 yuv frames from the coastguard content into one yuv file and was able to encode into a proper stream.

I suggest you validate your YUV input files with YUV viewing tool before feeding it to an encoder.


Leave a Comment

Please sign in to add a comment. Not a member? Join today