HOWTO: Missing Audio on Playing Back 3gp Video Files

I’ve recently reported about creating 3gp videos for playing them back with an average mobile phone. I’ve done this by using ffmpeg. Now – since my attention came onto 3gp video files, I was wandering if My Media System (MMS, a light Media Center unlike XBMC or MythTV), precisely speaking my mplayer-vdpau wrapper script was able to handle them also. To my surprise the video does play back, but audio is missing.

So my problem is, that I don’t have sound while playing back my 3gp videos, which I have recorded with my mobile phone. And I’m pretty sure there have to be sound, since I can hear it when I play the recording back with my mobile phone (Nokia 3110 Classic). I’ve also swapped the Micro-SD cards from my wife’s phone, which is a Nokia 2700 Classic. And also here, the 3gp videos had sound. My conclusion was, the problem must be somewhere in or around mplayer.
Since I knew, that 3gpp uses H.263 for video and AAC or AMR for audio en- and decoding, I had simply to check if mplayer does support these codecs:

/usr/bin/mplayer -ac help | egrep -i "(aac|amr)"
faad faad working FAAD AAC (MPEG-2/MPEG-4 Audio) decoder [libfaad2]
ffaac ffmpeg working FFmpeg AAC (MPEG-2/MPEG-4 Audio) decoder [aac]
ffamrnb ffmpeg working AMR Narrowband [libamr_nb]
ffamrwb ffmpeg working AMR Wideband [libamr_wb]

The red colored text represents the output, how it should be, after you’ve done all necessary steps described below. In your case, the faac, ffamrnb and ffamrwb line should be missing, and hence you don’t have sound, while playing back 3gp video files.

First I’ve downloaded the current mplayer trunk (revision 29664):

svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer-svn
cd mplayer-svn

Then I’ve greped for amr and aac in the configure --help output:


./configure --help | egrep "(amr|aac)"
--disable-faac disable support for FAAC (AAC encoder) [autodetect]
--disable-faac-lavc disable support for FAAC in libavcodec [autodetect]
--disable-libamr_nb disable libamr narrowband [autodetect]
--disable-libamr_wb disable libamr wideband [autodetect]

Now I knew what libraries I needed. Since libamr_xx isn’t GPL, it’s not included in the default Ubuntu repository. I’ve simply fell back onto Debian’s Multimedia Repository. I took the testing branch, by adding line below into my /etc/apt/sources.list and performing afterwards an aptitude update:

deb http://www.debian-multimedia.org testing main

I’ve installed these packages, configured and finally compiled and installed mplayer:

aptitude install libamrnb-dev libfaac-dev libopencore-amrnb-dev
./configure && make && make install

For playing back 3gp only libopencore-amrnb-dev is needed. If you intend to use AAC for mencoder in order to create 3gpp files with the AAC audio format, you’ll need also libfaac-dev. I prefer the latter one, because you don’t have to tweak your /etc/apt/sources.list, this library is in the standard repository of Ubuntu, and I guess Fedora/RedHat, SuSE and Gentoo should have them, too.

Note:

  • libamrnb-dev is only needed if you have an older version of mplayer. Revision e.g. 28348 needs libamrnb-dev, as you can see here:

    ./configure --help | grep amr
    --disable-libamr_nb disable libamr narrowband [autodetect]
    --disable-libamr_wb disable libamr wideband [autodetect]

  • Don’t forget mplayer, if you don’t use ‘--prefix= will install itself automatically to /usr/local/bin, that’s way you’ll have to call it full qualified.