Create and Play 3gp files in Ubuntu

OK, so I have a nice new Video phone. I want to be able to play, edit and create the videos. The format that the Sony Ericsson phone uses is 3gp. It turns out that ffmpeg can handle these, but no sound with the version that comes with ubuntu. Here is how I went about fixing this. Please remember that a lot of of this was discovered by Google, and not really my own work.

The first thing to do is make sure that universe and multiverse are available. I used these ones.

Now we need to get the software that we want. The following commands should do that for us.

sudo apt-get build-dep ffmpeg
sudo apt-get install liblame-dev libfaad2-dev \
libfaac-dev libxvidcore4-dev checkinstall fakeroot
apt-get source ffmpeg
cd ffmpeg-0.cvs20050918
less libavcodec/amr.c

You now need to read the instructions in that source file. I decided to use the floating point versions of both, so I executed the following commands.

mkdir libavcodec/amr_float
cd libavcodec/amr_float
wget http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-510.zip
unzip 26104-510.zip
unzip 26104-510_ANSI_C_source_code.zip
mkdir ../amrwb_float
cd ../amrwb_float
wget http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip
unzip 26204-510.zip
unzip 26204-510_ANSI-C_source_code.zip
cd ../../

Now we need to make sure that all the correct bits get built. This is done by editing the rules file as follows.
Add the following lines to debian/rules, under the other confflags lines:

confflags += --enable-mp3lame --enable-faad
confflags += --enable-faac --enable-xvid
confflags += --enable-amr_nb --enable-amr_wb

We only really need the last line, but while we are at it, we may as well add the other ones as well. Continuing in the terminal:

fakeroot debian/rules binary
sudo checkinstall

When running the final command, most of the default options can be accepted. However, it may be worth changing the name to ffmpeg and setting the version to something that will keep it from getting overwritten on an update. Alternatively just set the package on hold once it is installed.

That will do for now. Later I will have a play, and come up with some recipes. The main thing that I would like to be able to do is convert from the phone to a format that plays on the computer. Then I would like to come up with some good settings for converting a saved DVBT stream for viewing on the phone.

I thought that I should admit I got most of my help from here.

4 thoughts on “Create and Play 3gp files in Ubuntu

  1. Pingback: 3gp/ .amr files? - TechEnclave

  2. Really useful! I had compiled ffmpeg before, but not in the packet-way… Thank you!
    BTW, now confflags lines should be:

    confflags += –enable-libmp3lame –enable-libfaad
    confflags += –enable-libfaac –enable-xvid
    confflags += –enable-amr_nb –enable-amr_wb

  3. failed on checkinstall:

    dpkg – warning: downgrading ffmpeg from 3:0.cvs20070307-5ubuntu4 to 0.cvs20070307-1.
    (Reading database … 174688 files and directories currently installed.)
    Preparing to replace ffmpeg 3:0.cvs20070307-5ubuntu4 (using …/ffmpeg_0.cvs20070307-1_i386.deb) …
    Unpacking replacement ffmpeg …
    dpkg: error processing /home/mbs/stuff/ffmpeg/ffmpeg-0.cvs20070307/ffmpeg_0.cvs20070307-1_i386.deb (–install):
    trying to overwrite `/usr/lib/libpostproc.so.1d.51.1.0′, which is also in package libpostproc1d
    dpkg-deb: subprocess paste killed by signal (Broken pipe)
    Errors were encountered while processing:
    /home/mbs/stuff/ffmpeg/ffmpeg-0.cvs20070307/ffmpeg_0.cvs20070307-1_i386.deb

    Why?

Comments are closed.