Act 1 Icon Act 1 Video Player

The best Android video player available!

My Experience with Videos on the G1

Unfortunately, Google and T-Mobile didn't provide a video playing application with the G1. The latest Android 1.5 release ("cupcake") also doesn't have a video player worth talking about. However, Google did provide a MediaPlayer component with the Android platform that developers can use to play videos in their own applications. Even so, it's not exactly the easiest thing to use. It only supports videos in 3gp and h264 formats, and the h264 support is limited. Also, since the G1 has limited CPU resources, it can't play videos that are encoded with large dimensions or high bitrates. The videos need to be optimized for the device, otherwise playback may be choppy or even impossible.

The major problems with the provided MediaPlayer component for playing videos are the following:

When I got my G1 I wanted to use it to play video files of TV shows that I downloaded off my TiVo HD. The raw MPEG files you can download from it are definitely not suitable for play on the G1. Since I write software for a living and I have hacker tendencies, I wanted to use a video encoding tool like mencoder to automate the process of converting the TiVo files to something my G1 can play. For those of you who don't know, mencoder is a very raw command line program with a very extensive set of encoding options. Turns out, you can make it generate video files suitable for the G1.

The secret to making videos optimized to work well on the G1 boils down to two things:

When I encode videos to play on my G1, scale/crop/pad the size of the video such that one of the dimensions matches exactly the same dimension of the G1. This prevents the G1 from having to spend any extra CPU time in scaling the video to fit the screen. Getting your video files as small as possible is also important for preserving your battery life. The less work your device has to do, the longer the battery will last.

Also, I use an encoding bitrate that looks good on the G1 screen without going overboard. Actually, I use a constant quality setting (variable bitrate) so that the quality is the same all the time but on average produces a workable bitrate.

I plan on posting my homebrew cocktail of mencoder, tivodecode, and shell scripts here later, so check back soon. But until then, I'll leave you with some mencoder command lines that I use all the time for encoding standard definition (640x480) programs recorded from my TiVo:

mencoder input_file -o output_file.mp4 -of lavf -lavfopts format=mp4 -ss 1 -vf pp=ci,scale=432:324,crop=432:320,harddup -ovc x264 -x264encopts crf=30.0:nocabac:level_idc=30:global_header:threads=2 -ofps 30000/1001 -oac faac -faacopts mpeg=4:object=2:br=128:raw -channels 2 -srate 44100 -af volnorm

Here I'm scaling the video down to 432x324 (preserving the aspect ratio) and cropping a few pixels off each edge. The full height of the G1 landscape (320 pixels) is being used here, which leaves unused space on the left and right. The cropping is important for standard def TV shows because you'll get rid of any closed captioning garbage from the top few rows of pixels. Also, you'll fill more of the width of the screen. SD TVs don't show you the whole picture anyway. The x264encopt crf=30.0 sets a constant quality video encoding that (I think) looks great on the G1 and is fully within its capabilities to play. Audio is stereo at 128 kb/s, CD quality and normalized for best listening in loud places. There are also some options keep the mp4 output within the contstraints required by the G1.

And here's the command line I use for HD programs (16:9 aspect) I pull off my TiVo:

mencoder input_file -o output_file.mp4 -of lavf -lavfopts format=mp4 -ss 1 -vf pp=ci,scale=480:270,expand=480:272,harddup -ovc x264 -x264encopts crf=30.0:nocabac:level_idc=30:global_header:threads=2 -ofps 30000/1001 -oac faac -faacopts mpeg=4:object=2:br=128:raw -channels 2 -srate 44100 -af volnorm

Notice that I use the full width of the G1 landscape display (480) which leaves letterbox areas at the top and bottom.

Getting your video optimized for the G1 allows your video playing application (Act 1 Video Player, I hope!) to spend some of the G1's computing resources on cool features. And that's what I hope to keep adding to the player.

This site was designed to be easily read on devices with small displays and limited bandwidth.

If you have any questions or helpful hints about encoding and playing videos on Android platforms, please let me know. You can email me at: android at hyperaware dot com