PDA

View Full Version : VDub Mod vs. AVIMuxGUI for AC3 muxing


Alcacia
18th August 2006, 19:01
VDub Mod has a lot of problems with AC3 it seems.

1. If you split an avi with vdubmod, it will chop the AC3 stream right in the middle of a frame, leaving junk at the end of one part and at the beginning of the next part.

2. if you set a delay, vdubmod will just insert junk at the beginning of the AC3 stream...this shows up as corrupt with a tool like BeSliced.

3. if you join two avi's that have been sloppily cut, you will end up with a corrupt AC3 frame in the middle of your AVI...UNLESS the junk at the the end of one part, and the junk at the beginning of the next part actually can combine to form a proper AC3 frame.

4. AC3 audio gets split across interleaves, no matter what interleave parameters you use.

AVIMuxGUI does much better:

1. if you set a delay, it inserts proper AC3 frames of silence.

2. if you join two avi's that are sloppily cut, it will delete the junk at the end of the first avi (i.e., junk data in the AC3 stream), and the junk at the beginning of the second avi, before joining the AC3 streams....in certain instances, it will insert a 32ms frame of silence at the join.

3. when muxing, the AC3 stays aligned across interleaves.

...BUT, here's the big problems with AVIMuxGUI:

It ALWAYS trims the junk off the beginning and ends of AC3 streams, even when that junk data could be combined to form a proper AC3 frame.

Also, it doesn't take into account the TOTAL amount of junk data trimmed when deciding whether or not to insert a silence frame. This comment deserves a bit more explaining, so I'll describe an interesting test I did.

*** The Experiment ***

I took a short AVI and split it into 4 segments using VDubMod. As expeced, VDubMod chopped the AC3 stream with no respect for frame boundaries.

I took these 4 segments and joined them back with VDubMod. As expected, the result was an AVI with perfect AC3 stream, since it just concatenated the AC3 segments, and the junk portions recombined to form proper AC3 frames.

Then I took the 4 segments and joined them using AVIMuxGUI. Guess what!! The resulting audio was 96ms shorter! Apparently, at each join, it decided that the insertion of a 32ms silence frame was not necessary. As you can see, these missing frames add up, though, and by the end of the clip, the audio was preceding the video by 96ms...a noticeable desynch. Just imagine if there had been even more than 4 segments!

Next, I joined the same 4 segments with VDubMod, but this time I jumbled the order of the segments as follows: 2 1 4 3. As expected, analysis of the joined AC3 stream showed junk at the beginning and 3 sections of junk data within the stream itself.

Finally, I joined the 4 segments in jumbled order with AVIMuxGUI. It was no suprise that analysis of the joined AC3 stream showed it to be perfect. What DID surprise me, however, was that the length of the joined AC3 stream was THE SAME as the length of the original AC3 stream! In other words, during this join, AVIMuxGUI inserted a 32ms silence frame at each join.

*** Concluding Comments ***

What we really want is a muxer that will analyze the beginning and ends of the AC3 streams for junk, and ask the all-important question: if the junk is simply concatenated, will it form a good AC3 frame...if the answer is yes, it should concatenate the junk...if the anser is no, it should insert a 32ms silence frame, in order to maintain audio synch.

Neither VDubMOD nor AVIMuxGUI does this kind of intelligent joining.

unskinnyboy
18th August 2006, 20:28
AC3 audio gets split across interleaves, no matter what interleave parameters you use.
This is true only with the default values. AC3 gets aligned across interleaves if you enable frame mode.

Options -> Preferences -> VDubMod -> AVI -> Enable Frame mode.

Don't worry. Once upon a time, I also thought VirtualDubMoD would never be able to align across interleaves, till squid_80 told me about this option (apparantly he had also had the same impression till someone else told him about it hehe).

Now, this was a few months ago. Armed with this new-found info, I had done some testing at that time using various combinations of VirtualDubMoD, AVI-Mux GUI, enable frame mode, disable frame mode, video @ 23.976 fps, video @ 25.000 fps & video @ 29.971 fps. What I found though was that depending on the framerate, VirtualDubMoD exhibited differing behavior when it comes to aligning vs. splitting, regardless of how we set the frame mode. But I don't remember the specifics now and even the testing wasn't fully complete yet. The whole thing got pushed away onto the back burner, for whatever reason then. If you want you can do some poking around, but yeah, that's the gist of VirtualDubMoD's behavior with AC3 frames as I saw it.

