[FFmpeg-devel] Apache licensed AMR library, patches

Martin Storsjö martin
Wed Apr 15 18:35:54 CEST 2009


I've made a wrapper around the AMR codecs from Google Android (from a
package named OpenCore, provided by PacketVideo); this is an "as simple as
it gets" and proof of concept wrapper providing the same interfaces as
libamr-nb/wb as used by ffmpeg. (Benjamin Larsson mentioned the
availability of these codecs in October, in

Some notes:
- The ffmpeg configure scripts looks for Speech_Decode_Frame_init in
  libamrnb, even though that function actually isn't used. This should
  be changed to check for Decoder_Interface_init instead, which is the
  one that is used. (Speech_Decode_Frame_init is only used within
  CONFIG_LIBAMR_NB_FIXED, a configure option that's been removed some
  time ago.) Patch attached.
- There's no amr-wb encoder, only decoder. In order to use this from 
  ffmpeg, libamr.c needs a few more ifdefs, and --disable-encoder=libamr_wb
  is needed. Patch attached (although I'm not sure if you want to apply it,
  of if you find that it clutters the file too much).
- The license of the codec code is Apache 2.0, which unfortunately isn't
  (L)GPL2 compatible, afaik. It is compatible with (L)GPL3 though, and
  it's at least legally redistributable, in contrast to the current
- The amr-nb code seems to be quite closely derived from the 3gpp fixed
  point reference code, so the more detailed interfaces of the fixed
  point code can probably be dug out if needed.
- All the code is in .cpp files, but it can be compiled as pure C with
  minor modifications.
- The wrapper isn't binary compatible with the original libamr-nb/wb,
  but achieving binary compatibility wouldn't be hard if it is desired.

The wrapper package (not including the actual opencore code) is available 
at http://www.martin.st/software/opencore-amr-0.1.tar.gz at the moment. To 
build it, unpack, run ./fetch_opencore.sh, which checks out the opencore 
code using git and applies a few minor patches. Then just do make install 
in the amrnb or amrwb subdirectories. On ffmpeg, apply the attached 
patches and configure it with --enable-libamr-nb --enable-libamr-wb 
--disable-encoder=libamr_wb --enable-nonfree.

When this library is commonly available, --enable-nonfree wouldn't be 
needed to use this code, if some (L)GPL3 option was to be added instead. 
(Although that would probably require some way of detecting which libamr 
it actually is using, and the license thereof...)

I'm not particularly interested in maintaining this wrapper package 
though, what do you suggest me to do? Should I try contacting the 
maintainer of the current libamr-nb/wb packages and ask if he's interested 
in taking over the maintainance?

// Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-libamrnb-detection.patch
Type: text/x-diff
Size: 730 bytes
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090415/99ee67e8/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-libamrwb-ifdef-encoder.patch
Type: text/x-diff
Size: 1311 bytes
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090415/99ee67e8/attachment-0001.patch>

More information about the ffmpeg-devel mailing list