Convert Encode RGB24 Uncompress Avi file to H.264

Convert Encode RGB24 Uncompress Avi file to H.264

I'm test Intel Media SDK now.

When I run sample program to encode RGB24 Un-compress avi
video toencoded h264 OR MPEG2 file does not played inMedia Player. In VLC
file play with show only Color Lines which move Horizontal and Vertical and Framerate also increase from 30 to 60

I convert the RBG24 to YUV420 Formt but result still same.

Encoded File screenshort is below

Thank in Advance

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

Hello Omar,
If you are using sample_encode please note that it requires pure raw video stream as input. AVI container contains meta information which being encoded as frame data results in such artifacted stream. As for output stream not playable with Windows Media Player this is again due to the sample specifics - it produces an elementary video stream. WMP is not able to playback elementary h.264 format.
If you would like to convert an AVI to MP4 for example you may use Media SDK Direct Show samples with GraphEdit application (FileSource Async->AVI Splitter->Color Converter -> Intel Media SDK H.264 Encoder -> Intel MSDK MP4 Muxer -> FileWriter)

And if you have some trouble connecting "Color Converter -> Intel Media SDK H.264 Encoder" (like Nina said), please make a search in this forum.... ;)

Good luck!

Thanks for Help.

But After convert Avi video to Raw YUV format.Now I got Following Result

Source Video:

Encoded Video:

Tnanks in Advance

Hi Omar,Sample_encode requires YUV 420 format and your source is YUY2 (YUV 422) as I see.Nina

Thanks for Reply

I Convert RGB to I420 format and then encode to MPEG2. Now Encoded Video Show good result but images are move horizontally as shown in below Image.

Sourc Image:

The result looks like you have provided wrong resolution to the sample_encode (width/2 instead of actual width). Could you share the command line you are using? Also please share the raw video after color conversion - you may cut several first frames and attach the stream here.

Are you using I420 like:



I don't know if I could explain.. but, are you shure that you are setting Y's correctly ?


sample_encode mpeg2 -i 1.yuv -o result.mp4 -w 720 -h 576

and Source and Result File can be Download at following Link

and one more question is that can i used Intel SDK H264 or Mpeg2 decoderin or Window Media Player as Decoder?

Hi gthomaz

I don't kwn what is Y's setting. I convert RGB24 Source Avi file to Raw I420 format using following Command

mencoder.exe -of avi Source.avi -o 1.yuv -vf format=I420 -nosound -ovc raw

Hi Omar,
As far as the input YUV file for the sample_encode already looks bad this means you are doing something wrong at conversion stage. This is not an encoding problem.
In your command line for mencoder.exe please try removing '-of' option, it is mispaced and probably takes effect and results in avi container at output again.
Try this linemencoder Source.avi -ovc raw -vf format=i420 -o out.yuv
If this doesn't help please share the Source.avi.

Regarding your other questions. As for VB.Net there was an answer posted in your older thread
As for Windows Media Player it should be possible to use Media SDK decoders through Media Foundation and Direct Show sample decoder plugins. Likely you will need to experiment with GUIDs and merits to make WMP use those plugins, but it should work. Please give it a try.

Hi Nina

I tried this line
mencoder Source.avi -ovc raw -vf format=i420 -o out.yuv

but result still same. I upload Source and Result Files at following Link

Hi Omar,
I checked mencoder at my side - the problem is that the default output container is AVI. To actually get the raw video stream you need to add the option -of rawvideo.
The whole line should be:mencoder Source.avi -of rawvideo -ovc raw -vf format=i420 -o out.yuv
I checked that it provides a raw video stream. The only problem I saw - some corruption on the first several frames. Seems that there's a problem in mencoder's color conversion algorithm.
To overcome this I used VirtualDubMode to change compression inside avi from cvid to IYUV and after that used mencoder to extract raw video from an avi. Having done all that I achieved a totally good looking YUV stream.
Please try. Also be sure to use the correct resolution with sample_encode after that - I noticed that Source.avi has the resolution 1024x768 and you encoded as 720x480.
Best regards,Nina

Hi Nina,

Thanks I also get good looking Video but Video movehorizontally and not playback as Video.
How can i solve this issue?

Hi Omar,
Based on the Source.avi you shared, the raw video after conversion and the encoded video after encoding with sample-encode playback totally fine at my side. Horizontal movement shows that you still get an avi file after conversion. Please check the command line arguments of mencoder.

Hi Nina

Thanks for help. Issue is Fixed.

Very glad to hear that!-Nina

I use iDealshare VideoGo to convert AVI to H.264, MPEG-4, MPEG-2,

Here is the step by step guide at

Have you tried iDealshare VideoGo which can easily convert AVI to MPEG-2, H.264 or MPEG-4.


Work B. wrote:

Have you tried iDealshare VideoGo which can easily convert AVI to MPEG-2, H.264 or MPEG-4.

The converter you recommend is a shareware, you have to pay for it to get the full version, or else there will be a big watermark in the converted video. To convert video, I'd recommend an online app called Acethinker Video Converter, It's a free web-based application to convert videos, you don't have to install anything. No watermark and limitation.



Leave a Comment

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