[theora] Add an intro to a theora file without re-encoding?

Michael Opdenacker michael at free-electrons.com
Wed Jul 22 07:02:32 PDT 2009

On 07/21/2009 06:29 PM, yorn at gmx.net wrote:
>> Thank you very much for this small script. It's a very good workaround.
>> This way, I can complete my script without putting too much stress on
>> Yorn.
> ;-) 
> Now I remember the thing with vorbis (and the reason, why i think video is easier ;-)). It is some time ago that I worked out the granule position interpreter for oggCat etc.
> However, please correct me, when I am telling something wrong: 
> The thing is, that vorbis splits audio samples into blocks of equal size (there are two block sizes, which are defined in the header). This means a file could not end "anywhere" but it must fit into these boundaries. When the vorbis encoder encodes the last packet, it sets the granule position to the last sample number, that should be played. Even if there are more samples available within the block, they will not be decoded. 
> Here is a problem in my c++ vorbis wrapper, that does not do this correctly, as it worked on block basis. I can solve this very easily ..
> But it would not help you in any way because ..
> Now the problem with concatenating vorbis files: What oggCat does is that it (in theory) deletes the End-Of-Stream marker and add the next stream as it is. So the information of the correct end position (the last sample) gets lost and the audio stream is "a bit" longer. 
> I am not sure, if there is a way to do the vorbis concatenation more clever without any reencoding!?
> If you want to concatenate and cut in "high quality" I always recommend using some programs, that do reencoding. 
Thank you very much for these details! I hope I can do without
reencoding, because my files are huge.

Anyway, I don't think I would be able to use ffmpeg2theora to do this:
when I send multiple files to its standard input, it just stops after
receiving the first file, as it things that the stream is over.

By the way, would you mind looking at a related problem with oggCat, if
you can, please? Here's what I ran:
oggCat output.ogv intro-nosk.ogv trailer.ogv

All the files can be found on

The audio stream in output.ogv sounds crappy. Both input files look all
right (sample bitrates and sampling frequencies), but generated
intro-nosk.ogv file may not be perfect ("nosk" means that I removed the
skeleton part with "oggzrip").

Could some people in this list download this
file (3M) and suggest what's wrong with its audio track, please? This
would be very much appreciated.

Thanks in advance,



Michael Opdenacker, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
+ 33 621 604 642

More information about the theora mailing list