|Converting Video For The HTC Dream (T-Mobile G1)||Viewing Using HandBrake -- Go To|
Converting Video For The HTC Dream (T-Mobile G1) Using HandBrake
HandBrake is one of the easiest programs for encoding H.264 videos. Its greatest strength is a simple interface, which is very appealing if you don't have an in depth understanding of video encoding and want a program that just works.
Its clear from the selection of presets which come with HandBrake that it was originally designed with Apple devices and software in mind. But if you're willing to put in a little work it can be just as easy to produce video files suitable for playback on non-Apple devices like the Dream.
The down side to HandBrake's simplicity is limited capabilities in some areas. The most obvious limitation is in the area of audio encoding. HandBrake can copy Dolby Digital tracks from your source to your output file, but it can't encode them. On the other hand, if your source audio is already in AAC format HandBrake can't simply copy it to your output file. Instead it must be re-encoded, resulting in reduced quality.
HandBrake's video filters are also somewhat limited. Basic processing like restoring film frames from telecined video and simple deinterlacing are available with extremely straight forward interfaces. But if you need to do more advanced filtering, like what's often required for sources which have been improperly processed at some point, HandBrake won't be much help.
However, most of the time you probably won't need those advanced features, and HandBrake is a very solid tool in the vast majority of cases. Whether that's enough for you is something you'll have to decide for yourself.
Software Used In This Guide
HandBrake (GUI) for Windows
Installing HandBrake is simple. Just run the installer and follow the steps in the wizard until it's finished. At this point you should also install VLC so you can configure HandBrake correctly to use it.
Step 1 - Open Your Source
HandBrake can read nearly any type of video file you can think of, but how you open your source will depend on what format it is in. Use the arrow buttons on the left and right side of the video player below to see a tutorial for loading a DVD, Blu-ray or other file source.
Opening A DVD Source
If your source is a DVD, make sure to rip it to your hard drive before converting it with HandBrake. Although HandBrake can encode directly from a DVD-ROM drive if the disc is unencrypted, this puts unnecessary wear on the drive and should be avoided if at all possible.
Opening A Blu-ray Source
Blu-ray sources are trickier to open than DVDs because HandBrake wasn't designed to read the BDMV disc structure. However, HandBrake is capable reading most of the streams found on a Blu-ray disc. You may have to do some processing first to combine M2TS (MPEG-2 Transport Stream) files.
Opening Other Video Files
If your source is a video file, rather than a disc, chances are HandBrake supports it. A small, afnd incomplete, list of supported file types includes AVI, MPEG, MPG, MP4, MKV & TS files. You may run across a file HandBrake can't open, but it's pretty rare.
Step 2 - Set Output File Options
- The Dream can't read MKV files, so make sure to select MP4 from the Container dropdown list.
2. MP4 Options
- Uncheck Large File size, Web optimized & iPod 5G support.
3. Destination File
- If you enabled autonaming when you configured HandBrake, a destination folder and filename should already be selected. If autonaming is turned off, or if you wish to change the Destination settings, click the Browse button.
Step 3 - Crop & Resize
The HTC Dream has a resolution of 480×320. The aspect ratio is 1.78:1, which is the same as 16:9. That means the screen is the same shape as a HDTV and also matches the output from a widescreen DVD.
1. Automatic Cropping
- HandBrake will automatically detect any black borders around the edges of your video so it can crop them. Cropping extra pixels will result in slightly smaller video files or slightly higher quality, depending on your other video settings. Unfortunately there's no visual tool provided to double check HandBrake's findings about where the borders start and end. However, when I've compared them to what I see with my own eyes, HandBrake has always been right, so I recommend leaving Automatic Cropping on.
- If your source is a widescreen DVD you should have the Anamorphic box checked. This will allow you to encode a video which retains all the detail in the original and will fill the screen, or should at least come close. If you're starting with a HD source, leave Anamorphic unchecked.
3. Aspect Ratio
- Make sure Keep Aspect Ratio is checked. Otherwise the shape of your video may end up wrong.
- If your video has a widescreen aspect ratio, which is generally defined as anything wider than a standard definition (nearly square) TV, you can set the horizontal resolution (Width) to 480 and Handbrake will set the vertical resolution (Height) for you. If the aspect ratio is narrower than 1.5:1, such as a fullscreen TV show or full frame movie, set the vertical resolution to 320 instead and let Handbrake adjust it horizontally.
Determining Your Source Video's Aspect Ratio
If you aren't sure what the aspect ratio of your video is after cropping borders, this video will show you how to figure it out.
Step 4 - Set Deinterlacing Options
HandBrake's video filters serve two basic purposes. The first is converting interlaced video into progressive. If you have an interlaced source, this is absolutely essential since the Dream has a progressive display.
Before setting any options on the Video Filter tab, you should make sure you understand what interlaced video is. If your source video runs at either 29.97fps (frames per second) or 23.976fps, it's also a good idea to understand telecine. This video provides a brief explanation of both.
HandBrake's Deinterlacing Options
Before you select your deinterlacing options, you'll first want to visit the Video tab to set the output framerate. Set Framerate to Same As Source. Then move on to the Video Filters tab.
- Set this filter to Default if your video is interlaced, but was originally transferred from a film source.
- Deinterlacing filters attempt to combine the 2 distinct fields in each interlaced frame into a single picture. There are three settings to choose from, Fast, Slow & Slower. Although Fast will definitely decrease the amount of time HandBrake requires to convert your video, it will also tend to produce poor quality. Think of Slow and Slower as Higher Quality and Highest Quality. Just remember that each quality improvement will also result in slower encoding, hence the names.
- When set to default, Decomb performs the same deinterlacing as Slow, but with one important difference. Only frames which HandBrake detects interlacing artifacts in are processed, making it safe for sources which contain a combination of progressive and interlaced frames. It's also safe to leave this filter on at all times since it shouldn't alter progressive frames in any way.
Step 5 - Set Video Encoder Options
Go to the Video tab to set some basic video encoder options.
1. Video Format
- HandBrake can encode to either MPEG-4 ASP (XviD) or MPEG-4 AVC (H.264) format. Make sure to select H.264(x264).
2. Constant Quality Encoding
- Unless you're trying to make sure your output file is an exact size, it's best to use Constant Quality encoding. There are 2 advantages to this encoding method. It only requires the encoder to make a single pass, reducing encoding time, and it produces consistent quality throughout your video. The slider is used to adjust the RF, or RateFactor, which is a measurement of quality. Lower numbers mean higher quality. Most people the output from x264 (the video encoder used by HandBrake) transparent (visually indistinguishable) somewhere between 16 and 18. Besides lower quality, higher RF values will also produce smaller files.
3. Target Size
- If you need your video file to be an exact size, to fit on a memory card for example, you should encode for Target Size rather than Constant Quality. Simply enter the desired size for your output file and HandBrake will use as much space as possible for the video after taking audio and subtitles into account.
4. 2-Pass Encoding
- Encoding for a particular Target Size should always be done in 2 passes. Since the additional pass is only used to vaguely map out where bits should be distributed in your video, you should also check Turbo First Pass to make it as fast as possible.
Advanced H.264 Options
It's very important that you set the advanced options for x264 correctly because the Dream, like most mobile devices, only supports a small subset of H.264 features. Specifically, it's limited to the Baseline profile. Even though HandBrake doesn't give you the option to select the profile directly, you can turn off the necessary features to accomplish the same thing.
- H.264 Baseline profile doesn't support B-frames, so make sure to set this to 0.
2. Reference Frames
- This can be set to either 2 or 3. The higher the number, the more frames x264 can evaluate to determine what predictive frames (P-frames) should look like. Higher numbers also result in slower encode times. Setting it to 2 is generally a good compromise between quality and speed.
- CABAC must be turned off or else your Dream won't be able to play the resulting file at all.
4. Psycho-Visual Rate Distortion
- Always keep this set at its maximum value, meaning the slider will be all the way to the right.
5. Motion Estimation Method
- This should always be set to either Hexagon or Uneven Multi-Hexagon. The latter setting is slower, but does a better job of identifying, and therefore encoding, motion.
6. Sub-Pixel Motion Estimation
- This makes fine details a little clearer. It should be set at either 6 or 7. Since you probably won't be able to tell the difference between the 2 settings on such a small screen, you might as well set it to 6 for faster encoding.
7. No Fast P-Skip & No DCT Decimate
- These options mostly just slow down the encoding process. If you have problems with solid colored surfaces looking like they're made up of different colored bands you may need to turn No Fast P-Skip on. Otherwise leave both unchecked.
8. 8x8 DCT
- This isn't allowed in Baseline profile, so make sure to turn it off.
Step 7 - Select An Audio Track
Audio support is somewhat variable on an Dream. That's because, unlike the iPhone OS, media playback on Android is largely dependent on third party developers. Depending on the media player you use, there may only be support for 1 audio track, or perhaps 2 or more.
Watch the video for more details on different audio formats. When you are selecting your own audio tracks, keep in mind you'll need to encode them to AAC format, so you won't be able to use a DTS track. Assuming you will be listening to your video through headphones, you should also consider increasing the Dynamic Range Control setting to at least 2.
Step 7 - Encode
HandBrake will begin creating your output file when you click the Start button. The various jobs, including demuxing, filtering, encoding & remuxing into a new file, may take anywhere from a few minutes to many hours - perhaps even days depending on how fast your computer is.
Detailed Video Guides
The videos used in this guide are all taken from a series you can find on Afterdawn's official YouTube channel. Unlike this guide, they cover just about everything you can do with HandBrake instead of just the settings for encoding with the Dream in mind. Watch them here, or visit the official Afterdawn channel.