As a follow up to my previous posts about the G1 Android phone from T-Mobile (and Google!), and from a personal interest, I wanted to gather as much information about the phone’s video capabilities as I could. Â In general, there has not been much information available about the detailed video specifications of the G1, which has proven somewhat frustrating to those people interested in using it as a portable viewing device.
At the basic level, the G1 can decode the h.264
codec in .mp4 and .m4v container formats. Â If you are familiar with iPod/iPhone video capabilities, you should recognize those specs, as they are pretty close to what Apple is using. Â And that is likely not a coincidence, as my guess is that video was somewhat neglected in the G1′s development and choices were defaulted to an already established format. Â I assume that video as a category was overlooked for a number of reasons: unlike the iPhone with iTunes, there is no established commercial entity selling video content for the G1. Â But probably more important is the fact that Android isÂ a platform targeted for a number of different hardware devices, and not just phones but MID’s, netbooks, etc. It probably did not make a lot of sense for the Android developers at Google to put a lot of time into a video format that may only be specific one device, the G1. Â And from the other direction, the actual manufacturer of the phone, HTC, I suspect probably handed everything over to Google, since video can be something of a headache for phone makers without a lot of expertise in this area. Â In other words, G1 users were kind of left on their own when it comes to video, something pretty clearly shown by the fact that the phone did not even come with a native video player application! Â A couple popped up almost immediately, but they are not particularly sophisticated or polished.
So, reaching back to my days with the DivX Certification
lab, I devised to determine what, in fact, the video capabilities of the phone actually are and then to come up with an encoding profile that would take the most advantage of what the G1 offers. Â I created dozens of test clips with a wide variety of encoding parameters and tried to play them on the phone. Â Once I had learned what the G1 can and cannot play, I started looking at which options provided the best compression compromise between size of file, quality of image, and speed of encoding process. Â Dozens of PSNR and SSIM tests later, I had some preliminary answers. Â Usually, a compressionist can only have two of the three (quality, size, and speed) but must make sacrifices on the third. Â In my case, I favored quality and speed, without too much attention paid to size since with the G1 we are not limited by a specific medium size (i.e. we are not trying fit a file on a 700MB CD or something similar to that. Â A G1 user can fit however much video they want on to whichever size microSD card they have. Â I recently purchased an 8GB card from Fry’s
for less than $20, which provides a great deal of space and does not make size concerns primary for me. Â Your mileage may vary, of course.
It turns out that the G1′s capabilities are pretty similar to later generation iPods, iPhones and Zunes. Â H.264 video on the G1 needs to conform to the Baseline Profile and the 3.0 Level, which govern some of theÂ impermissibleÂ encoding options like CABAC and B-Slices, that are powerful options but also drastically increase the complexity of the file and the power needed to decode the video content. Maybe even more crucially, G1 video has to be follow very strict resolution limits, as no video can be wider than 480 pixels across and no higher than 368 pixels. Bitrate does not appear to be nearly as strict. Â I’ve gotten the G1 to play files with surprisingly high bitrates, up to 2000 kbps, but that is generally way overkill for files with sub-SD resolutions.
In order to make my findings useful, I created a profile for the encoding application MeGUI
, considered to be the pre-eminent solution for high quality encoding of h.264 video (using the amazing x264
implementation) into .mp4′s or .mkv’s (mkv, the matroska
container format is the accepted standard for high def x264 video among current file traders but is not currently supported on the G1). Â Barring any hidden bugs I’ve missed, myÂ G1-Android profile
should become available for MeGUI auto-updates in the future, or you can download and install it yourself right now. Â I also checked with the lead developer of x264 to make sure the profile made sense from a compression standpoint, so I am fairly confident in it. Â But test it out for yourself and see if it meets your particular needs. Â If you are not interested in using MeGUI, you can just read the profile as an XML file and take the encoding settings and apply them manually in whichever application you prefer (Handbrake, Ripbot, etc.).
One reminder, when using MeGUI you will need to create an Avisynth script first, in which you will need to re-size the video to Â 480×368 or below. Â You should also crop and de-interlace the video if necessary at that stage. Then MeGUI can use the G1 Android profile to do the actual encoding.
You will also notice I did not say much about audio, but that is pretty clear for the G1 encoders should stick with MeGUI’s Nero AAC LC 96 kbps profile. Â That will be more than sufficient for portable watching, imo.