You are here

MKV (H.264 codec) to AVI (XviD codec) conversion

Update Jul 16, 2011: I finally did a much-needed upgrade of my website, but in the process have broken images on almost all of my old posts. The images are still around; I'll try to get to restoring them on this post when I get some time to do so.

Note as of Jan 16, 2010: It's been several years since I've had to convert video using the methods in this article. A couple years ago, I had purchased a Popcorn Hour A-110 set top box which can play MKV files with H.264 video and any of a large number of audio codecs (and with 720p or 1080p resolution, too). Asking for help from me on any aspects of this guide will be pretty fruitless as I haven't had to deal with converting video files in such a long time.

Really, I won't be providing support for this guide, though I'll leave it up as it still seems useful to people. You'll be much better off going to an audio/video codec and conversion tools site.

As I promised earlier, I will post about how to convert an MKV container file with an H.264 encoded video and AC-3 encoded audio to an AVI container file with an XviD encoded video and, optionally, 2-channel MP3 encoded audio.

The MKV format makes a very good distibuting format, with the ability to have multiple audio streams and multiple subtitling streams, combined with the H.264 codec for high quality video. Unfortuntely, if you're like me, you have a DVD player that isn't able to play such files but can play XviD or DivX encoded video in AVI files (like my OPPO OPDV971H Player ) hooked up to a big-screen and an home theater audio system, but would wish to watch (or invite others to watch) that greatest and latest video that you've found on the internet, that's only available as an MKV file!

(I may have some errors in here. Feel free to comment to help with details or ask questions)


I was recently made aware the AllToAvi project. I haven't checked it out yet, but if it works like I think it does, then much of the following steps aren't necessary... ;). Still, I'll keep all of it up until I am able to confirm this.

UPDATE (Oct 2, 2007): Here's an alternate tutorial to convert a H.264 encoded MKV file to and AVI file using AllToAvi.

Programs Needed

These were installed and run on a Windows XP Home system. Yes, I am a Linux freak, but I am too used to windows for this process. There's also several commercial programs that seem able to do this, like Stoik Video Converter or All to AVI, but I'm sticking with freeware or open source tools in this guide.

Install and Setup

Though a few of the tools and codecs that I've pointed to above have self-installers that will set everything up for you, the others require that you install them into your operating system.

The first example is VirtualDubMod. When I downloaded the file, all you get are the actual files instead of the normal install executable, so I extract all the files in it to "C:\Program Files\VirtualDubMod". When the VobSub_2.23 asks for the VirtualDub location, I give it the same path. I also create a shortcut to "C:\Program Files\VirtualDubMod\VirtualDubMod.exe" on my Desktop.

I also extract MKVExtractGUI and avc2avi into the same directory that the MKVtoolnix installer ("C:\Program Files\MKVtoolnix").

Many codecs either use an executable installer (especially if they are part of a codec pack) or can by installed by extracting the files into a temporary directory, right-clicking on the .inf file, and selecting Install.

FFDShow may need some configuring before it can decode H.264 streams for VirtualDubMod. Open up the FFDShow VFW Codec Configuration (On my system, Start -> All Programs -> Combined Community Codec Pack -> FFDShow VFW Codec Configuration), the click on the Decoder tab. Make sure that "Codecs" is selected in the left select box.


On the row with the H.264 format, change the Decoder to "libavcodec". If you wish to use FFDShow for your encoder, click on the Encoder tab and change the Encoder field to what ever format you wish (XviD is probably a good choice). When you get to the encoding step further down, choose the "ffdshow Video Codec" instead of the "XviD MPEG-4 Codec" that I use. Keep in mind that configuring it will look different.

Converting instructions


For my examples, I will be using a video at C:\temp\Global_Astroliner\Global_Astroliner.mkv, for simplicity's sake.

The first step is to run it through MKVextractGUI to separate the video, audio, and subtitle streams to manipulate in VirtualDubMod:


Once you have the Input file setup and all of the Tracks selected, press the Extract button.

When the process is finished, you should end up with at least three files with the following extensions: .h264 (video file), .ac3 (audio file), and .ass (subtitle track. Yes, I do think it's an amusing extension). Close MKVextractGUI


Unfortunately, VirtualDubMod cannot read the .h264 file, so we will have to put it into an AVI container, which is where avc2avi comes in. It is a command-line program, so was have to open up a console window via Start->Run, type in "cmd" at the prompt and press the "OK" button. Navigate to the directory where the .h264 file is at, and run:

avc2avi -i <input file>.h264 -o <output file>.avi 

For example:


This may take some time, but once it is finished you should have a .avi version of the video track that should be usable by Virtual Dub Mod! You may now close the command line window.

Now we get to the real work. Open up the above .avi file in VirtualDubMod.


Note: On my system, I couldn't move the position slider to the middle of the video and press play (I.E., to check for subtitle/audio syncronization with the video) without getting an error. I always had to start from the beginning of the video to do this. This seems to be an issue of the h.264 decoder I used. Fortunately, this does not affect the actual encoding of the AVI file.

Go into the Video menu and select Compression to choose the desired compression method. Select the codec, and press the Configure button to set it up.


As you may notice, I'm using a pretty high target bitrate for this run, as I wish to maintain as much of the original video quality as possible to be able to run on the big screen TV hooked into the player. I think most distributed video files go for around 800 kbps.


To add the audio stream, go to the Streams menu and select Stream List. When that window pops up, press the Add button and select the .ac3 file that was extracted by MKVextractGUI.


Optional: At this point, you may choose to process the audio into a 2-channel ADPCM or MP3 format. In my case, this was unnecessary as my player will pass through the AC-3 stream from the AVI file to my 6-channel sound system. If you decide to re-encode it, don't forget set the mode to Full Processing Mode and use the Conversion window to convert down to 2-channel Stereo before setting the desired Compression method. I'm not sure if all of the 6-channel AC-3 stream is down converted into 2-channel stereo this way, so you might have to use Filters (select Use advanced filtering to do this), but this is outside of my realm of knowledge.

After you get the the audio stream added and configured like you want, you will have to modify the framerate of the video stream, as that information is lost when you ran avc2avi earlier. Open up the menu option Video, and select Frame Rate....


Simply select Change so video and audio durations match and press the Ok button.


Now, we will add the subtitle track to the AVI file by adding it to the video stream. This step is actually optional, as my player will play the subtitle track if it's offered as a separate file on the disc, but the TextSub filter (which should be a part of the VobSub plugin) for VirtualDubMod does a much better job than my player does (I.E., text placement, colors, and proper line breaks. My DVD player will break to the next line in the middle of a word...).

Go into the Video menu, select Filters..., and press the Add... button. Select the TextSub filter and press the OK button.


Press the Open... button, choose the .ass file. I usually click on the Styles... button and setup the margins to account for overscan on my TV (You'll have to experiment for your own setup for the right values. For a 720x480 image, I'm trying out 30 for all the margins). Close the Subtitle Style Editer by pressing OK, close the TextSub settings by pressing OK, then OK again to close the Filter screen.

Other Options

At this point, I am ready to create the AVI file with the video at 720x480, as my player will simply stretch the image to full screen on the widescreen TV. For those who wish to set a proper aspect ratio in the video may do so using the resize filter (Video -> Filters... -> Add... -> resize). As a reference, many distributed videos files use a size of 704x396 for a widescreen video, and 640x480 is good for a full screen video. I believe it is okay to use Bilinear for the filter mode. Be aware that your encoding codec may not support any particular screensize (which would give you an error when you try to create the AVI file in the next section), so feel free to experiment.

Creating the AVI file

At this point, you can preview the video by clicking on the "Play" button with the "O" on it. If you get an error, rewind to the beginning of the video and try to play it again. Watch to make sure the video, audio, and subtitling sync up with each other.

This is the simplest step. Go into the File Menu, choose Save As..., Enter in the desired file name and press the Save button. Now you're in for a bit of a wait. Do something else, or simply sit back and watch the pretty graphs...


Please resist the urge to click around on things. On my system, clicking on the Log tab of the VirtualDubMod Status window caused it to crash, causing me to have to start over.

Once the video is finished, watch it. Skip forward in it and pay attention to the video/audio/subtitle synchronization. If something seems off, you may have skipped over a step.

Final Words

I hope this helps others, as I wasn't able to find any good instructions to convert these MKV files I had to play on my OPPO DVD player. This document is the result of a lot of Googling with quite a bit of time experimenting with programs.

  • 1. avc2avi was at this location, but it is unavailable there now. Changed the link thanks to a tip in the comments. If you need, use 7-Zip to decompress the 7z file


You are the wind beneath my wings.  I'd been wondering (actually, this very morning as I took a shower) if this was even possible, and here I find the step-by-step instructions?  Brilliant!

Hah! Thanks. :)

Though I now realize I missed a fairly important step: installing and configuring these programs. There's a few adjustments you need to do for the codecs to work as expected, especially if you're using the FFDShow Codec for encoding and decoding. I'll have to wrack my brains to remember what I did, though...

UPDATE: Ok, done! Feel free to correct me or ask questions if I missed something.

