Android Gingerbread (2.3) on Sony Ericsson Xperia X8

AndroidThe other day, being a little bored, thoughts of getting a new phone came to me. Whenever this happens, a quick look at the price and sense returns. But that does not help with the boredom.

Another thing that makes justifying a new phone hard is the, working perfectly well, Sony Ericsson Xperia™ X8 in my pocket. But that phone is no longer supported by Sony Ericsson and is therefore not going to be upgraded past Android™ 2.1. We will have to see what we can do about that!

Not being a regular in the Android hacking world, this was a little bit of a poke in the dark. My first call was to CyanogenMod. A number of time, I have heard people being very happy with it. I seems that work has been done to support the older Xperia models, but had not made it to an officially supported phone. A number of videos on YouTube hinted that it was possible, so more effort was required.

After spending one whole evening bouncing from one forum to the next, skim reading instructions here and there, I gave up for the night. My next attempt was a little more successful. As a reminder to myself, I am going to list the steps I took to get Android 2.3.7 working on my Sony Ericsson Xperia X8. This is not a recommendation to anybody to do the same. Some steps may be missing. Doing this could brick your phone. Proceed at your own risk! Don’t blame me. etc.

Get root

The easiest way to do this is is with Super One Click. There is sure to be a manual method of doing this, but this worked here. Well it did after installing the .NET stuff as mentioned.

xRecovery

Next, xRecovery needs to be installed. My first attempt at this failed, but that was probably because the file permissions were not correct. A file manager that can make use of the root powers helps here. There is sure to be lots of options, but ES File Explorer works just fine.

Backup

With xRecovery working, do a backup. Now, as long as xRecovery does not get hosed, we can always get back to a working phone.

Anttek App Manager

Now that we have root, and have backed up our system, we can use this tool to remove some of the bloat.

GingerDX

Now download a new ROM pack, stick it on the SD card, reboot into xRecovery and load the new ROM. When I first did this, all it would do was loop the boot screen a few times, then lock. It appears that a factory reset is required. Fortunatly, that can be done from xRecovery.

Now we have Android 2.3 working and an old phone is given a new lease of life.

Portions of this page are reproduced from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.

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.