KristenK
4th April 2005, 14:33
I have a problem joining two avi files with AC3 audio. The movie becomes out of sync right after the time frame passes the length of the first video file. Both files play in sync when separate.
I believe the problem is caused by the video track and AC3 track of the first file don't have the 'exact' same play length. Are there easy ways to check if this is true and correct it? I'm not sure if the solution would be to cut (or add silence) to the AC3 stream, or have a delay for the second file. In either case I'm not sure what the best way of doing this is. Any help is appreciated :)
therealjoeblow
4th April 2005, 23:16
I've been joining my old AVI's for some time now, the oldest ones that were split by Nandub are b0rked just as you noticed - the audio is short in part 1 by 40ms because that's the way nandub was programmed, it discarded 1 frame of audio at the split point. Recent releases of VirtualDubMod don't do this and split encodes can be rejoined seemlessly with no further effort. However, if you are joining one of the nandub b0rked files, you need to do a little work. It took me quite some time and trial to figure out the solution, you can read some of the earlier details in:
http://forum.doom9.org/showthread.php?s=&threadid=85114
and
http://forum.doom9.org/showthread.php?threadid=85767
But, the short answer is (you were on the right track) - you need to TRIM part 1 to get audio and video durations to match before joining:
1) to determine if you have a problem, you need to check your files first, the easiest way is with vdubmod's stream report feature: load part 1 in vdubmod
2) from the streams menu, select 'Report'
3) if the files were properly split, then audio and video stream duration will be exactly the same for AC3, (they may be off by a few (up to 8 or so) ms for MP3, that's just the way MP3 splits you can't always get it to be exactly the same, but anything <10ms is ok, you can't notice that amount of desync, while 40 ms you definately will notice); you can join these in vdubmod without any extra effort by appending part 2 and resaving
4) HOWEVER - if incorrectly split, you will notice the difference in stream lengths. The only correct solution is to TRIM PART 1. If the file is 23.976fps and the stream delta is 40ms, which is usually what happens for AC3, you need to get rid of exactly 1 frame. If the delta is greater, you will need to get rid of 2 or more frames. In the stream report window, take note of the AUDIO stream length. You'll need it for reference a bit later.
5) now go back to the main vdubmod interface. On the vdubmod toolbar, set in-point to exactly the beginning of the file, then jump to the end of the file, and hit the 'back 1 frame' button. In the status area of vdubmod, take note of the new file duration. If it matches the above noted audio duration, you're in business. If it's still too long, jump back 1 more frame (keep going till the new file duration is =< audio duration as noted above)
6) now set the out-point with the toolbar button to the spot that you have jumped to
7) save the marked portion to "PART1-TRIMMED.avi" or something similar using direct stream copy
8) now you can join PART1-TRIMMED.avi to PART2.avi with no audio desync using vdubmod (when you load the trimmed part 1, check it's stream report to make sure that audio=video before appending part 2 just to be sure)
9) as a final check before deleting the source files, check your joined file by playing it from about 10 seconds before the join point (ie. final duration noted in step 5 above), right thru the join point to make sure audio doesn't squack or disappear. If it does, follow the instructions in my other post as noted above (this should happen very rarely).
One further complexity - if the original 'split' was exactly at a scene change, then you'll never notice the trimmed 1 or 2 frames. But, if the split point was in the middle of a motion scene, you might see the missed frame as a jerk. Most people don't care. It drives me nuts, but then I'm obsessive/compulsive.
In that case, I go to a little more effort by:
-trimming the first portion of PART2, from beginning of file to the first keyframe at a scene change, and saving that as MIDDLE.avi, and in PART2 from that first scene change to the end as END.AVI.
-then joining PART1(UNTRIMMED!)+MIDDLE - that yields a file that will have the 40ms audio desync for the middle portion, but that's usually just a few seconds to the first scene change, and will generally be undetectable, or at least less noticeable than the dropped frame.
-then trim the PART1(UNTRIMMED)+MIDDLE the same way noted in the numbered steps above to get that to have audio=video durations, and then join that to END.avi
Now there's no missing noticeable frames, and you usually won't notice a couple of seconds of audio desync where you pasted the first few seconds of PART 2 to PART1 (probability of there being visible dialogue is usually pretty low anyway in such a case).
Hopefully you get the idea - the choice is yours on how anal to be about this aspect, like I said, most people don't care about the 1 missing frame.
KristenK
5th April 2005, 13:38
therealjoeblow, thanks for the very detailed response. I actually think I found a better way to correct the problem now and it doesn't involve cutting video where you have to worry about finding a scene change.
I didn't know about the VDub stream report which was the most important step to start with, so that's where to begin. Once you check the first file, 1) subtract the audio length from the video length to get the ms amount of delay needed for the second file to be in sync after the first plays.
2) Use NanDub and save the ac3 streams from both files, then also save just the video streams by themselves.
3) Run each ac3 stream through BeSliced (http://www.digital-digest.com/dvd/downloads/besplit.html) to correct any errors. I found this step necessary to get the streams to be both compatible for joining and get the program in the next step to work with the ac3 streams.
4) Load the 2nd ac3 stream in AC3 Delay (http://farmi007.bei.t-online.de/) and add the needed delay time from step 1 to the beginning of the ac3 stream. (For some reason I could not get the program to simply add the delay to the end of the 1st stream).
5) Combine the 2 new ac3 streams at a DOS prompt with this command:
copy /b stream1.ac3+stream2.ac3 joined.ac3
6) Using AVIMuxGUI, first combine the video only streams. Then take the combined video stream and Mux it with the combined ac3 stream.
I tried this last night on one of the files with the problem and it worked perfectly. In my case the first file had an ac3 stream 477ms too short for the video, which gave a huge sync problem in the second half of the video.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.