[theora-dev] Theora encoding in FFmpeg
paul.richards at gmail.com
Sun Dec 31 09:56:11 PST 2006
On 31/12/06, Paul Richards <paul.richards at gmail.com> wrote:
> 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 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).
As a further note I do not see the frame dimensions (320 x 240, or
0x0140 x 0x00f0) in this packet. Looking at theora_decode_header() in
vp3.c, it definitely expects these values to be plainly visible.
Am I still correct in believing that vp3.c should be capable of
decoding theora video (and header packets) written using libtheora?
Questions regarding the header packet..
Should I be writing my own theora header instead of using
theora_encode_header() from libtheora?
Or do I simply need to munge the output from theora_encode_header() in
some way that I haven't yet figured out?
Or should I be changing vp3.c to understand the headers written by
And on a deeper level..
Why is all this special packing of the output from theora_encode_***()
into the extradata required? I naively assumed that any packing like
this would be the responsibility of the muxer... Is the packing I am
performing simply reimplementing what libogg would do?
More information about the theora-dev