C pourtant pas dur : www.virtualdub.com ...
"1/21/2000: Attaching VBR MP3s to AVI files
A modified build of VirtualDub recently got posted on the Internet that allows you to multiplex externally encoded MP3s with a video track, to produce an AVI file with VBR (variable bit rate) audio. Although this is not an official build, it sort of works, with only one problem...
VBR audio is invalid in an AVI file.
The equation that determines audio synchronization in an AVI file is time = audio_sample * block_size / average_bytes_per_second , with block_size and average_bytes_per_second being constant over the entire AVI file. AVI does support VBR streams, but as the Canopus AVI problem showed, the dwSampleSize=0 value doesn't work for audio streams (see below). Couple that with the fact that for the Fraunhofer MP3 format, block_size = 1 byte per sample, and you can see a small problem: AVI forces a rigid relationship between bytes and time. This formula is also the only relationship -- the placement of audio blocks in the file relative to video blocks, or interleaving, makes absolutely no difference in audio sync, and this why "audio skew correction" is the only setting in VirtualDub's audio menu that makes a difference. Yes, you can have VBR audio in an AVI file, and it will play. You'll also find that the greater degree of VBR used, the worse the audio sync can get in local areas. Windows Media Player is especially sensitive to fast variation of bitrate, and you can end up with variations in video playback speed as a side effect of the VBR. I think you can see now why I've not added the ability to mux VBR audio into the mainline codebase. Please do not ask me for this feature, because I'm not going to add it.
Sharp observers will point out that MPEG layer III audio is inherently VBR to some extent. This is, in fact, the key to realizing how bad of hack MP3-in-AVI is. MP3 has three features that make it difficult to use in AVI:
Bitrates can be switched on the fly, thus modifying the frame size, since frames are always 1152 samples (MPEG-1) or 576 samples (MPEG-2).
To hit an exact bitrate at 44.1KHz, the padding bit is toggled periodically, adding or subtracting a single byte off the size of each frame.
Unused space in a frame can be used by later ones. This is called the "bit reservoir."
The Fraunhofer codec's solution is to avoid varying bitrates, to lie by saying that the compressed block size is one byte, and to silently accumulate bytes until a complete frame can be decompressed. This breaks rigid synchronization at the AVI level, but it works well enough during playback because the ratio of compressed to decompressed data is pretty regular for constant-bitrate streams. Use a VBR stream, however, and you can interfere with smooth buffering in the player. Also, this lie gives you really lousy edits, because the MP3 stream has a granularity hundreds of times worse than the 1-byte block size indicates, and the codec has to discard the fragments that remain. As a result, you can have a terrible time trying to offset the start of an MP3-compressed audio track in an AVI. I recommend not compressing to MP3 until after all your edits are done, or else you can get glitches at the edit points."
---------------
A+++ Bruce - http://www.bheller.com