[theora] Thusnelda Setup Headers and Stream Joining

Charles Mason charlie.mas at gmail.com
Sat Aug 1 05:03:17 PDT 2009

Hi All,

I have been developing a project that uses Ogg Theora and Vorbis. As
part of it I need to join various ogg streams to make a single stream.
There are various use cases for this but lets use advert insertion as
an example. I can vary tightly control all the properties of the Audio
and Video streams, so all the input parameters in the setup headers of
the Vorbis and Theora are the same e.g. Frame size, Frame Rate &
Sample Rate.

In my experiments I have been able to successfully join various
streams by simply remultipexing the Theora and Vorbis streams in to a
single ogg stream. For this to work I had to remove all the setup
headers from all but the first stream. I also had to recalculate the
Granule Pos time codes to make these match the new position in the
stream. Also since some streams have the audio and video terminating
at slightly different points they can cause the subsistent streams AV
to become out of sync. So I had to repeat the last frame to make it
fit the audio stream more length as close as possible.

The results of the experiments were very promising. The files played
in all the common Theora players (VLC, GStreamer & MPlayer) with no AV
Sync issues. They also worked in players which determine the length of
a Theora stream accurately (by decoding the last Granule Pos). This
process is fast and efficent and has no impact on the quality of the

My questions is how will Thusnelda effect this method of joining. If I
all the input streams are encoded with the same version of Thusnelda,
will the headers will be same or will they change. My understanding is
there are structures in the headers which have been constant in those
headers in all version of Theora which may well change in Thusnelda
release. Will they be constant to one particular version of the
encoder, or do they change on a stream by stream basis.


Charlie M

More information about the theora mailing list