[Ffmpeg-devel] Re: Re: [theora-dev] Theora encoding in FFmpeg

Paul Richards paul.richards
Sun Dec 31 18:29:37 CET 2006

On 30/12/06, Ralph Giles <giles at xiph.org> wrote:
> On Sat, Dec 30, 2006 at 05:53:27PM +0000, Paul Richards wrote:
> > [theora @ 0x3c9554]Invalid extradata!
> > [theora @ 0x3c9554]Unknown Theora config packet: 50
> > [theora @ 0x3c9554]4376 bits left in packet 32
> This is really for someone who knows ffmpeg to answer, but looking at
> the header unpacking code in libavcodec/vp3.c I don't seen any of the
> xiphlacing() stuff. The headers appear to be packed in the extradata
> using a 16 bit length, followed directly by the body data, followed
> by the length of the next packet, and so on.
> It's throwing the "Invalid extradata!" because it's not finding the
> theora magic starting at extradata[2] like it expects.
> Try inverting that code and see if it works better. I guess it's
> using different packing for the theora and vorbis headers.

Hi, your analysis indeed makes sense.  I have rewritten my packing of
the ogg_packet structs into the extradata field.  I now have a 2 byte
size, then the data for the first packet, followed by 2 byte size,
then data for the 2nd packet, and so on.  I do this for the 3 packets
I believe need to be packed into the extra data (header, comment,

Decoding in vp3.c still chokes however.  The returned packets from
theora_encode_comment() and theora_encode_tables() have the 0x81 and
0x82 prefixes as vp3.c expects.  The output from
theora_encode_header() however does not start with 0x80 as vp3.c
expects.  Does anyone know why, or what I should put there instead?

The actual output returned by theora_encode_header() is:
5B D5 B2 01 00 00 00 00 20 E0 B2 01 10 00 18 B5
A9 49 4A 10 73 9C E6 31 8C 52 94 A4 21 08 31 8C
62 10 84 21 08 40 00 00 00 00

I also note that this packet does not contain the string "theora" as
vp3.c expects to find (and skip over).

Paul Richards

More information about the ffmpeg-devel mailing list