Wednesday, December 31, 2008

Converting videos to play on the Sony Ericsson P1i

All the playing around with transcoders for the Creative Zen got me thinking about watching videos on my Sony Ericsson P1i. It has roughly the same size and resolution screen as the Zen, although probably less colours, and a even more limited video player.

First I tried using transcode, but quickly learned that the P1i video player likes 3GP files, which use MPEG4/H.263/H.264 for video, and AMR/AAC for audio. Both of these codecs have license/patent issues, which means they aren't built into your usual rpm files.

I then found this blog post and was inspired to try using ffmpeg. The vanilla rpm on my aspire one didn't include aac/amr, so I gave source building a try.

Install SVN, and checkout the source for ffmpeg
sudo yum install svn
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

Install amr and faac codecs
sudo yum install amrnb amrnb-devel
sudo yum install faac-devel

Configure and make ffmpeg
./configure --enable-libfaac --enable-libamr-nb --enable-nonfree
make

Convert avi file to 3gp
./ffmpeg -i /mnt/nas/somebody.avi -s qcif -vcodec h263 -acodec libfaac -ab 128000 -y somebody.3gp

Copy to phone, and play
cp somebody.3gp /media/PHONE\ CARD/video/

it works!
I found that the player couldn't handle resolutions other than qcif (176x144). More experimentation is required to see what else it can handle.

I've read that H.264 would be worth trying, and perhaps the audio rate I'm using is an overkill. This post also is interesting.

Still, I'm not that sure I actually want to watch video on the phone... so perhaps I'll just end here :)

Happy New Year!

No comments: