VideoHelp Forum
+ Reply to Thread
Results 1 to 5 of 5
Thread
  1. Member Vitoarc's Avatar
    Join Date
    Feb 2010
    Location
    NC, USA
    Search Comp PM
    Here are two methods to convert MKV's to AVI's, and a third to convert an mp4 that was encoded using h264. Select which method is more appropriate for you depending on how the original video file was encoded. This help file is written for anyone using Mac 10.4.11 (Tiger) that needs to convert MKV video to an AVI. However, Methods A & B will work with newer versions of OSX if iMkvExtract, which is used here to demux the original MKV, works with these later versions. Method C will work whether you are using Tiger, Leopard, or Snow Leopard as it uses MPEG Streamclip to extract the audio, and then muxing is performed using ffmpegX.

    NOTES: The following Guide was revised numerous times for accuracy. Between the three methods described below (A, B, and C) I've 100% success recoding numerous MKV's (h264) to AVI.

    METHOD (A)

    This method works when the original video was encoded with DivX or XviD. When you take the original MKV and drop it into ffmpegX, you will see "Matroska" in the Summary field for the video. This means that Method A may or may not work for you, but try this first. After recoding, if the final video is not working well, go to Method B which will work for you.

    Procedure:


    1) Download iMkvExtract 2.0 here: http://mac.softpedia.com/progDownload/iMkvExtract-Download-23338.html

    For reference, the developer page is located here:

    http://mkv4mac.free.fr/index.php?lang=en&p=log

    This great little freeware program will demux your Mkv file in the blink of an eye. ffmpegX does not demux MKV files.

    NOTE: If you want, you may download small sample Mkv files here:

    http://filespump.com/sendspace/nahid-mkv.html

    and here http://rapidlibrary.com/index.php?q=mkv+sample+720p

    2) After you demux, use Audacity (or similar program) to convert the ac3 (or perhaps aac) audio file to mp3. When you export to mp3, make sure to choose a constant bit rate (helps prevent audio sync problems later). Audacity will mix down your tracks automatically when exporting to mp3, and your tracks will be mixed down to either mono or stereo depending upon how many original tracks were contained in your demuxed audio file.

    3) Open ffmpegX. Place your demuxed MKV video (from Step 1) into ffmpegX.




    4a) For the video setting, choose MPEG4 [AVI] (mencoder). Assuming that you want to watch the new AVI on your standalone DVD player, make sure you choose a resolution and correct aspect ratio that will work with your player (688 X 288 works on my Philips player).

    NOTE: You may choose "High Quality" for a filter, but do not choose "B-frames" or your final video may be choppy when played on your DVD player.



    4b) For the audio setting, make sure to set your Audio Track to 1 (this will mute track 0 which is your original track. The original track will show up as noise if you don't do this step).

    Choose "Add audio" and then navigate to the mp3 file that you exported from Audacity in Step 2. Additionally, you may choose to add some audio gain at this point. Make sure the Audio Codec reads "MP3" and you have your "Encode audio" selected.

    NOTE: If you select "Preview" under Filters, you will NOT hear audio at this point. Also, if you have resized your video (recommended) you will not see the final size during Preview either. However, once your video is processed the audio will show up and the video will be resized correctly.




    Now select "Encode". It's that simple.




    METHOD (B)

    This method works when the original video was encoded with h264. When importing the original MKV video, the field will read "Unrecognized" (which assures you that you need to use Method B) OR in fact it may read "matroska":



    The imported demuxed video (after Step 1 below) now reads h264 (whereas at first it may have read "matroska" or "unrecognized" originally:




    Procedure:

    1) Download iMkvExtract 2.0 here: http://mac.softpedia.com/progDownload/iMkvExtract-Download-23338.html

    For reference, the developer page is located here:

    http://mkv4mac.free.fr/index.php?lang=en&p=log

    This great little freeware program will demux your Mkv file in the blink of an eye. ffmpegX does not demux MKV files.

    NOTE: If you want, you may download small sample Mkv files here:

    http://filespump.com/sendspace/nahid-mkv.html

    and here http://rapidlibrary.com/index.php?q=mkv+sample+720p

    2) After you demux, use Audacity (or similar program) to convert the ac3 (or perhaps aac) audio file to mp3. When you export to mp3, make sure to choose a constant bit rate (helps prevent audio sync problems later). This is a very quick step.

    3) Now use ffmpegX to encode your h264 video (from the demux process). For the audio setting, deselect "encode" and for the video setting, choose XviD [AVI] [ffmpeg). Note that mencoder will not work. By using XviD, you are able to resize your final video to the dimensions you choose. Assuming that you want to watch the new AVI on your standalone DVD player, make sure you choose a resolution and correct aspect ratio that will work with your player.

    I've had success using 1200-1600 kbs Video Bitrate and High Quality as an option. Do not use B-Frames as the resultant video may appear choppy.

    This step takes the most time, but it is still extremely fast.

    4) Now you will mux the exported mp3 audio from Step 2 along with the new video produced from Step 3. Again use ffmpegX, and select the mux button from under Tools. For the mutiplexing options, select Mux as AVI. This step is blazingly fast.

    5) Take the muxed video from Step 4, and select the Fix button from under the Tools tab. This will doctor/fix the AVI and will only take a few seconds.

    6) Test your new video on your DVD player. Keep it as an AVI and use your flash drive port of the DVD player for viewing. If the video freezes up, your Video Bitrate may be set too high, or it may be some other problem. Recode the entire video, one last time, using MPEG4 [AVI] (ffmpeg). This is quick!

    The resulting AVI file should play smoothly and have excellent quality. While there appears to be a lot of work involved, it's really not, and won't take much effort nor time (a 65 Mb MKV file was converted in 8.5 minutes, which includes opening/processing/saving of files/programs using a PBG4 1.33). Considering the alternatives to creating an AVI from a h264 MKV, this is a very attractive alternative indeed.


    Please see my reply to this post (below) if you are experiencing audio sync problems after this process.



    METHOD (C)

    Use this method for an mp4 that was encoded using h264:


    Step 1: Encode the video (only) of the mp4 using XviD [AVI] (ffmpeg). So make sure you deselect the "encode audio" checkbox.

    Step 2: Extract the audio from the original mp4 using MPEG Streamclip (you may increase/decrease the volume at this point, before export by clicking on "Adjustments"). Audio is extracted faster than real time so this is very fast.

    Step 3: Mux the audio from Step 2 with the video from Step 1 using ffmpegX

    Step 4: Fix the muxed avi using ffmpegX



    ==============================
    ========================
    =================
    ==========
    ====
    =

    BACKGROUND INFORMATION:

    After searching this forum and doing a lot of reading on line I've decided to start this thread for anyone still having problems and are seeking a quick, easy answer. All the solutions offered by people did not fit my needs. My requirements for finding a solution for converting MKV to AVI are the following:

    1) free (I already purchased ffmpegX and it's worth every penny)
    2) produces quality results
    3) fast processing time
    4) not extremely labor intensive to set up (i.e. no compiling just to get started)

    i) My difficulties arose when I tried to convert an Mkv video using ffmpegX (version 0.0.9y). It failed no matter what settings I choose. I was attempting to convert the MKV to AVI all at once (encoding audio and video together) and in the past I have had limited success in doing so.

    ffmegX is supposed to be able to convert MKV, and this thread verifies that: https://www.videohelp.com/forum/archive/mkv-files-t376523.html

    as someone states "ffmpegX can handle the MKV container format as input. That doesn't mean it will handle every MKV out there, though."

    I believe I've found a few methods to get ffmpegX to work every time. The trick is that the original MKV needs to be demuxed, and the process has to be done in stages.


    ii) As an alternative to ffmpegX, someone suggested using avidemux to convert the MKV. Although I've found Version 2.4.4 qt to be the best for a PPC and Tiger, I've found it to be unstable and slow in doing recodes. You may have more success using a later version of avidemux along with Leopard/Snow Leopard, but these directions are written for Tiger users, and as an alternative to avidemux.

    iii) This thread https://www.videohelp.com/forum/archive/ffmpeg-no-longer-recognizes-new-mkv-files-t370177.html suggests using Handbrake.

    However the last version of Handbrake for Tiger is 0.9.1 and this does not import MKV video.

    iv) In order to use Mkvtoolnix, one has to use an older version (which is what is needed for Tiger). To use this program, you first have to compile the library using Macports. This is rather complicated so I choose not to go this route.

    NOTE: For those of you using Snow Leopard (10.6), at least the last three versions of MKvtoolnix have been compiled for you, saving you a lot of work:

    http://www.versiontracker.com/dyn/moreinfo/macosx/23606&vid=11011175&mode=info

    v) In the same thread as before https://www.videohelp.com/forum/archive/ffmpeg-no-longer-recognizes-new-mkv-files-t370177.html someone suggests using MkvTools, but Version 1.0.2 doesn't work with this version of Tiger, and when I tried version 2.1.1, instead of being able to test the software first, as promised by the developer, I am forced to pay $4.99 first. I declined trying to use this *outdated* (for Tiger) and supposedly freeware program. Besides, why would I pay for software where user feedback reported "currently it does not seem to respect the size of the video or its aspect ratio, and in some cases cuts off parts of both the sides and the top, then incorrectly sets the aspect ratio."

    vi) The author of the iMkvExtract site suggests doing the following to convert MKV: "You have several possibilities to do so. If you have Perian already installed you can use QuickTime for re-coding the files to the desired format..." but he doesn't mention that one needs QT Pro in order to do this. I don't as I refuse to pay for QT Pro.

    vii) Next the author of the iMkvExtract site suggests "Otherwise you can also use for example VisualHub which allows re-encoding into many different formats..." but fails to mention that VisualHub is shareware and is now discontinued anyway.

    viii) Finally the author of the iMkvExtract site suggests "To re-encode in avi, you can also use the software MoKgVm2DVD" however as I explained in (iv) above, this was not a solution.


    Ahh yes, BUNNY TRAILS

    Anyway, I hope this post helps people out there who are like me. For me, it's been a "silver bullet".
    Last edited by Vitoarc; 30th Mar 2010 at 17:15.
    Quote Quote  
  2. Member Vitoarc's Avatar
    Join Date
    Feb 2010
    Location
    NC, USA
    Search Comp PM
    For supplemental reasons, I'm including the following link for anyone interested in converting MKV to AVI using Windows:

    http://anime.nickistre.net/blog_entry/anime/2007/03/03/mkv_h_264_codec_to_avi_xvid_codec_conversion
    Quote Quote  
  3. Member Vitoarc's Avatar
    Join Date
    Feb 2010
    Location
    NC, USA
    Search Comp PM
    Method B works very well, but I've just discovered the dreaded audio sync issue exists after Step 5 (Method B). I didn't notice any audio sync problem using Method A.

    I managed to fix the sync problem by using avidemux along with Audacity. Basically I used avidemux to get the EXACT video length (it measures to the thousands of seconds). I then used Audacity to "Change Tempo" (under "Effect" menu) to increase the tempo of the file, so that the end time of the file was EXACTLY the same as the time of the movie as indicated by avidemux. I then exported this audio as mp3, and this is what was done prior to muxing it back; so this step is done just prior to Step 4 (Method B). This of course is really just an extension of Step 2 in Method B.

    While this adds a few more minutes of labor, but the final video comes out perfectly synched.

    It appears that the demuxed audio from Step 1 (Method B) can be slightly longer/shorter than the video one is using from Step 3 (Method B), and this is what creates the audio sync problems.

    I tried using avidemux alone to fix the sync issue, but the fix was not as good as using both avidemux and Audacity together.

    NOTE: If you need to just trim your mp3 files, there's a shareware program (that is discontinued and now FREE) that handles mp3 files much better than Audacity. Exporting is much much quicker than Audacity. The program is called Audion and it's an editor/player. It rocks, check it out:

    http://www.panic.com/Audion/

    For my next trick, I'll pull a out of a hat.
    Last edited by Vitoarc; 25th Mar 2010 at 09:06.
    Quote Quote  
  4. Dark Lord
    Join Date
    Oct 2009
    Location
    Mumbai,India
    Search Comp PM
    just came across your thread while browsing this site...
    Have to say that i have also worked a lot on converting mkv to avi without any sync issues..the journey was really not easy for me too,as it has been with you,as seen from your posts above.
    But,last night,i finally converted an mkv file successfully to avi with audio and video perfectly in sync..I did this ONLY WITH AVIDEMUX....
    There is no need of demuxing the mkv into separate audio and video files,although i also used to do same before(while using ffmpeg),but it isn't really needed if we use avidemux
    Avidemux is really a life saver...
    Last edited by satish_j; 11th May 2010 at 04:50.
    Quote Quote  
  5. Member Vitoarc's Avatar
    Join Date
    Feb 2010
    Location
    NC, USA
    Search Comp PM
    Originally Posted by satish_j View Post
    just came across your thread while browsing this site...
    Have to say that i have also worked a lot on converting mkv to avi without any sync issues..the journey was really not easy for me too,as it has been with you,as seen from your posts above.
    But,last night,i finally converted an mkv file successfully to avi with audio and video perfectly in sync..I did this ONLY WITH AVIDEMUX....
    There is no need of demuxing the mkv into separate audio and video files,although i also used to do same before(while using ffmpeg),but it isn't really needed if we use avidemux
    Avidemux is really a life saver...
    Notice this thread was written specifically for Tiger. I am using a PPC PowerBook G4. The best version of Avidemux that I've found for this specific O/S is 2.4.4 The more recent versions were so unstable that they crashed.

    As an alternative to ffmpegX, someone suggested using avidemux to convert the MKV. Although I've found Version 2.4.4 qt to be the best for a PPC and Tiger, I've found it to be unstable and slow in doing recodes. You may have more success using a later version of avidemux along with Leopard/Snow Leopard, but these directions are written for Tiger users, and as an alternative to avidemux.
    In other words, the recodes using Avidemux are so slow it's not worth using.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!