main index Click here for other P900 pages.


BEWARE: programming skills required! No "one-click" solutions! You've been warned!

This is the first time I experiment sending some videos to P900, and it's a demo targeted to my friends who have an Apple iPod with video support. "Hey", I'll tell them, "my P900 also shows videos and movies!" :-)


Theory

The original PacketVideo reader coming with P900 supports only a few formats: the .3GP (3GPP PSS) and .MP4 (MPEG-4), local file or RTSP-streaming.

The MPEG4 encoding can contain only the simple visual profile level 0 (different resolutions, at least up to full-screen 320×208 and more) or the old H263 profiles (profile 0 or profile 3, both on "level 10").

Audio coding is on the "Apple side" (AAC unencrypted audio) or the "AMR side" (only 8000 Hz, mono, 8 bit).

First, we should exclude the H263 encoding (the H263+ is not supported), which has only five fixed-size resolutions in 4:3 format; the most decent one is 352×288, which doesn't fit well on the 320×208 P900 screen.

To encode an MPEG4 video you need FFMPEG utility or MPlayer (which has a mencoder utility that contains the latest ffmpeg engine). Yes, there are a number of other encoding utility programs: I won't list all of them, I only want to show what I did to get some results.

Audio encoding: apparently the PacketVideo reader does not support MPEG3 layers in video files. I don't know any free AAC-encoder; I guess you can use the "copy" option of the ffmpeg audio encoding while converting from an original QuickTime video (maybe already downsampled, see below).

Also, the ffmpeg encoder can read a large variety of formats, so you don't need multiple passes (except in a few cases).


Practice

Have a first look at this example:
ffmpeg -i inputfile.avi -s 320x208 -vcodec mpeg4 -acodec amr_nb -ac 1 -ar 8000 -r 8 p900video.mp4

That is, take an input file in some video/audio format, resize it to 320×208, encode using MPEG4 for video and AMR for audio, downsampling audio to one channel and 8000 Hz; reduce the video to 8 fps and save it with the specified file name.

Resolution: 320×208 is the P900 full screen mode. This means that you have to use low frame-per-second values; in the above example I chose 8 fps, which is already too high. It seems that audio decoding sucks a lot of processing power; if you encode videos without audio, you will easily get higher fps values. It seems that to get a decent value for some MP4 conversions you may find yourself going down to 4 or 5 fps only (yeeech!)... you will need to experiment yourself on different video types; not all video files will give "bubbling" effects. Remember that the P800/P900/P910/P990 have only a 156MHz 32-bit ARM9-class processor; I worked hard to get 25fps full-screen refresh in my ZX Spectrum emulator but it didn't need any frame-by-frame video+audio decoding sessions...

320×208 is actually very similar to 16:10 movie mode. You surely will like to use exactly the same aspect ratio of the original file (for example reducing a 640×352 movie to 320×176, that is 50% width and 50% height), saving also some processing power and memorystickduo space. Remember: when output aspect ratio is not very similar to input aspect ratio, you will see the image "stretched"... (yes, you will find useful to calculate proportions before converting to MP4, to not to find too much stretching/enlarging).

Audio encoding: the AMR encoder is quite poor (suitable for ringtones and voice-recording) but will give a reasonable output in minimum space.

Using the above parameters I was able to encode some 26 minutes anime in 29 to 41 megabytes of disk space. This means that on a 128Mb memory stick duo I can store up to 80-90 minutes of video/audio in 320×208 full-screen mode (your mileage may vary!).

