[Theora] concatenate ogg/theora files

David Kuehling dvdkhlng at gmx.de
Fri Dec 16 11:46:04 PST 2005


>>>>> "Rakotomandimby" == Rakotomandimby Mihamina <mihamina.rakotomandimby at etu.univ-orleans.fr> writes:

> Hi, I have multiple ogg/theora files, with different bitrate. That is
> the big problem, because I want to broadcast them using
> ezstream/icecast and the connection between ezstream and icecast is
> always lost when switching between files. They have the same
> resolution but different quality. Is there a tool to
> concatenate/normalize several files to a big homogeneous one?

In theory the ogg container should allow for just appending two ogg
files to form a new ogg file:

  cat file1.ogg file2.ogg > file3.ogg

Some players might however get confused with this kind of sequential
streams.  Concatenating the files in a way that doesn't create
sequential streams is also possible, but only if the two files to be
concatenated have the same header packets, which define stuff like the
codebooks to be used for decoding.  This differs from MPEG, where the
codebooks are fixed for all files (and not encoded in the stream).

If both files were created by the same encoding program, you should be
on the safe side.  

But I don't think that there is a program that does this kind of stream
concatenation.  If you really need such software, you might have to
create it yourself.  I'd recommend "libboggz".  It is accompanied by
some ogg muxing tools (oggzrip, oggzmerge), which you could use as a
base for creating you concatenation tool.  Liboggz is really neat.
Shouldn't take you more than some 300 lines of C code.

BTW I just realize that you might get problems with A/V sync if you
concatenate too many theora streams in that way, since there are no real
audio nor video time stamps in Theora.  With the video and audio packets
differing in their playback length, which are not multiples of each
other, you will introduce a slight A/V offset at every concatenation
point.  By dropping/stuffing audio packets, you might however be able to
keep the desync below one half of the playback time of one vorbis
packet...

The ogg container really has its problems...

regards,

David
-- 
GnuPG public key: http://user.cs.tu-berlin.de/~dvdkhlng/dk.gpg
Fingerprint: B17A DC95 D293 657B 4205  D016 7DEF 5323 C174 7D40



More information about the Theora mailing list