i got failure results when i add the avi file to vdm. the error says "[!] Couldn't locate decompressor for format 'h264' (unknown).
VirtualDub requires a Video for Windows (VFW) compatible codec to
decompress video. DirectShow codecs, such as those used by Windows Media
Player, are not suitable. Only 'Direct stream copy' is available for this

i have install all codecs but to no avail.

what do you think should i do?

Truthfully, I have no idea. The problem could be anywhere between FFDShow not being fully setup to decompress h.264 (see the section in "Install and Setup") to conflicts occurring between multiple codecs on your system, which is way outside the scope of what I can do to help you. These are simply steps that I use to do the conversion, but there's no guarantee that they will work on a particular system and this probably isn't the only way to do this conversion.

Also, you'd probably be better off asking on an AV forum like or than on this blog.

i have problems with playing mp3s on virtual dub
whr do i extract LameACM ? :)

Hey nick, I followed the steps precisely to the end point, subtitles and conversion and quality were all excellent but there isn't any audio. I added it through Stream list and it's an OGG Vorbis file or something along those lines. Is there something i needa do to that file?

Thanks for the help mate.

Unfortunately, I wouldn't know where to start even 2-3 years ago, which is about how long ago I've last used this method. I now have a Popcorn Hour A-110 in my audio-video setup that can play MKV files with H.264 video and AAC, MP3, OGG Vorbis, and many other audio codecs which really renders this article obsolete for me.

You'll be better off asking at a dedicated forum for audio/video instead.

Ahh, thanks for getting back to me so soon. I managed to figure out the problem, Ogg vorbis sound files won't work in an avi container without plugins/addons etc.. so i just used an OGG converter and converted it to MP3 and it worked straight away. Thanks for this though, was really helpful and i can now convert Code Geass.mkv to watch on my psp :)

Cheers, Rob.

I've used AlltoAVI, and it does work and is very easy to use, but there is definit loss of video quality.

Is there noticeable loss of quality for this process as well?


Well, the answer is: it depends.

In truth, any process that requires a re-encode of the video/audio (As in h.264 to XviD here) will suffer a loss in quality, as the compression scheme is lossy (as opposed to lossless). The best way to counter this is to up the bit-rate/quality of the encode. For example, I ended up using a bit-rate of 2000 Kbps, and while this results in an AVI file that's twice the size of the original MKV file, the result it that it looks quite good on the 46" TV.

My instincts say that this should be possible to do in AlltoAVI, hence there would be no "quality" difference between that program and the process I described above, but I haven't actually used it yet to know for sure. Usually, I go for XviD versions of videos if I can, since most of those work without any needed processing in my Oppo player. This article was largely the result of an animation that was only available in H.264 MKV format.

I was anonymous from above and I'm in the same boat your in....I'm an Anime-Freak who wants to watch anime on my LCD TV. I also have an Oppo 970HD player.

I"ve tried alot of process, and this is by far the best way to get as close as possible to the original mkv (I tried it after I asked). Have you had any probems with your Oppo playing high resolution files? I have a series in 1024x576 that I converted with your process and when I try to play it, there is no video, only audio. It plays fine on my computer, so i think its either the high res or some codec issue, but I use the one you suggest from this guide. I'll try a normal res too, but if you know anything about it that be great to know.

Also, do you know anything regarding the USB port? I have an external harddrive I wanted to use so I formatted it in FAT32, but got a disc error. My 1GB thumb drive reads fine.

Sorry for all the questions.


I'm not sure about the Oppo 970HD, but the FAQ for my OPPO OPDV971H that I have only supports a max of 720x480 for DivX encoded files. I don't see any such limitation on the 970HD, though.

Also, my player doesn't have a USB port or memory reader with it. Your best bet is to probably contact Oppo directly and ask them, if possible.

You, sir, are a god. Seriously.

I had been trying to get my Fate/Stay Night anime (in h264 mkv's.. courtesy of mininova) onto my psp and ipod. I tried heaps of methods of encoding and other programs but couldnt get it to work...

thanks to this awesome guide, i got the mkv's converted into avi files with burnt-in subtitles, and from then it was easy to go to .mp4 for psp/ipod ^_^. Thanks a heap for the guide, i salute u 

I'm having alot of trouble with audio/video sync. The audio is ahead of the video.

Why does a mkv file that is 23:29 long have an mp3 file that is 24:59 and a avi file that is 23:03 when demuxed?


Most likely because the mp3 was or is a variable bit rate file. I have found if you encode just the extracted mp3 as a constant bit rate and use it as your audio, the syncing usually matches up to the video.

Thank you so much for this entry.. I've been looking for an easy enough turtorial for about a week now, on how to convert these files so that I can burn them. You are a god send. This is well written and so easy to understand. And the best part about it is I won't have to go searching around for programs anymore that I end up not using in the end.. Thanks so much again :)

