About now, it’s time to decide if you want to use AAC or AMR as your preferred audio codec. Both won’t be available automatically. You have tell ffmpeg explicitly to build them, but first you have to ensure the development packages are installed. Therefore get first ffmpeg and change into this directory:
svn co svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg-svn cd ffmpeg-svn
In order to find out the package names you’ll need for the installation of both audio codecs you can perform this command in the console:
./configure --help | egrep "(amr|aac)"
It will tell you, that you need to install one of the following
You’ll soon find out, that the first two libs aren’t available in the default Debian or Ubuntu repositry. But they are available in the Debian Multimedia Repository. I’ve tried it with the Sid repository, but after installation of the libs and compilation of ffmpeg, I only got this error (see full log here):
Error while opening encoder for output stream #0.1 - maybe incorrect parameters such as bit_rate, rate, width or height
I don’t know if it is a bug, and where it can be located. I didn’t try the other Debian repositories, like experimental or stable, so they may work.
I’ve simply found out, that AAC is also working for me and my Nokia 2700 Classic.
The advantage is also, that you don’t need to mess with your
/etc/apt/sources.list file. Install the missing development library by invoking this in the command line:
apt-get install libfaac-dev
Now you can configure and build your ffmpeg:
./configure --prefix=/opt/ffmpeg-svn --arch=x86_64 --cpu=core2 --enable-pthreads --enable-gpl --enable-postproc --disable-stripping --enable-libfaac --enable-nonfree
I’m on on an Intel Core 2 system and an x86_64 architecture, so you can simply leave them out. If you find a development package, that is missing for compilation, just let me know, I’ll add it.
Now perform the obligatory
make on the command line. Either you can use ffmpeg now from the current directory, or you can install it, because we prefixed it with
/opt/ffmpeg-svn. Well – I did.
Now we’re almost there. The solutions for creating 3pg files you can find on the Internet do use a
mencoder - mplayer - ffmpeg combination. The mencoder transcodes the video stream and strips it from the sound. The mplayer dumps the audio part only, and the ffmpeg part remuxes it all together again and creates the 3pg file.
I don’t know why the are doing this, but I guess it’s due to desync of the audio. You can avoid the desync by using
-async 1, if video comes first
-vsync 1, if audio comes first
If this doesn’t help, use the value “
2” instead of “
In general the whole example must be old, since all of the examples I’ve found are using the old “
-vop” instead of “
-vf” syntax for
video filter. This leads into the “
-vop has been removed, use -vf instead.” message. Anyway, we don’t need mencoder in my example.