[theora] trying to encode/decode videos using libtheora

Ralph Giles giles at xiph.org
Sat Aug 26 22:44:46 PDT 2006

On Sat, Aug 26, 2006 at 11:34:24PM -0300, Ribamar Santarosa de Sousa wrote:

> http://opensvn.csie.org/ribamar/projects/streaming/cvaenc.c
>        is likely to be writing out the things correctly;
>        However...

This is much better. There are four packets with appropriate page 
boundaries in the headers. The first packet is obviously corrupt (it 
should start with 0x80,'theora') I don't see why it should be though. 

Maybe try dumping the packets as you get them from the encoder and make 
sure they're not corrupt before you call ogg_stream_packetin(). Then 
check for memory corruption.

You're correct you don't need to write loop on ogg_stream_pageout() when 
writing the comment and table headers. The subsequent loop on 
ogg_stream_flush() will take care of things. You don't want to do this 
with data packets because it will result in shorter than necessary 
pages, increasing overhead, but for the two header packets which it's 

You should call theora_info_clear() when you're done with ti. You may 
have been seeing a segfault because you refer to ti.width, etc. when 
constructing your YUV buffer. Just move the call to the end of the 
encode section.


More information about the theora mailing list