Thank you so much for this tutorial!
I already "owned" all these programs and tried to use them to make these awfully incompatible mkvs into avis, but you showed me the right strategy!
Finally I can enjoy them on my HD-TV!

I have to say, I was really excited about mkv and it's possibilities... after over a month trying to decide what format to rip in.

After finding out mkv's not even continued anymore, and literally no hardware dvd player to support it, AND how impossible it was to convet back to avi... I dumped the idea of mkv. If it's going to only play from computer, I'll just keep using the "FOLDER" as a container.

I did at least find a codec I like, H264, over xvid or divx.

In theory, a container should act like a container... mkv's more like tightly knotted rope!




Where did you hear that "mkv's are not even continued anymore"?

As for the rest of your rant, MKV is simply a container format standard. There's not much to do with that except to extend the standard to accommodate new codecs as they become available. As for hardware DVD support, also keep in mind that MKVs were only announced in 2002, and have very little built-in support with any O.S., possibly except for several Linux distributions. Compared to AVI, which was developed by Microsoft in the early 90s and had full built-in support (for the container format, NOT necessarily the codecs) by Windows.

As a distribution format, I find MKV to be superior to AVI, especially since it can handle multiple audio and soft-subtitle streams within the container. Unfortunately, it is too new and hasn't picked up enough usage for (at least freeware and open-source) tools to be made to handle it fully, though given the steps I've outlined in this entry, it is far from "impossible" to convert it to an AVI container format.

If it builds up popularity, you will be seeing more tools that will make this article obsolete, and you may start seeing set-top hardware being able to handle the container format even further down the road, completely with handling soft-subs and multiple audio like a regular DVD player. To completely denounce it like you've done is simply too premature.

I followed your instructions, and everything has worked out great so far. When I initially demuxed the mkv file, I guess that's the seperating everything, I tried doing the whole cmd thing, and could never figure it out. I just moved on to the VirtualDubMod step, and added the video, but it seemed to work fine. When I went to the actual file in the folder, it said it was a video file, and had a film strip for an icon that said avi on it. Now, the real problem I had was that when I went to the filters under video, I clicked Add, but there wasn't an option for the TextSubtitles thing you were talking about. Is there something I'm missing, or something I should have downloaded that I didn't? Note, I didn't download any of the optional things. I hope I can get a response soon.



You might need to install VobSub. Check in the Programs Needed and Install and Setup sections on the hints to install it.

I had written the install and setup instructions long after I had installed the needed programs, so those instructions were largely from memory. Unfortunately, that section may require an intermediate level of knowledge on installing and setting up programs.

Now that I think about it, the entire guide might require an intermediate level of knowledge of codecs and the command line. By the sounds of it, the MKV file you're trying to convert isn't encoded with the h.264 codec, but with the XviD codec. The avc2avi command line is only required for converting a h.264 into an AVI container so that VirtualDubMod can actually read it. The few times I converted an MKV file that's encoded by DivX, MKVextractGUI sets it as an AVI file that VirtualDubMod could already read.

I got it to come up, but now when I select my subtitles, and do what you said, they don't show up when I play it. even when I don't do the styles thing they don't show up. Is there something I'm not doing, or does the world just hate me right now?



Are you looking at the right part of VirtualDubMod? By default, it shows two versions of the video as it's playing (if you press the play button with the "O" subscripted next to it), usually the left side is the unmodified video and the right side side is the video after going through the filters. The last screenshot in the article should show what it should look like. Notice that the subtitles are in the right video but not in the left in that screenshot. Sometimes, the VirtualDubMod window is too small to show both videos. There might be a way to "swap" the input/output videos so that you see the output on the left.

Past this, I don't know how else to help you. You might get better info from or as I am no expert on how to do these conversions. 

J5, Whats the extenstion on the subtitle file?

I had a problem where the subs wouldn't load into VDubMod at one point. I don't think TextSub takes srt files. If i remember correctly.

Also, I finally figured out how to encode the files I was having problems with!! Its because they were variable frame rate. Namely Kick Ass Anime files seem to all be variable frame rate. I'll post the process later in case anybody else needs to know.

Heres how to make a Variable Frame Rate h264 MKV into an AVI that can play on DVD. Very general directions if someone happens upon this thread to point them in the right direction.

H264 VFR Conversion

1. Get timecode for video track using mkvextract command line or mkvextractGUI
-- make sure the track # is the same as the video track #

2. Get avi file using avc2avi

3. combine avi and timecode in tc-GUI

4. enode in VDubMod keeping frame rate (119.880) for source rate adjustment
--but changing Frame rate conversion to: Convert to fps: 23.976

