[theora-dev] Theora encoding in FFmpeg
paul.richards at gmail.com
Sun Dec 31 13:17:17 PST 2006
On 31/12/06, Paul Richards <paul.richards at gmail.com> wrote:
> On 31/12/06, Ralph Giles <giles at xiph.org> wrote:
> > On Sun, Dec 31, 2006 at 05:56:11PM +0000, Paul Richards wrote:
> > > >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?
> > Something's getting mangled. The packet returned from
> > theora_encode_header() has 0x80,"theora",0x03,0x02,0x00 as its initial
> > bytes.
> Interesting, I'll investigate this further. See if I can figure out
> why this is getting mangled.
> > > 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.
> > The frame dimensions are stored >>4, so this should be 0x0014 0x000f.
> > The crop size is stored in two 24 bit integers though, so you will see
> > 0x000140 0x0000f0 imediately after that.
> Ok, well I'll check for these once I fix the above mangling.
I have fixed the mangling. It turns out that calling
theora_encode_tables() trashes the ogg_packet previously written to by
theora_encode_header(). This happens despite me using different
ogg_packet instances for the two calls.
To be on the safe side I am now copying out the ogg_packet data after
each theora_encode call.
I now have bare-bones encoding of theora in ffmpeg (using libtheora)!
:) My outputted avi file can even be decoded (always a bonus) by
ffmpeg back to mjpeg. :D
Thanks to everyone for the help given both here and on the related IRC
channels. I'll be back in a while to ask about having this work
reviewed and committed.
More information about the theora-dev