|2007-05-12, 19:05||Link #1|
Join Date: May 2007
MKV to MP4 - Audio out of sync
Tools being used:
To convert .MKV files over to the .MP4 container format for ease-of-use with both portable and stand-alone media devices.
After quite a bit of trial and error I finally found a set of tools, and the correct versions, that would allow for the extraction of .MKV formatted files and for re-muxing them into .MP4. However, I've run into a problem where the audio seems to be about 3 to 5 seconds out of sync.
Based upon what I have read so far this is usually an indication that VBR is being used in some fashion which is causing this issue. But, the difficulty here is that a lot of the fixes I have found pertain to applications catered more towards DVD (read: MPEG2) and/or AVI containers and not in this circumstance.
Also, there was some suggestions that mentioned adding a -FPS command to adjust the FPS may resolve the issue but no clear mention of how to find what the FPS of the MKV file was. Of course, it is quite possible I may have missed it but considering how much information was out there even finding this was somewhat of a challenge.
1. Is there a way to tell what FPS a particular .MKV file is formatted to?
2. Is there any other causes that would cause the audio to be out of sync?
|2007-05-12, 19:56||Link #2|
Join Date: Mar 2003
Location: Northeast USA
VBR refers to the audio being encoded at a fluctuating rate (variable bit rate); I believe you mean VFR, or variable frame rate.
This is the most common cause of desynchronization that I've seen. When I was fansubbing, we'd deal with it using a script that would force the framerate to our standard. It wasn't an easy process; if I remember right, we only encountered fluctuating framerates in the opening and ending sequences, so we only used the script on those segments where the framerate changed.
How to tell what the framerate is: there should be tools for this. Personally, I'd use BSPlayer, my video player - it had an extra information aspect that could tell you the framerate (roughly), which I used to determine sections where the framerate altered. If you need something with higher precision, that won't do it for you. I think VirtualDubMod should do the trick, but it's a very manual process... search around, I'd wager that there's something more automated.
Another cause that could make the audio out of sync would be if certain aspects of the audio and/or video are being dropped or prolonged. I don't remember VBR audio ever causing problems, but if you want to make sure, convert it to CBR (at least for testing purposes). I used to use CDeX for that task, but audio software isn't very exclusive and anything should do just fine.
I'd imagine that the processes that fix the VFR problem for AVI/DVD would work fine for MP4 as well; what's the issue?
|2007-05-13, 07:45||Link #3|
King of Hosers
Join Date: Dec 2005
Neither MKV or MP4 have a set FPS or framerate. Each frame has a designated timestamp which relates how long the frame is played. So there is no easy solution for this without completely re-encoding the video to a constant framerate (CFR). You can't go looking for framerates because in the end it will be useless, the only thing to look at are the timecodes.
You should be able to extract the timecodes from the MKV and remux to MP4 with them (there is a special tool to do it somewhere on doom9), which is what I am assuming you are doing now but you get the desync. However I doubt such MP4 compatible devices will even play variable framerate MP4s. It would be interesting to find out if they do, otherwise another failed attempt at "zomg ISO, it is magical industry standard". They will play on your PC though with proper software.