Convert video to 3GP format.

Now I expected this to be hard. Or at least take a lot of fiddling to get right. However, it seems to be quite easy. This site has all the goodness. It requires three steps. Now assume we have a file called movie.mpeg and we want to convert it to movie.3GP. The steps required would be

mencoder movie.mpeg -nosound -ovc lavc \
-lavcopts vcodec=mpeg4 \
-vop expand=176:144,scale=176:-2 \
-o movie.avi -ofps 12

This will extract the video, scale it and reduce the frame rate. Now we need to extract the sound.

mplayer -vo null -ao pcm -af \
resample=8000,volume=+4db:sc movie.mpeg

An output file called audiodump.wav will be created that has the audio that we require. Finally we need to combine these two files together.

ffmpeg -i movie.avi -i audiodump.wav \
-b 48 -ac 1 -ab 12 -map 0.0 -map 1.0 movie.3GP

And that is that. I suppose I should add this to the HantsLUG wiki. Next I need to bundle this lot up into a script so I can then forget all about how this works 🙂

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.

Sony Ericsson K800i

Just got myself a new phone. This is the first phone that I have bought myself, and not a scrounged second hand unit. Best bit about it so far is that I can access the files on it from withing Linux. I just plugged it in and I could see a new PHONE icon on the Ubuntu desktop. Now all I need is to work out if it is possible to convert to and from the 3gp video format.

WordPress Revolution

My first blog was built using some php code that I had developed myself. It worked, but only just. Once I looked at wordpress, that seemed to be popular with others, I decided that there was not a lot of point re-inventing the wheel. I have now decided to use wordpress for myself

I will hopefully get round to integrating the style with my main site, but in the meantime, I will make do with the default

Now that it will easier for me to look after, I will try to blog more.