Thanks for this info! I'll update the instructions if I happen on a VFR h264 encode.

Started, AGAIN, at four o'clock today trying to convert an .mkv with vfr .h264 and .aac audio. After wrestling with A/V sync problems all day and trying every guide and piece of software out there I have finally just completed a test run that has sync-ed perfectly thanks to mataichi's suggestion about tc-GUI. I shall be keeping this little gem of a program for some time since it appears to be the only way to handle such media at the moment. And this snippet of valuable information appears to be the only tip out there. Well Done mataichi and thank you very much !!!!!

No prob SHANKS. Believe me, it took me forever to find out how to do it myself, but by taking peices from all over the internet, it all came together.

This blog is about the most comprehensive listing of information on the topic I've found so props to Nick for starting it.

Also, SHANKS, if you are doing this to play on a stand-alone DVD player just know that I don't think there is any player that can play AAC audio, I may be wrong on this. This is the one problem I can not solve. I was able to encode 5.1 AAC to 2.0 mp3 and it sounds pretty good. I also was able to encode 5.1 AAC to 5.1 AC3 (which can play on dvd player), but it sounds HORRIBLE. If anybody knows how to get a 5.1AAC track to play on dvd or encode to 5.1 to play on dvd please post.

Hooray! I found a great program to convert aac to ac3. Its called DAudioK. Here is a link to it in

The resulting ac3 5.1 track sounds really good!

I don't understand point 4. What is it about ? I have a mkv x264 aac vfr file.

After digging the Internet and found it maybe the problem of mkv vfr. Then I used mkv2fr to get the timecode file. Here it is
# timecode format v1
Assume 23.976
As you see that it is a mkv vfr. ( fps, what a strange fps rate)

This is the first time I come across mkv vfr. How to encode it to xvid avi video ?

You need to use the tc-GUI to combine the timecode and avi file into one. You can download the package....

Then run tc-GUI.exe. Choose tc2cfr from the tabs. Browse to the input avi file, browse to the timecode file, designate an output file path/name, click run. Then go to step 4. Good luck!!

Hello guys. I was wondering if you can help? I am completely new to this type of procedure. I have got all of the files listed and have set everything up. My problem is that when I try to extract the video & sound with MKVextractGUI it takes 1 second and I get an error message saying: 'Error: Unrecognized command line option ''. Maybe you put a mode specific option before the input file name?'. Can anyone help. I have uninstalled the codec pack and re-installed it but still the same problem. Thanks in advance.

I can't remember if it was this program, but I know I was having problems and I found that you have to have the .NET framework installed.

You can find them here...

.NET 1.1 -->


.NET 2.0 -->

Make sure you have this installed. If it is installed you should see it listed in your "Add or Remove Programs" list.


Hey Mataichi,

I removed your double post, just so you know.

And I was about to post something about the unlikeliness of getting technical help on an anime blog instead of a dedicated forum site, but you managed to prove me wrong... hehe.

thnx for removing the double post.

Yeah, I just know how much crap I went through to figure out how to do it. So I check back every once in a while to see what people are sayin.

It seems that would be an important little tidbit of information to have right up front. You think?


I've got some problems with the .h246 to .avi convertation. avc2avi isn't convert it properly, so I can't play the .avi file nor VirtualDub cann't play it either. VirtualDub displays this error message: "VideoSourceAvi error: The source image format is not accaptable (error code -2).

Anybody have idea what's this mea

Unfortunately, I have no idea what's the problem here. A Google search for that error only pulls up this German thread, but I can't really figure it's relevance to your problem.

If you're using the ffmpeg codec, do you have it correctly setup to handle .h264 encoded files? Look up in the Install and Setup section for some hints, though the specifics on how to configure it may depend on your setup.

You're guide helped me a lot! Thnx! But I got one question; I get "No audio decompressor could be found to decompress the source audio" as an error when I try to create an avi, how can I fix this? I installed the codecs that you provided but nothing happend, still the same msg. Please help!


Awesome guide! Everything working fine for me until the end when I'm saving the new AVI file! There's no audio output! When i'm previewing the output file in Virtual DubMod it works fine but when I go to save it as a new .avi there's no audio!!!

Please help!

P.S. When I demuxed the mkv an .ogg audio file came out.


You may want to convert the ogg audio file to wav or mp3, then select the stream you made in VobSub.

Okay, I've tried using that avc2avi program. However when it converts the .h264 file into a .avi, the video length gets decreased and the actual video itself is sped up. Any thoughts on this?

If you're using Virtualdub, are you setting the frame-rate so that the video and audio matches?

Quote from the article:

Open up the menu option Video, and select Frame Rate....

Simply select Change so video and audio durations match and press the Ok button.

