[FFmpeg-devel] [PATCH] RoQ muxer

Eric Lasota riot
Sat Jun 2 08:09:30 CEST 2007

Reimar Doeffinger wrote:

> My hunch would be that whatever was used to create the original videos
> was so simple it just couldn't interleave them any other way
Id's encoder takes a series of TGA files and a WAV file.  You do the 
math. :)

Michael Niedermayer wrote:
> //what is proper packet ordering for roq?
The official decoder will pause after every video packet, so to properly 
start audio when the first frame is displayed, an audio packet needs to 
come before the video.

Quake 3's raw samples playback uses a 16384 stereo sample ring buffer, 
overrunning that will result in corruption for the length of the video.  
Why it winds up being silent if not enough audio data is initially 
stuffed, I still have no idea.  If the playback is underrun, then sound 
corruption will also occur.  There must be enough audio to last until 
the next frame.

I don't believe interleaving is strictly required, but I was attempting 
to keep audio as close to what the original encoder put out as humanly 
possible so I wouldn't need to worry about Q3 blowing up.  With FFMPEG, 
the way audio packets hit the muxer was much less predictable, so I 
wrote a bunch of code to keep it in line.  The audio playback was by far 
the most unpredictable part of designing the encoder, and I still don't 
understand its quirks even with the Q3 source on hand.

More information about the ffmpeg-devel mailing list