[FFmpeg-devel] AMR-WB+ support in Ffmpeg

Igor Gueths igueths
Mon Dec 15 08:07:16 CET 2008

Hi all. I was attempting to add AMR-WB+ support into my working copy of R-16140;
however, my modifications did not work as expected, and I wasn't sure if I had
missed anything along the way. I am as yet not too familiar with the current
Ffmpeg API, which may have something to do with it. Up to now, I have done the
I downloaded the reference code for TS-26.304 from
http://www.3gpp.org/ftp/specs/archive/26_series/26.304/26304-700.zip. After
extracting the file, I successfully built a shared library (I called it
libamrwb.so.1.0.0 for testing purposes
 used to build the library was located in the c-code/lib_amr directory. After
building the library, I started diffing the AMR-WB+ code against the original
AMR-WB floating point codec, by starting with dec_main.c. I found that a lot of
the function calls and variable declarations were identical, so I went ahead
with trying to link Ffmpeg against the new library. Before I could attempt to
recompile Ffmpeg though, I found that configure complained about Libamr_WB not
being found. In looking through the undefined symbols, I found that these were
gain_hf_ramp, oversamp_12k8, smooth_ener_hf, and soft_exc_hf. I found references
to these in dec_util.c, and found that they had only been prototyped, but had
been called in the file anyway; therefore, removing the prototypes and
function calls, rebuilding the library, and copying it back into place along
with the headers fixed the problem (configure was able to compile a test program
this time around). Before running make though, I had taken a statement out of
libavcodec/libamr.c, as shown in this diff.
libamr.c.orig       2008-12-14 02:17:26.948370518 -0500
+++ libamr.c    2008-12-14 02:42:31.849369919 -0500
@@ -643,12 +643,6 @@


-    if(avctx->channels > 1)
-    {
-        av_log(avctx, AV_LOG_ERROR, "amr_wb: multichannel decoding not
-        return -1;
-    }
     return 0;

Make ran ok; I got the Ffmpeg binary reinstalled, and everything looked to be
ok. However, when I finally went to decode my test.3gp file, whose audio is
encoded in AMR-WB+, I got:
ffmpeg -acodec libamr_wb -i test.3gp test.wav
FFmpeg version SVN-r16140, Copyright (c) 2000-2008 Fabrice Bellard, et al.
  configuration: --prefix=/usr --enable-gpl --enable-libamr-wb
--enable-libamr-nb --enable-libfaac --enable-libfaad --enable-libmp3lame
--enable-libspeex --enable-libvorbis --enable-libx264 --enable-libxvid
--enable-nonfree --enable-ffmpeg
--enable-shared --enable-libgsm
  libavutil     49.12. 0 / 49.12. 0
  libavcodec    52. 6. 3 / 52. 6. 3
  libavformat   52.23. 1 / 52.23. 1
  libavdevice   52. 1. 0 / 52. 1. 0
  built on Dec 14 2008 20:09:33, gcc: 4.1.2
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.3gp':
  Duration: 00:00:02.40, start: 0.000000, bitrate: 21 kb/s
    Stream #0.0(und): Audio: libamr_wb, 6464 Hz, stereo, s16
Output #0, wav, to 'test.wav':
    Stream #0.0(und): Audio: pcm_s16le, 6464 Hz, stereo, s16, 206 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
Multiple frames in a packet from stream 0
Multiple frames in a packet from stream 0
Multiple frames in a packet from stream 0
I keep getting that message indefinitely, and my test.wav output file keeps
growing with presumably null bytes. 

Did I in fact miss something when attempting to link against my test AMR-WB+
library? Perhaps there is more that needs to be done in libavcodec/libamr.c to
get the decoding working properly? Or, is AMR-WB+ already supported somewhere,
and I just have not found the correct patch yet? Any pointers or advice that you
may be able to provide with regards to my above process would be appreciated.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081215/56d0ebe0/attachment.pgp>

More information about the ffmpeg-devel mailing list