It seems that the frame rate data for the video is lost when the .h264 file is run through avc2avi. I think it defaults to 29.97 frames per second, which would speed up the video if it was originally 24 frames per second.

Hope this helps.

So in the end, you can't do anything about it? Ah well, is there another way to convert .h264 files to .avi other than the one you wrote?

Well, it's obvious that I can't do anything for you. Why don't you try looking for help at dedicated A/V sites like or

you can achieve the task using AppGeeker, it converts pretty much any type of video/audio file.
i have used it quite a bit to render to .avi format.

And still the information posted here is a Godsend.

After weeks of trial and error and partial information elsewhere, I tripped over this posting and converted my sample mkv in no time at all. I cannot wait to try it on my larger content with, hopefully, the same results.

I did notice, or perhaps it was me, that when I demuxed the mkv, I ended up with oog audio which, while loaded and played in VDM, would not convert with the codecs I had - ended up with no audio (not no playback, no audio at all :P ). After loading the oog in VDM and then saving as wav, I disabled the oog and loaded up the wav and all was good.

Thanks for your time and effort writing this entry.

I've split the audio & video files. I'm stuck on the AVC2AVI I can't get it to work correctly. My split video file is .MKV not .h264 , is this correct? Could you give me some exact directions on how to use AVc2avi? SAmple:

CMD d:\>avc2avi -i file.h264 -o file.avi (file=file name)
says cannot open input file. any help would be appreciated.

Thank you

i only slept 2 hours trying to convert and searching how to convert h264 to avi.... and at laaaaast... i found it ...

yawn... gonna try this later after i get some sleep.....

then ill post my result...
*cuz in AlltoAvi im having a problem with the video output. some flickers at bottom half of the pic...


I've been trying all sorts of guides, and guess what, they all just were not simple enough or detailed enough to do a proper job.

Your guide was simple, easy to follow, easy to understand, and it does it job perfectly.
Thank you so much!

From the Netherlands,

David P.

Unee fօis de plus un poste réellement attractif

I'm new to this whole thing and need a little help. I went to the MKVtoolnix link and seen a whole bunch of things to download. I would like to know which one I download. Also with the MKVextractGUI, I went to the site and downloaded it. I noticed there's a src zip too. Do I have to download that too and if so, what do I have to do with it? Thanks.

Keep in mind that this whole guide is for doing the conversion in a Windows operating system, so at the MKVToolnix site, all you need is the Windows version (Click on Windows under the Downloads heading at the top of the page, then pick the installer for the version of Windows you're using.).

For MKVExtractGUI, you do not need the src zip.

All the steps are working great. Its just that when I change the container to avi using avc2avi, the resolution also changes.
My original .h264 was 768 x 432. And the avi that is formed is 672 x 432. Thats quite a bit of squeezing. The frames appear cluttered and congested and its not as wide screen as it was before. Do you know how can I avoid this?

Thank you for putting on this guide. Even for someone with poor computing skills, I managed to get through much more than I thought :)
As of now, my original files were extracted successfully into three tracks - .avi file, .mp3 file and .ass file.

It's the third one thats giving me trouble. I followed all the steps until I reached the part where I had to load the subtitle filter into VDub. When I try to load TextSub from VDub directory, it keeps telling me that it is not a Win32 application. I tried surfing other filters and using them as a substitute but during the conversion process, I dont see any subs. Strangely, there is also only *one* screen appearing instead of the two you mentioned when you were helping someone in your comments. This is for VDub (dub in progress) when I try to convert the file.

I have tried googling, but unfortunately this isnt seeming to work. Could you please help or tell me where I am going wrong? Thank you very much.


Wow, weird thing....

I was not able to extract the .avi because I am a n00b at command prompt, but I was able to convert the file into the .mp3 file (which was my original attempt from .mkv - .avi). This thing actually gave me better than expected results.

What I did was use the .mkv extractor and extracted the files. Then, I used the .acc files from the .mkv files that I extracted from and converted them to .mp3 files on Winamp Pro (If you use the poorly made iTunes, you will not get the results)

Thanks for being able to make my .mkv music videos into .mp3 audios.

Here are the music video files that I converted into .mp3's

T.M.Revolution - resonance
UVERworld -Gekidou

(HOT LIMIT is a remake of T.M.Revolution's early version [1998?])

Direct Download:

Googling ' h264 to avi' directed me to this great conversion guide. I was looking for a way to encode an H264 mkv into an xvid avi file to play on my standalone dvd player.

I had big problems with the avc2avi step but trying to find some GUI for it i found a post on Videohelp that worked great. Here's part of the post needed for those of us who cant figure out avc2avi. Link to the mux.bat file needed

1) Put AVC2AVI.EXE in your Windows System32 folder, usually, C:\Windows\System32.
(i actually didn't do this step and kept avc2avi in my MKVtoolnix folder and it worked fine)

2) Put the attached MUX.BAT file in the same folder as your .h264 file.

