Sunday, January 02, 2005

Motorola A768i video encoding

I wanted to be able to watch videos while commuting via public transport. So, as previously, gaining access to the filesystem via SMB over TCP/IP over USB:
sudo insmod usblan.o vendor_id=0x22b8 product_id=0x600c
sudo ifconfig usb0 192.168.1.2
mkdir /tmp/a768i
sudo smbmount //192.168.1.1/home /tmp/a768i -o uid=$USER,gid=$USER

Then to re-encode and transfer:

ffmpeg -i infile -s qcif -r 12 -ac 1 -ar 8000 -b 30 -ab 12 outfile.3gp
cp outfile.3gp /tmp/a768i/myMedia/


(ffmpeg's output could be sent directly to the filesystem mounted from the phone, but it appeared to me that this made the entire operation very slow. Perhaps ffmpeg is performing small, unbuffered writes and smbfs isn't coping.)

I use the ffmpeg options suggested by James Bowman, note in particular that the ffmpeg build needs the amr/3gp support built in. Follow the instructions in amr.c in the source tree.

When playing the result on the phone, using the media player directly (add 3gp streams to the playlist) provides one compelling feature over opening a single stream from the file manager: when the media player is playing videos from a playlist, tapping the video image makes the video fullscreen, doing so with a video opened from the file manager does not.

Note that the player's startup time lengthens as the stream gets longer, to the point where a stream with a length beyond some threshold (20 minutes?) won't open at all. Chopping longer streams up with mpgtx (into, say, five minute chunks) appears to work, but some amount of damage is done to the resulting streams.


Technorati: