Video on my K750 via ffmpeg on linux

       
video on k750

I love the SonyEricsson K750 phone, it is a great device. From the first time I played video demo file on K750 in a shop I knew I'm gonna buy it because the video looked really good, despite the small screen. Now I have K750 over a year and I figured out it is time that I play around with watching video on it. My excuse for not doing it before was the amount of storage memory (64Mb), but 1GB sony memory stick card fixed that.

First thing I had to find out is what kind of video does it play. It can play two file formats (or file containers to be more precise) and they are .3gp and .mp4

Both containers can contain H.263 or Mpeg4 for video and AMR or AAC for audio.
For low-end and low-bandwidth use H.263 and AMR but if you want high quality then use Mpeg4 and AAC combination because it produces better quality video.

So I will use Mpeg4 as video codec and AAC for audio codec and 3gp as a file container.

Video resolution has to be 176x144. K750 has a screen resolution of  220x176 pixels but it doesn't support video larger than 176x144 :(

Framerate can be up to 30 fps but it consumes a lot of the file size and quality for video podcast isn't noticeably better so I use 15 fps.

Setting bitrate was a bit difficult because ffmpeg man page isn't updated with the changes made in the parameters. So if you want 200kbits video bitrate by the ffmpeg help page you need to set the parameter "-b 200" but they changed it without updating the help or man page so now you need to set it to "-b 200k" - for me this is a bug.

Combined audio and video bitrate should be below 264kbps or the finished video will stutter during playback.

For video podcasts I set audio to 32000 Hz, mono, 32 kb/s - you can set lower or higher audio quality but remember the maximum combined bitrate should be below 264kbps. If you are conversing something more audio intensive than speech, like music videos, than use audio bitrate of 64 kb/s.

Now for the part you are all waiting for. For converting diggnation to my K750 I used this command:

ffmpeg -i diggnation--0093--2007-04-11--large.xvid.avi -vcodec mpeg4 -s 176x144 -r 15 -b 200k -acodec aac -ac 1 -ar 32000 -ab 32 -f 3gp diggnation--0093--2007-04-11.3gp

UPDATE (for newer ffmpeg):
Last year (2007) ffmpeg has renamed codecs - so that all codec names that use external library are renamed to libfoo.
On Fedora (and other distros) if you have installed newer ffmpeg from Livna or RPMFusion repositories the command is a little different. Instead of "-acodec aac" you need to use "-acodec libfaac". So on Fedor it should be like this:

ffmpeg -i diggnation--0093--2007-04-11--large.xvid.avi -vcodec mpeg4 -s 176x144 -r 15 -b 200k -acodec libfaac -ac 1 -ar 32000 -ab 32 -f 3gp diggnation--0093--2007-04-11.3gp

I found out that variable bitrate works better and produces smaller file and higher quality file!
ffmpeg -i diggnation--0093--2007-04-11--large.xvid.avi -vcodec mpeg4 -s 176x144 -r 15 -qscale 4 -acodec aac -ac 1 -ar 32000 -ab 32 -f 3gp diggnation--0093--2007-04-11.3gp

UPDATE (for newer ffmpeg):
ffmpeg -i diggnation--0093--2007-04-11--large.xvid.avi -vcodec mpeg4 -s 176x144 -r 15 -qscale 4 -acodec libfaac -ac 1 -ar 32000 -ab 32 -f 3gp diggnation--0093--2007-04-11.3gp

I used here "-qscale 4" instead "-b 200k" for video bitrate. With this parameter you define the quality you want and not the rigid video bitrate. This is better for dynamic content - so when the video is dynamic more bitrate is given to maintain the quality but when video is less dynamic then it uses significantly less bandwidth and produces smaller files.
You need to be careful because using VBR method combined bitrate can over 264kbit/s because you are giving the encoder the option to give rise to the bitrate when it calculates it is necessary and that can cause a bit of video playback stuttering. If this happens a lot during video playback then lower the quality and bitrate by setting qscale to a higher number.

If you are using windows please try reading Converting vids for K750 using NERO recode.

Parameters for you to tweak are these:

-i # this it the name of the input file -vcodec # set this to mpeg4 or h263, depending which codec you want to use -s # this is the video size. don't change it - has to be 176x144 -r # video frame rate - experiment with this in the sane range of 10-30 fps -b # set video bitrate (in bits/s) - use the range from 100k to 200k -acodec # set "aac" older ffmpeg or "libfaac" for newer ffmpeg as the audio codec -ac # set number of audio channels; 1 for mono, 2 for stereo -ar # set audio sampling rate (in Hz) -ab # set audio bitrate (in kbit/s) -f # choose file container; 3gp or mp4 -qscale # use fixed video quantizer scale (VBR)