3) Drag your .h264 file onto the MUX.BAT file and then a dos window pops up. Wait a few minutes for it to convert the file into an avi, time may vary but it took me about 5 minutes for a 1.2 gig h264 file. After that, press a key when prompted.

That's all i did and i ended up with an avi file after a few minutes. The only weird thing was that it resized the aspect ratio to about 720x406 even though my h264 file was 853x480. Not that it mattered to me since i was going to resize the aspect ratio to 704x396 anyways. Hope that helps.

Also i noticed the avc2avi link in the guide didnt work

Ah, thanks for the update of the avc2avi program. I haven't visited this article in a while since I've setup TVersity to play video files off of my XBox 360. There's probably several things I'll need to fix in this article.

In the mean time, I'll try to get to updating the avc2avi link later today.

hii! thank u for showing such detailed and easy-to-follow instructions for converting h264 files to avi files.... it would certainly become handy when i have videos that i need to decode....

i was wondering if you could help me with a couple problems though....
1. is there anyway to make an avi file smaller by compressing its quality? cuz some of the files have huge resolutions but i have no intention of actually making use of it cuz i can't connect my computer to the tv....
2. can i use the same above steps to convert an mp4 to an avi?? for some reason my computer doesn't want to play the mp4.... only the sound works but not the video... this problems only occurred for my h264 videos before i downloaded ffdshow so i figured it had something to do with this too? i've tried opening the file with DivX player, VLC player and WMP and nothing worked....

thank you so much for your help!!!

I'd suggest asking for help on these questions on Audio/Video related forums, like the ones or I simply don't have the answers to these. Sorry.

Not sure how old blog this is but figured I could ask because I'm having some problems.

I seperated the audio,video and subtitles using MKVExtractGUI
got a .h264 video file, a .ogg audio file and .ass subtitle file.

I used avc2avi_gui and "Mux"ed the .h264 into a .avi file with FPS = 25 and FourCC=h264.
Converted the .ogg file into a .mp3 file and left the .ass file as it was.

Then in VirtualDubMod I add all the tracks together,set the compression to Xvid and changed the framerate and watched the preview which looked fine(well..actually it was fine).

The saved .avi file however was completely out of sync. As far as I know I've followed all the steps as they were listed here :(

Any idea how I can solve this problem? My guess is that either the avc2avi_gui is wrong or I should convert the audio to ac3(if that's even possible)..but can't find any good information on the internet.

As far as I know, if the preview looks right, the final file should be ok, so I have no idea what could have gone wrong. You might be better served when asking in a Audio-video specialty forum rather than this blog, though.

well since I used this guide i thought i'd just ask here
thanks for the reply though :)

Thanks for a great guide. Much googling and eye straining to come this far. Your work is greatly appreciated!

I have tried several tools to get my mkv files to xvid and the reason I am labouring so is because I do not have an HD standalone but an LG divx player with USB and up scale to HD1080. This is connected via hdmi to a FullHD 40'' Sony Bravia V series LCD and the digital coxial audio out feeds my Sony 5.1ch component system. I reckon that with the near H264 quality I get when encoded to xvid I should be able to watch these vids via USB using my LG standalone.

Problem is the videos do not fill the screen of the LCD. I notice in your tutorial you state that your player would stretch the 720x480 video into widescreen. I have used SUPER to encode directly from mkv to xvid and used VirtualDub with similar results i.e no widescreen even though I am using an aspect ration of 16:9. What am I doing wrong or what am I not doing?

On sound I am looking for superior sound in the final encoded video. The source again is an mkv file containing H264 video with bitrate of 847Kbps, 1280x560 resolution 30fps and vorbis 2channel audio at 44.1Khz and 160Kbps.

It sounds to me that it would depend on the capabilities of your LG player, of which I have no idea what they are. I mainly used 720x480 (which isn't 16x9 in a 1:1 ratio) because that was the maximum resolution (that I found through experimentation) that my OPPO player could handle as DivX AVI, and I can set the player to stretch the image to full screen. Your LG player might be able to handle 1280x560, though, and might have the same ability, but it might depend on a setting that I cannot know. You might want to experiment with your setup and/or look through your manual.

Also, remember that your resulting file can't really be all that superior to the source file. For 2-channel audio, I would highly recommend going to 2-channel uncompressed PCM if possible, as this will at least maintain the original quality.

Thank you so much! I watch anime on my iPod touch, this makes it so much easier :P

Thanks!!! You saved me =P

Thanks for the guide Nick. It worked for me, no problems.

Is there a way to uncompress a WMV file and encode to an XviD avi?

I've looked on the net but can't find anything other than these one click programs that are rubbish.

Unfortunately, I do not know of a good way to do so. I've never had the
need to convert WMV to Xvid AVI, so never really looked into it.

In fact, I'm not sure how relavent the MKV to AVI guide is now, since I
now use a media player that can play H.264 encoded MKV files just
fine. :)


