转载自:http://thesourceshow.org/node/125
Converting Videos For The Android T-Mobile G1 Phone With Linux
I got my G1 this week and I must say I am impressed. There are a few things I don’t like, but I will save those for an upcoming podcast where I review the phone. In the meantime, if you want to check out playing video on the phone here is what you need to do. First make sure you have an “unencumbered” version of ffmpeg on your linux box. Here is a way to get this on Ubuntu. You can find it for Fedora from the Livna repositories. Now before I give you the command line goodies let’s talk a little about the capabilities of the G1. The display on the G1 is 480×320 pixels. So that is a 3:2 aspect ratio. Also, apparently there is a hardware decoder chip in the phone for H264. (Can anyone say YouTube? This is why YouTube works, but flash does not.) So H264 will be the best bet for smooth playing video. The phone supports AAC audio as well as MP3, OGG, MIDI, WAV and WMA, but we will stick with AAC for now since I have tested that and know it works. So here is the command to convert a 3:2 aspect ratio video to work on the G1. Please notethat this is a two pass process and you will have to run the same command again changing the “-pass 1″ to “-pass 2″ to get the best quality.
ffmpeg -i inputfilename.ext -aspect 3:2 -s 480x320 -vcodec h264 -b 480k -r 23.976 -acodec aac -ab 96k -sameq -pass 1 outputfilename.mp4
Here is the command for a 4:3 aspect ratio video.
ffmpeg -i inputfilename.ext -aspect 3:2 -s 400x300 -vcodec h264 -b 480k -r 23.976 -acodec aac -ab 96k -padtop 10 -padbottom 10 -padleft 40 -padright 40 -sameq -pass 1 outputfilename.mp4
And here is the command for a 16:9 aspect ratio video.
ffmpeg -i inputfilename.ext -aspect 3:2 -s 480x270 -vcodec h264 -b 480k -r 23.976 -acodec aac -ab 96k -padtop 24 -padbottom 26 -sameq -pass 1 outputfilename.mp4
Notice that we need to pad the videos that have aspect ratios which are dissimilar to the G1 so that they will not distort when we convert them. Also make sure you change the filename placeholders I put in the commands. Now plug your G1 into your computer and copy the file over. You will find a video player in the Marketplace that works quite nicely. And if you really must do this in Windows here is a nice tutorial. Enjoy!