squid_80
19th August 2006, 09:09
AVIMuxGUI always sets a value of 1 for the granularity of an ac3 stream (IMO this is against AVI specs), causing problems with any editor (or player in some cases) which don't have specific knowledge of AC3.
It also seems to have problems calculating the correct number of channels in an ac3 stream (doesn't take LFE into account). This isn't very important unless you feed the avi into a vfw based program (i.e. avisynth or virtualdub) - AC3ACM will downmix, it doesn't have the option to tell the host program that there are more channels actually present in the stream than in the header.

Alcacia
19th August 2006, 16:27
AVIMuxGUI ... also seems to have problems calculating the correct number of channels in an ac3 stream

Last I checked, so did Nandub.

Oh, and please elaborate on what granularity is...or point to a reference.

SeeMoreDigital
19th August 2006, 17:22
The latest GSpot beta is only able to detect 5 channels instead of 6 channels also :scared:

squid_80
20th August 2006, 10:26
Oh, and please elaborate on what granularity is...or point to a reference.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/waveformatex.asp
The nBlockAlign field.

Zep
21st August 2006, 12:32
VDub Mod has a lot of problems with AC3 it seems.

*** Concluding Comments ***

What we really want is a muxer that will analyze the beginning and ends of the AC3 streams for junk, and ask the all-important question: if the junk is simply concatenated, will it form a good AC3 frame...if the answer is yes, it should concatenate the junk...if the anser is no, it should insert a 32ms silence frame, in order to maintain audio synch.

Neither VDubMOD nor AVIMuxGUI does this kind of intelligent joining.


the easy way to avoid all that is to just do a simple

copy /B c:\part1.ac3 + c:\part2.ac3 + c:\part3.ac3 + c:\part4.ac3 c:\merged.ac3

Then in VDudMod load the first video segment and append the rest. Now load the merged.ac3 and mux it to 64ms interleave. You get a perfect ac3 in perfect sync everytime. No junk added.

Alcacia
22nd August 2006, 05:34
the easy way to avoid all that is to just do a simple

copy /B c:\part1.ac3 + c:\part2.ac3 + c:\part3.ac3 + c:\part4.ac3 c:\merged.ac3

...


Huh? Brute-force concatenation is what VDubMod does already. What I'm looking for here is something to join avi's, not ac3's. And where is the analysis of the join frames?

What you're hinting at by mentioning the dos copy command is the really tedious and tiresome procedure that I have already done before...namely:

1. demux the ac3 streams from the avi segments.
2. join the ac3's using dos copy.
3. fix the joined ac3 stream using besliced or delaycut.
4. join the avi's in VDubmod, disable default stream, and add the fixed joined ac3.
5. save out the joined avi.

This is a very tedious process! It's what we're trying to avoid.

I actually used the above procedure until I discovered AVIMuxGUI. Once I found out that AVIMuxGUI actually *analyzed* the ends of the AC3 streams when joining, I could finally say goodbye to batch files and delaycut.

Let's face it...there's no way to get clean AC3 joins using VirtualDubMod, and one purpose of this thread is to alert people to that fact.

Zep
22nd August 2006, 14:20
Huh? Brute-force concatenation is what VDubMod does already. What I'm looking for here is something to join avi's, not ac3's. And where is the analysis of the join frames?



Not exactly. VDUbMod can do wacky stuff (Depends on your settings) a straight copy does not. I have made tons of segmented HDTV encodes and never had a problem using VDubmod to join the avi video segments and copy to join the ac3 segs then Vdubmod to mux it all. It is super easy and a bat does it all. For me it is just 1 double click.

Sure you want a do it all app but there is none (For free) that does it perfect like you and me and everyone else wants. Besides IMHO the real problem is the app used to CUT the segs to begin with. If that app kept to mod 32ms on the video side everything would be good to go since the length would be exactly the same for video and ac3 and no join analysis would be needed. Trouble is that is hard to do since people want to cut where they want! down the exact frame and since FPS affects this also it is not an easy thing to solve. With each video frame at 23.976 FPS being about 41ms you can see the problem.

Anyway, i am happy with Vdubmod. It works great for me :)


Good luck on your search.

Alcacia
22nd August 2006, 16:41
Not exactly. VDUbMod can do wacky stuff (Depends on your settings) a straight copy does not.

Okay, yes, I do think in my playing around (it's been a year or so), I recall that if the audio in the first segment is longer than the video, VDubMod will chop it before concatenating with the next segment.

If, on the other hand, the audio is shorter or equal, VdubMod will just concatenate. Obviously, in the case of shorter audio, this could lead to audio desychonization in the second half of the joined avi (assuming one is joining 2 avi's).