Sadly I need to report that for unknown reasons "bubbling" effects begin at about 700-800sec from the start of the image. I guess this happens because of the sloooooow access to the Memory Stick Duo (I think this won't happen on the faster Duo PRO of the P910/P990). I'll continue to investigate...


Some other hints

You may want to lower quality to 160-170 kbit/sec (using -b 160 for example); keeping low quality and low fps will help to get rid of the "bubbling" effects, that apparently starts after 10-15 minutes of video playback because of the slowness of the memory stick duo. Example:
ffmpeg -i inputfile.avi -ss 620 -t 80 -s 320x208 -vcodec mpeg4 -acodec amr_nb -ac 1 -ar 8000 -r 6 -b 160 p900video.mp4
(note: -ss 620 means "skip first 620 seconds" and -t 80 means "encode only 80 seconds instead of up-to-end-of-file").

Using low quality but higher frame rates (for example 12 or 15 fps) will result in frame lost.

If you have the FAAC/FAAD libraries installed (with development support headers stuff) then you can try the AAC audio encoding, for example:
ffmpeg -i inputfile.avi -s 276x208 -vcodec mpeg4 -acodec aac -ab 28 -r 8 -b 100 ~/p900video.mp4

The ffmpeg sources currently (Jan'2006) don't have the AAC support. Johan "Drakonen" reported me this (his pre-installed Gentoo Linux distribution had already ffmpeg and faac/faad libraries), adding that encoding in AAC will result in better audio quality, but more framing errors and "clicks" due to the higher computing power required. Anyways, have a try!


Compiling ffmpeg

I compiled by myself the ffmpeg source got from CVS download on the ffmpeg site. After downloading its sources, I added the AMR encoding package (extracted in the libavcodec/amr_float directory the 26104-5xxxxx.zip file found on the 3GPP support site).

Then I started its configure script with these parameters:
./configure --prefix=/sw --enable-amr_nb

(choose your favored prefix; /sw is for Fink users; default is /usr/local). After configuring, you can do make and then make install (or just move the ffmpeg executable to some directory reachable from the standard path).

The ffmpeg compiles without problems on my Apple Mac OS X using gcc 3.3 including (by default) the AltiVec optimizations.

Note: by default ffmpeg does not add support for everything (because a number of drivers aren't free source); for example, to have MP3-encoding available, you need the libmp3lame installed (from Lame MP3 encoder package) and add --enable-mp3lame option to the ./configure script.


Summary

Yes, no hassles: ffmpeg is a free encoder, and it's the only tool required to convert your favorite AVI/DIVX/MOV/etc file to an MP4 file readable by the standard PacketVideo reader on the P900.

The ffmpeg supports resizing, cropping, and a number of other nice functions; you can then resize to 277×208 (to have 4:3 ratio) or 320×208 (to have "about 16:10" ratio) your preferred videos, and enjoy them (oops) at 5 to 8 fps with 8KHz audio.

And yes: doing so means that you don't need to buy an Apple iPod with 320×240 display and video support...! :-)

(you surely won't tell you friends that playing such videos will quickly drain your battery).

Apple iPodSony Ericsson P900/P910/P990 main differences
main features: music player (AAC, MP3, etc), video player, large data storage, etc smartphone with music player (AAC, MP3, etc), video player, touchscreen, etc Apple iPod cannot (yet) place phone calls, browse the internet and use e-mail, shoot photos and videos, etc: Sony Ericsson smartphones score their first goal;
display: 320×240 color display in TV ("4:3") ratio, in "landscape" format (yup, Apple didn't choose the larger "portrait" format) 320×208 color display slightly taller than cinema/movie ("16:10") ratio, in "portrait" format; P990 has "TV ratio" and same Apple iPod resolution (but a larger display again); Sony Ericsson smartphones score another point;
storage: extra-large 30 or 60 gigabytes storage; non-expandable, but huge enough to store lots of music and video files while having a bunch of gigabytes as common USB-storage disk for your daily computer usage; out of the box they have ridicolous storage even compared to the cheapest MP3 player; P910 and P990 can be expanded to two gigabytes (the pricey Memory Stick Duo PRO cards) yeah, the Apple iPod scores its first goal
video quality: good video/audio quality and lots of formats supported almost indecent video quality (upto 180 kbit/sec at 5-8 fps max; I should experiment a little with AAC encoding, as stated above); only MPEG4 (with AMR or AAC sound; no MP3 in video streams: only P910's updated video reader can use MP3 audio encoding in MP4 videos) and 3GPP formats supported; but - wow! - you can even receive SMS messages, phone calls, etc, while watching your favourite video! hmmm... the iPod scores again!
writing your own software: no, you can't do it; iPod is sold as a player, not as a full-fledged computer which can place phone and data calls and other quiggle-giggle stuff... ;-) d'oh!! you can write your own C++ software (free or commercial), even if the operating system of the P900/P910/P990 is "closed-source"; have a look here for a Linux example; yeah, the P900 and its cousins score another goal.
to be continued...

Finally: if your friend shows his iPod photo, you can still tell him: "d'oh!! I bought my P900 on late 2003 and can watch my full-screen videos while waiting for phone calls..." :-)


A dog sleeping while... sunbathing

Sony Ericsson P900 index - send e-mail - home page