FLV to AVI seems to convert alot of stuff check it out. as for converting mkv to avi i use to programs ultra MKV converter but for some reason the AVI's don't work in my stand alone so after I run MKV through UMKVC I run them through FLV converter and fix whatever it fixes then they work fine in my stand alone (polaroid DVD-DVR-DVDBNR)

Excuse me for this stupid question. What do I do with an audio of with the extension of .AAC?
Virtualdubmod won't accept it.

Well, it's not a stupid question, but I have no idea to do with an .AAC audio file. Maybe convert it to PCM wave (or even MP3? But you'd lose quality that way). I wouldn't know how to do so, though. Sorry.

In truth, I haven't even looked at this guide for at least a year now. My current setup1 can easily handle MKV files with H.264 video, AAC audio, and soft subs just fine now. No need to convert to AVI with XviD anymore.

  • 1. More specifically, I got the A-110

I used the mkvextract and the avc 2 avi. I got all the files extracted and use avc 2 avi to conver the h.264 file into an avi but when I go to open it in virtualdubmod it wont work, it says I cant open it and the program crashes. and sometimes I see that stupid virtualdub need a vfw compatible codec error. Some of these mkv files just wont work while others work fine. wtf is wrong with these ones I just cant get em into avi? theres always a read error of some kind or a hard time even getting the h.264

Yes I have the newest stuff, Yes I have alot of exp with encoding and converting. Im just stuck at this part.

sir, thank you soooo much for this, though it need to go through lots of things to do, this is much more reliable than converters.. ^^ thank you sir. ^^ this way, i can be pretty sure that the subs wont be gone and i have control of the quality and size of the video and audio. thank you.. i'm excited in to doing some experiments myself.. hehe tnx again << download textsub.vdf for virtualdubmod textsub plug-in.. i dont know why but vobsub doesnt include textsub.vdf for me. ^^

Thanks. I haven't used this article in years now (in fact, I'm often doing conversions from XviD AVI to H.264 MKV/MP4 because my set-top box tends to actually perform better with H.264 encodes). Good to know that this guide is still helpful.

thanks for the wondeful guide.
However, after doing everything as per step and correctly.
Still finally my TV/DVD is not playing the .avi file.
It says video not supported.
I wonder why
Bacause the same is playing nicely on my pc. I checked the file details also. its xvid for video and .mpga for audio.
All the parameters are matching exactly with another avi file which playing without any problem.
Is it because of some new xvid codecs ?
I downloaded latest xvid codecs pack and used them to convert file using virtual dubmod
Thank for your help

i cant get avc2avi to work.

im a total noob when it comes to this stuff, would you be able to explain to me how to use avc2avi? i type in the command line in cmd but it says it's not recognized.

Merveilleux article : persistez de cette manière

MKV 2Vob is a program that does this for you... man, thank god it exist because this process would be far to much for me, I thought i would come here and post it for you guys. It's a ( i believe.

Good Luck!

Here is the direct link to the latest version.... (

Good Luck!!

Apparently, you and I wanted to watch mkv files in a dvd player. I assummed you like animes and mkv is probably the most used file format there is. I followed all your instructions and the video turned out great. But when I tried to play it on my dvd player, well, let's just say it didn't play. lol maybe my dvd player sucks ass :D any ideas? anything?

By the sounds of it, you may not have an XVID-capable DVD player. If that's the case, you'll probably have to use a different way to author the video into DVD-Video. That said, at the time I was creating actual DVD-Video discs, this guide could still be useful in that many of the tools to create DVD-V couldn't read MKV files.

I couldn't tell you where to begin with that through. I've not had to burn a DVD to watch on my main screen in a very, very long time. The Popcorn Hour A-110 simply streams videos from my file server. I still have to do conversions from codecs that are unsupported by my A-110 (like the newer 10-bit M264 modes or FLAC audio in video files), but those are handled by some scripts that I've built over time.

txheu9 cZJgi86 pladu47 ezuFH35 tmpww26 usYgt40 FPspf54 ekLDj82

Magnificent website. Lots of useful information here. Im sending it to some friends ans also sharing in delicious. And obviously, thanks for your sweat! eceebffedeee