Hi, I have been searching all over for a program that "converts" (not in the recoding sense) an mkv file to an avi file. Many users here and elsewhere recommended Avidemux, so I gave it a go. To see if the end-product is up to scratch I tried it (version 2.6.1) on a file. While the output avi file's video quality was exactly the same as the original mkv (half the battle won), the audio was too fast, which points to an a/v sync issue I think. Below is the info for the file:
Unique ID : 235679772993651231585771229640867026856 (0xB14E45F10E8EEF4A80B6C182690597A8)
Complete name : C:\Users\Arnold\Downloads\Dr. Strangelove.mkv
Format : Matroska
Format version : Version 2
File size : 600 MiB
Duration : 1h 34mn
Overall bit rate : 886 Kbps
Movie name : Dr. Strangelove - YIFY
Encoded date : UTC 2011-06-01 11:56:23
Writing application : mkvmerge v4.8.0 ('I Got The...') built on May 24 2011 03:12:58
Writing library : libebml v1.2.0 + libmatroska v1.1.0
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.1
Format settings, CABAC : Yes
Format settings, ReFrames : 5 frames
Muxing mode : Header stripping
Codec ID : V_MPEG4/ISO/AVC
Duration : 1h 34mn
Nominal bit rate : 852 Kbps
Width : 1 200 pixels
Height : 720 pixels
Display aspect ratio : 1.667
Frame rate mode : Constant
Frame rate : 23.976 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.041
Title : Dr. Strangelove - YIFY
Writing library : x264 core 114 r1924 08d04a4
Encoding settings : cabac=1 / ref=5 / deblock=1:-2:-1 / analyse=0x3:0x113 / me=umh / subme=5 / psy=1 / psy_rd=0.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=3 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / constrained_intra=0 / bframes=16 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc=2pass / mbtree=0 / bitrate=852 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / pb_ratio=1.30 / aq=2:1.00
Default : Yes
Forced : No
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : HE-AAC / LC
Codec ID : A_AAC
Duration : 1h 34mn
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz / 24.0 KHz
Compression mode : Lossy
Title : Dr. Strangelove - YIFY
Default : Yes
Forced : No
ID : 3
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Title : Dr. Strangelove - YIFY
Language : English
Default : No
Forced : No
In the last 24 hours I have tried using every codec in the Video Output (HuffYUV, FLV1, etc) and Audio Output (Faac, lav, etc) to see if that'll change things, to no avail. That was after I checked the "Shift" tickbox in Audio. Essentially the end-product avi file is always the same, audio-delayed mess. When I played all of them on VLC, and used Track Synchronization to "correct" the delay, it seems the audio was delayed by 600ms from start to finish. But interestingly, before my final 4 tries with Avidemux conversions, I clicked on Information and saw the duration for audio was 01:34:46.468 and video was shorter, at 01:34:46:139. The instinct would be to check "Shift" for a 329ms delay, right? Well, as I said,no matter how many times I checked "Shift", there was no change.
Please can someone help me? I've scoured these forums and have found intermittently that users have faced similar audio sync problems with Avidemux, which have never been solved. Unfortunately, Avidemux seems the most capable software for what I want: MKV to AVI conversion without necessarily recoding, to preserve quality. The bloody thing is almost there, save for the syncing issue, it'll be a shame to have to settle with re-encoding my mkv files!! Apologies for the very long post, it's my first
+ Reply to Thread
Results 1 to 14 of 14
Why do you want to re-wrap into AVI ? h.264 in AVI container can cause many problems with many software . Also AAC audio in AVI can be problematic for a lot of software as well
I've bought a new DVD player which has a USB port. The DVD player is only capable of playing avi files, so this is what I want to create. I have many other mkv files of similar resolution (720p or whatever). Do you think you'll be able to help with the problem I've presented you with?
Regular DVD players with xvid/divx support cannot play h.264 video or AAC audio
You would need to re-encode to xvid and either AC3 or MP3 audio, and resize to standard definition
You can get a blu-ray player that supports mkv natively, or a media box (e.g. wdtv, asus oplay, popcorn hour, tvix, etc...)
If you still want to convert it, you can use avidemux, but you need to re-encode. or you can use something like xvid4psp which has an "AVI hardware" preset
Not to take anything away from what poisondeathray said...... because it's doubtful the DVD player will play the AVIs you're trying to create by copying the video, but just for additional information I thought I'd point out MKVCleaver has an option to remux the video it extracts from MKV files as AVI. It's not exactly a speedy process, although it has a batch mode. It does however, work very well.
It'll also extract the audio from each MKV as a single stream. The problem is adding that audio to the AVI. I didn't think AVI even supported AAC audio? Generally I'd load all the audio into foobar2000 and convert it to MP3 once MKVCleaver had extracted it all.
The main reason I used the above method every now and then was to convert MKV video to xvid/AVI using AutoGK. Once the video is in an AVI, AutoGK can open and convert it as it normally would. When it was finished I'd use VirtualDubMod to add the converted MP3 audio to the AutoGK encoded AVI and the job was done. Or I'd add it to the AVI MKVCleaver created and tell AutoGK just to copy it. That was also so I could play the video using my DVD player, but it'd have to be resized by AutoGK to standard definition as anything over a width of 720 wouldn't play. I only went through the above process because I liked using AutoGK. Thankfully, I don't need to do that any more.
There should be lots of encoder GUIs which can convert MKV files to AVIs a DVD player will get along with. ffcoder might be worth a look as it's fairly easy to use. If you choose one of the xvid home theatre profiles, ffcoder gets all excited about the resolution and changes the resizing to DVD dimensions which seems somewhat unnecessary. After selecting an Xvid home theatre profile though, you can open the resizing filter and change it back to the usual square pixel resizing/format.
Thanks guys for the replies. The thing is, I have tried to re-encode the Video to Mpeg4 ASP (xvid4), and the Audio to MP3 (lame), which takes a bit longer, but I've tried that combination. The audio delay is still there, though!! No one has addressed the audio delay so far, so I'm beginning to think this is because there is no answer to the sync problem I started this thread about.
I'll try ffcoder and see how I get on with it. It's a shame because Avidemux was so close, yet so far.
I don't know what AVIDemux does and to be honest every so often I've re-encoded a video to find the audio has been out of sync for no reason I can see. I've just learned to fix it when it happens.
There's no guarantee the audio and video will be the same length..... for example there's a chance the audio might be 200ms shorter but only requires a 100ms delay to sync it, so worrying about lengths can do your head in. And of course the audio delay can be a negative value.
If I think the audio is out, my way of confirming/fixing it is to open the original video in MPC-HC. I also open the encoded version in another instance of MPC-HC. I play the two videos, stopping and starting one quickly if need be etc until the audio of both are perfectly in sync. When they're in sync you no longer hear a delay between the two. They'll cancel each other out a little, producing a sort of phasing effect. With both audio in sync I then watch the videos for scene changes. If they happen at exactly the same time, the audio sync for each is the same. If they don't.... I stop them and take a guess at the delay required. You can increase/decrease the delay for audio by tapping the + or - key on the numeric keypad. Then I go through the process again. It can take a few attempts but I can get the audio sync pretty much exact that way. When it is, I make a note of the delay specified in MPC-HC's status bar and apply the same delay to the encoded video.
Changing the audio delay doesn't seem to work reliably when there's more than one instance of MPC-HC running for some reason, which is why I stop both videos before adjusting the delay of the encoded version. I also change the double-click action, which switches to full screen by default. A single click pauses the video or restarts it by default, so with the double click action disabled in MPC-HC's options, it's easy to stop and start one of the videos by quickly clicking on it a couple of times.
It's generally pretty easy to specify an audio delay when remuxing. For AVI's I open them with VirtualDubMod, use the Streams/Streams List menu, right click on the audio stream in the window which opens, select Interleaving, and when that window opens I specify the audio delay. After clicking out of that you can save the AVI again, selecting DirectStream copy for the video when the "save" window opens so VirtualDubMod will just save it as a new AVI without re-encoding anything.
There's probably a few reasons why the audio delay might be slightly out and maybe they can compound sometimes to produce a noticeable delay. Maybe a frame at the very beginning not being encoded, the conversion program not accounting for an audio delay in the original file, and some programs are notorious for not actually applying a delay as such, instead they fill the beginning of the audio stream with junk data as a substitute for a delay, and all lossy encoders pad the beginning of the audio stream with non audio data which should be taken into account when converting.....
As I said though, if it's not something which happens every time I convert using a particular program but it's just a "now and then" thing, I've given up trying to understand it for fear of going mad and I just fix it when it happens. I'll admit though, 600ms is a fair bit for it to be out, but if it's consistently out by 600ms, at least it's fixable. Why it might happen with every AVIDemux encode, I have no idea.
You should be able to extract the audio from the MKV with MKVCleaver, convert it to another format with any program, and then use MKVMergeGUI to replace the old audio with the new one. Likewise you should be able to add it to the encoded video (same process for using VirtualDubMod to add it to an AVI as I mentioned previously) and as long as the original video didn't have an audio delay, they all should have the same audio sync.
Last edited by hello_hello; 19th Feb 2013 at 12:01.
I've found a more successful method, but I'm still not 100% there. I tried using MKVextractGUI to extract the audio and video, resulting in a H.264 file and an AAC (ADTS) file. Then I used AVC2AVI to mux the H.264 into an AVI file, while using WAV to MP3 to convert the AAC file into an MP3 file. I finally used VirtualDub to put the two together, and saved the result into a segmented AVI. The final AVI file did work, with no sync issues, but remember that I've still got to make the AVI have an XVID codec in order to play in my DVD player's USB port.
When I used AVC2AVI, in the bit that says h264 (default), I wrote xvid and muxed the file. The resulting AVI (which shouldn't have any sound, and doesn't) has no picture. This means the AVI VirtualDub is importing is without any picture, thus my final file will be missing the picture. Lo and and behold, when I made the final segmented AVI this second time, that's exactly what happened, the final AVI had sound but no picture. Can someone help me with using AVC2AVI to mux the H.264 file into an AVI with an XVID codec? Thanks for the replies guys!!
Last edited by awi1991; 19th Feb 2013 at 17:10.
If you want it to play on your DVD player , you have to re-encode it and resize it to SD. Period.
I already metioned this above: you can use something like xvid4psp with the AVI hardware preset
or You can use vdub if you open the video with an avs script ; or you can use vdub's mkv import plugin , or ffinputdriver (but you have to resize to SD if you want it to work on the DVD player)
Right, I've downloaded XVID4PSP and the h264>XVID re-encoding takes ages. I've tried importing the H264 stream (remember I have that from the MKVextractGUI operation from before) into VirtualDub using an AVS file, then went on Video>Compression>Xvid Codec and clicked OK. I finally went on "Save as AVI" and the thing took ages, by that I mean at least 1hr! It's the same with FFCoder from before. Does conversion from H264 to XVID always take this long?
I ask because AVC2AVI muxed the H264 stream into an AVI (with Xvid codec: as I said before, I did this by typing "xvid" in the codec box") in less than 30 mins. Granted, the resulting AVI file with the XVID codec didn't work (no picture), but how come AVC2AVI was twice as fast as VirtualDub, XVID2PSP and FFCoder? Maybe the speed is because AVC2AVI made mistakes and didn't give me any picture, meaning that if it did its job properly, it would take as long as the other 3 software applications. It makes it seem like re-encoding is a long process
Anyone?? Re-encoding from H.264 to XVID (or from any format to XVID, for that matter), surely can't be a laborious process can it?!
That's normal. Re-encoding will take many times longer than a simple re-wrap. Re-wrapping will take maybe a minute or two for a typical "movie" (not 30 minutes, something is wrong if it took that long, or it's a 5000 hour movie), but that won't work for a DVD player
Get faster hardware if you want a faster conversion
Or get a blu-ray player , media player, or HTPC so you don't have to re-encode or lose quality
AVC2AVI took 30 minutes to mux the video stream into an AVI??? Is that the 600MB video stream from your original post? I don't know what AVC2AVI was doing, but I just got MKVCleaver to extract the video from a 2.5GB MKV and remux it into an AVI. I didn't try to time it exactly, but the PC clock said 4:15 when it started and 4:18 when it finished. My hard drives are faster than average, but even if you double that......
Re-encoding speed can vary for a whole bunch of reasons, CPU speed obviously being a big factor, but one hour to re-encode a movie doesn't sound anything out of the ordinary to me. If my math is correct you'd have averaged around 36fps for a 90 minute video. Not particularity fast or particularly slow.
With the right filtering being applied when encoding to slow things down, I've slowed to 5 or 6 frames per second. Given the video itself runs at 24fps.....
If different encoders took significantly different times to encode the same thing to the same format, it's almost certainly because the default encoding settings were different. Which also means the quality of the output is different.
As poisondeathray said, the only way to get faster encoding is a faster cpu. There aren't any magic encoders.
I looked at your profile, and I don't think your encoding times are out of line at all for your hardware. I've done dvd rip encodes using handbrake advanced settings that took way longer on an i3 laptop. And I was not digging that deep into the advanced settings.