Log in

View Full Version : AC3 interleaving in AVI


len0x
8th April 2004, 14:20
The other day I was trying to think why recommended value for interleaving is 96 ms. And it turned out that I don't quite understand how audio is interleaved in AVI anyway. Consider this: 1 video frame is probably the smallest data chunk which cannot contain audio data inside, right? So 1 frames = 40ms for PAL for instance. So you can only have 40,80,120ms interleaving. Then how come values like 96ms are valid interleaving values?

P.S. Probably I don't get very simple, but important point, but I just can't figure out which :)

alexnoe
8th April 2004, 14:23
One AC3 frames lasts 32ms.

If you split AC3 frames apart, the decoders b0rk, meaning that you have to write pieces of k*32 ms.

Since the decoders are even more b0rked, k must be between 2 and 5...

The simple but important point you don't get is that no one says that the number of video frames between 2 audio blocks has to be constant.

len0x
8th April 2004, 17:05
Originally posted by alexnoe
The simple but important point you don't get is that no one says that the number of video frames between 2 audio blocks has to be constant.

still don't quite get it - do you mean that 96ms is an average and not exact interleaving ?

alexnoe
8th April 2004, 17:11
Exactly. You put one audio chunk after 120 ms, the next one after 80 ms etc. Important for AC3 is the audio chunk duration of k*32 ms, not the way it is put between the video (at least not more than for any other format...)

AVI-Mux GUI included an RIFF tree viewer. Just mux a file with some settings and look at it in the viewer, then you'll see. VD also has such a tree viewer, but it gets terribly slow on large files.

len0x
8th April 2004, 17:16
ok, that makes sense.

Another question then: does interleaving overhead is linear proportional to average interleaving ms ?

alexnoe
8th April 2004, 17:20
Overhead is 16 (Open-DML) or 24 (non-Open-DML) bytes per audio chunk. So for NanDub, the answer is yes (interleave = chunk size), for avi-mux gui, you can separately set interleave and chunk size.

If you set 96 ms in NanDub, you get 24 bytes per 96 ms of overhead.

-> http://www-user.tu-chemnitz.de/~noe/Video-Zeug/AVIMux%20GUI/en_estimate_overhead.html#overhead_avi

len0x
8th April 2004, 17:32
ok. thanks!