[Ffmpeg-devel] Need help adding new codec to libavcodec

Kostya kostya.shishkov
Mon Nov 13 13:05:34 CET 2006


On Mon, Nov 13, 2006 at 10:07:41AM +0100, Diego Biurrun wrote:
> On Sun, Nov 12, 2006 at 09:18:56PM -0800, dee_pee at xsmail.com wrote:
> > Hello.  I need to include the Lagarith Lossless video codec into the
> > libavcodec library.  How would I go about doing this?  Is it as simple
> > as putting the Lagarith source into libavcodec and then modifying ffmpeg
> > to accept it?  Thanks for your time.

There are two ways:
a) make it a library and write a wrapper
b) write a fresh new decoder (and finish codec description for MultimediaWiki:
http://wiki.multimedia.cx/index.php?title=Lagarith )

I also must note that Lagarith source is GPL'ed C++ while lavc is C and mostly
LGPLed.

Preferred solution: C, no external dependencies, LGPL.

> 
> http://wiki.multimedia.cx/index.php?title=FFmpeg_codec_howto

Alas, 'tis perceptual audio decoder example. For video decoder examples
I recommend to look at decoders vcr1.c, wnv1.c, loco.c

And here is my short guide for lavc'izing codecs:
 1. Find out how the codec is organized (i.e. what actions are taken, what
structures are used).
 2. Make codec description on MultimediaWiki (not obligatory but it helps
to understand how your codec works too)
 3. Take some existing small video decoder as reference.
 4. Place global variables (or variables used in many functions) to DecoderContext
 5. Rewrite functions after your understanding, do not use original code
unless it is extremely obscure or there is no other way to do it.
 6. Use lavc functions for common operations (bit reading, prediction)
 7. Post your code when it works.
 8. Make corrections as will be suggested by FFmpeg devs (usually that is style things
but that may also be suggested optimizations or spotted errors)
 9. When it is accepted, some developer will commit it.

> Will that be a native implementation that you intend to add to FFmpeg?
> We always welcome new codecs and Lagarith is not supported yet.
> 
> Diego
> 




More information about the ffmpeg-devel mailing list