View Full Version : VirtualDubMod desync's audio when joining files b0rked by NanDub...
therealjoeblow
9th November 2004, 04:11
I have some old encodes done and split with Nandub, in the days before VDM was either available or popular. What I've noticed now when I'm trying to rejoin them into one file to burn to DVD, is that NanDub obviously b0rked the files.
It appears that NanDub always discarded a small amount of audio at the end of the file when splitting. On average, most are around 42ms +/-. So, when checking "File...Info" you'd see that the video stream may be 1:00:00:042, and the audio stream will read a duration of 1:00:00:00.
Now, when I load file segment 1 into VirtualDubMod and then append segment 2, it appears the VDM pastes the 2 streams together independently (and seamlessly), so there is no gap in the video and no gap in the audio. But in doing so, the audio for part 2 is out of sync by however much it was short in the first file (in this example 42ms, slightly noticeable, on some files for some unknown reason, the missing audio duration is a lot more).
Is VDM capable of padding the difference and leaving the gap in audio so that the audio for part 2 starts where it should, at the same frame as the video for part 2?
If not in its current version (VirtualDubMod 1.5.10.1b2439), could that be changed for another future version (please).
Many thanks,
SleepyP
7th December 2004, 12:49
thanks for pointing this detail out. i recently moved to storing the majority of my DivX back-ups on harddisk as opposed to optical media, and in the process of simplifying & streamlining the library for organizational and aesthetic reasons, i decided to combine my multi-CD film rips back to single avi files, to "nice up" my browsing experience in Xbox Media Center. for most files, Vdub Mod worked like a charm, but i ended up with a few pesky files which just wouldn't join properly.
my solution to this issue:
-for files which caused the "improper VBR encoding" message to come up in VDub Mod, i used Adobe Audition to extract the audio and convert it to normal PCM wav files, which i then used in place of the original audio streams. i know this solution won't work properly with surround mixes, but it worked for me. after extracting the audio from a given file, i used VDub Mod to re-encode the audio into a format it was happy with (i prefer CBR mp3s myself).
-once you have files Vdub Mod will read properly, you must correct the stream length difference manually. i did this by doing a Direct Stream copy of a selected portion of the avi, using the next adjacent keyframe from the beginning and end of each file. in 4 out of 5 joins, this produced a smooth join while maintaining audio-video sync. i had only one case where i managed to snip a noticeable portion (probably 500 ms) of film out, but i'm overall happy with the results.
until a fix is introduced, you may try my methods for joining those "unjoinable" avi files. hope i save somebody some time...
therealjoeblow
9th December 2004, 17:56
I've found out now that the best solution for joining, no matter how the files were originally split, is to use the Matroska container. Its specifications allow it to handle AC3 and also VBR audio of any format (mp3, ogg vorbis, etc) properly, and audio is supposed to be muxed in using timecoding to index frames of audio with frames of video. This is timecode muxing/indexing is significantly different than frame (and split-frame) based muxing as done in AVI containers.
So, when joining to AVI, if the audio stream is of different duration than video, the audio streams are just appended (that is standard, no matter what application, I'm told), and there *will* be audio desync in the 2nd half.
However, ***provided that the muxing application strictly follows the matroska specifications*** you should be able to join to MKV any mismatched stream lengths and maintain perfect audio sync.
Note that I do NOT have confidence in VDM for this purpose, though. From my limited testing, it does not appear to strictly follow all of the required matroska specifications (one of the developers can [PLEASE] feel free to jump in here and correct me if wrong).
I do have confidence in AviMuxGui though. This is really based, however, on only one major test:
-I had a multipart avi with vbr mp3 where the audio in part 1 was 3 full seconds (3000 ms) longer than the video stream. Part 2 was 'normal'.
1) When joining to AVI with any application, the audo was way out of sync in part 2 as expected by exactly 3 seconds.
2) when joining to MKV with VDM, the audio was out of sync in part 2 but not by the same amount as in (1) above, but still way off
3) when joining to MKV with AVIMuxGui, the audio for part 1 continued 3 seconds into where the video for part 2 started, but the audio for part 2 started exactly at the same time as the video did too (ie. for 3 seconds there were 2 overlapping audio tracks while part 2 played at it's correct position and part 1 continued after the video for part 1 had ended and the video for part 2 had started).
#3 was unexpected, but upon further consideration, it demonstrates that AVIMuxGui does exactly what the Matroska specs define when joining to MKV.
So, that's the only application and container that I currently have confidence in for joining seperate AVI's.
Another option I've used is to just cut back one or two frames on part 1, resave it with VDM as 'pat1-trimmed.avi', now audio and video stream lengths for part 1 match. Then I join that with part 2 using VDM, but again to Matroska.
I'm fairly sure that Matroska can deal wih any split or b0rked audio frames at the end of part 1 that this may cause without issue - none of the dozens of files that I've rejoined this way have glitches at the join point and play thru seemlessly (AVI will have problems with some files doctored this way, I've run into some that have a loud audio squak at the join point and then lose all audio for several seconds before resuming when joining to AVI this way).
stephanV
9th December 2004, 18:31
VirtualDubMod is not actively developed anymore...
on a side note: also check out this thread... (http://forum.doom9.org/showthread.php?s=&threadid=86261) since your already considering matroska, theres a new matroska splitter (pointed to in that thread) that can read matroska files joined with copy /b file1.mkv file2.mkv output.mkv
how easy is that? :) (files dont have to have things like same format and stuff if im right)
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.