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

Igor Gueths igueths
Tue Dec 16 06:04:08 CET 2008


Hi.
On Mon, Dec 15, 2008 at 11:17:53AM +0100, Benoit Fouet wrote:
> Hi,
> 
> On 12/15/2008 08:07 AM, Igor Gueths wrote:
> > 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
> > following:
> > 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).
> 
> AMR support in FFmpeg is done through libamr [1] which is included in
> most distros today (libamrnb-dev and libamrwb-dev), that's why configure
> checks for their existences. If you build it manually, you have to make
> it possible to locate it.
> Also, AFAIK, libamr does not support WB+ at the moment...
> 

I see what you are saying. So in this case, it is probably better to handle WB+
support within the existing libamr wrapper library, in which case I will contact
the developer, to see if there is anything I need to absolutely keep in mind
before attempting an integration of WB+ into that library.
>
> >  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 @@
> >
> >      amr_decode_fix_avctx(avctx);
> >
> > -    if(avctx->channels > 1)
> > -    {
> >   
> 
> just changing the test should be enough, no need to remove it completely
> 
> > -        av_log(avctx, AV_LOG_ERROR, "amr_wb: multichannel decoding not
> >          supported\n");
> > -        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
> >   
> 
> can you share this sample (as in uploading it to mplayer ftp) ?
> 

Sure. I have uploaded a sample. The file itself is called amr-wb+_encoded.3gp,
and I also wrote up a brief text file describing the problem; it is called
README.amr-wb+_encoded. Both files are located in
/MPlayer/incoming/amr-wb+_encoded. Thanks.
>
> > 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
> >   
> 
> the sampling frequency seems weird.
> 
> > 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?
> 
> I guess there is more to do, yes (even though I've not investigated)
> 
> >  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.
> > Thanks!
> >   
> >   
> 
> Ben
> 
> [1]: http://www.penguin.cz/~utx/amr
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> 

-- 
Igor
-------------- 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/20081216/9a1a65d9/attachment.pgp>



More information about the ffmpeg-devel mailing list