Archive for the 'How-To' CategoryPage 2 of 5

How to Fix Washed-Out H.264 Video


In the previous article, I mentioned that I encountered a serious problem when exporting the “Wheels, Jets, & Rails” travel video for internet distribution. If you export your video with Quicktime, you may have run into this brightness bug without realizing it. Simply put, exporting video as H.264 in Quicktime artificially brightens (or lightens, depending on who you ask) your video which makes it look very washed out and unprofessional. Though some scenes aren’t affected by this bug as much as others, it reduces the overall quality of your video. For instance, the washed out effect isn’t as visible in a snowy scene, but it’s very pronounced on a summer scene. During this article, I will assume that you already have Quicktime Pro since exporting video is a Quicktime Pro feature.

That Darn Gamma

Washed out video comparison

No matter what I did, the resulting H.264 video was too bright, which is what happens when the gamma correction is set too high. (If you’re curious how gamma works, Wikipedia has an excellent description of Gamma Correction.) I wondered if using the MP4 filetype was causing the problem, but it wasn’t. Whether exported in an .mp4 or a .mov file, the resulting file was artificially brightened. To demonstrate this, I’ve used source video for an upcoming video to recreate the problem in the thumbnail on the right.

I did some research and discovered the H.264 Gamma thread on Apple Discussions where I learned that Quicktime’s H.264 encoder has had this gamma bug for about 3 years, and Apple has yet to fix this problem. Apparently, it’s caused by Quicktime forcing H.264 video to a 1.8 gamma level. There is a way, which is outlined on the thread, to correct this problem without rendering video again by using alpha transparency, but that only works on MOV files and doesn’t preserve hinting (i.e. the ability for you to start watching a video before its finished downloading).

I also heard that VisualHub does not have this problem, so I downloaded the trial version and began a series of experiments to find out what setting was best. An article from DearCali.com was very helpful, but after trying many combinations in VisualHub, the gamma problem remained in every H.264 video I exported. (Yes, even after forcing ffmpeg, you geeks.) So I did what I should have done in the beginning, I manually applied a brightness filter in Quicktime.

As far as I know, this is the most straightforward, universal, and foolproof solution to this problem.

How To Counteract the Gamma Bug

To counteract this problem, you only need to add one step your normal process. (See “How to Encode a Video for a Podcast” for specific instructions on how byteful video is exported.) Once you have your final video, open it up in Quicktime and export the movie as “Quicktime Movie” again. It’s easy to make a mistake that would result in the loss of quality here, so follow these steps closely:

  1. Click “Settings” and set your Compression Type to “Apple Intermediate Codec”, and make sure your Frame Rate is set to “Current” FPS. Click “OK”.
  2. Filters window screenshot
  3. Now click “Filter”. As you can see, there are many filters that you can apply to a video. Choose “Brightness” and pull the brightness to the left until it says “-7″. You may want to experiment with how much darker you want it be, but in my experience “-7″ seems to be just the right balance. Click “OK”.
  4. Make sure “Sound” is checked, otherwise you won’t have any sound! Then under “Sound” click on “Settings”. The “Linear PCM” format works, but “Apple Lossless” is a smaller file so I use that. Click “OK”, and click “Save”!

The Final Export

Corrected video comparison

Exporting video in Apple Intermediate Codec is much faster than most video codecs, and this is by design. This codec was designed to be an intermediate codec to work with between computers and video cameras, without having a huge file size like most DV codecs.

Once the export is done, try exporting to H.264 again. The settings outlined in “How to Encode a Video for a Podcast” result in the most compatible and highest quality video I’ve been able to achieve with the H.264 codec. As you can see, the resulting file is nearly indistinguishable from the original.

Do you have a suggestion on how to improve this article? Or have you found a better solution to this problem? I’m open to suggestions in the comments.

2008.09.21 Addendum: It’s been brought to my attention that using Compressor 3 produces similar results as the above procedure, however I have not verified this. As always, test both methods to see what works best for you.

How to Encode Video for a Podcast


It’s occurred to me that some of you may be interested in how to create your own high quality web video. I’ve already explained how I create a widescreen movie without an HD camera, but that article did not go into depth about exactly how I encode my video for internet delivery. Much of video encoding is considered a “black art” because different video genres require different levels of data, as well as the dizzying amount of options that most video codecs (or coder/decoders) have. Constant motion through a forest would require a higher rate of data per second than someone talking in front of a stationary background, for example. Creating web video doesn’t have to be difficult, though. Here’s a brief look at how a byteful video is dealt with after its edited.

The Platform: Blip.TV

In the early 21st century as I write this, there are a vast array of places available for content creators to upload their video. The most obvious choice would be YouTube because of its popularity. There is a Byteful Video account on YouTube, but while YouTube is strong in its community, its video quality and flexibility are inferior to many other services.

Byteful Video’s primary video distribution site is Blip.TV because it provides a wonderful and free way to publish and syndicate your own video podcast, what I refer to as a netshow. Blip.TV refers to itself as “blip”, so henceforth I will refer to it as such.

Blip’s strength lies in its flexibility. When a new video is uploaded, Blip automatically creates a Flash video version of the content which is the same format YouTube uses. Flash video is preferred because Flash video works on a wide range of computers. Blip also allows for a customizable show player, which is featured on the Byteful Video page, and even provides a sidebar widget. However, the most important feature is blip’s easy to use RSS syndication. As mentioned in The Importance of RSS, the video feed provides an easy way to be notified of new videos from Byteful Video, and if you add the RSS address to a podcast aggregator such as iTunes or Miro player, new videos will be automatically downloaded as they are released – the basis for the podcasting revolution.

Some of the internet’s best netshows use blip, including Wallstrip, and Mahalo Daily. Even one of my very favorite netshows Beachwalks.tv, who recently featured this site in an episode, uses blip to host its shows. And once again, I’d like to thank Beachwalks for their support. If you want to experience a bit of the Ahola Spirit, I suggest you check them out.

The Key Ingredient for Quality

To ensure quality in online video, the key is understanding how to properly compress the video. With the sheer complexity of most video codecs, there are plenty of technical settings to consider. Many people sidestep this complexity by using iMovie 6’s “Share” menu presets because the resulting video is actually quite good. However, to get the best quality per bit, there is an “expert” option as well. The main issue at hand, and the reason codecs were invented, is to balance a small file size with quality. Finding the sweet spot between a small file size and great quality takes time. Here is how a byteful video is exported: In Quicktime player or iMovie (both use the same encoder), export the movie as “Movie to MPEG-4″. This container is preferred because compatible over a wide range of devices. Then click the “options” button and set these settings:

Byteful Video Settings

- In the “Video” tab -

Video Format: h.264 (most efficient video codec for the web)
Data Rate: 1500 Kbps, Optimized for Download
Image size: 640×360 for widescreen, 640×480 for fullscreen
Frame rate: Current
Key frame: automatic (best to choose auto with h.264, it’s very smart)

• Click the Video options button and choose:

Encoding Mode: Best Quality (multi-pass) (which looks much better)
Restrict profiles to: Baseline (which makes it compatible with all iPods, as long as you’re using 1500kbps data rate and not much higher)

• Click “OK”

- In the “Audio” tab -

Audio Format: AAC-LC (music)
Data Rate: 128kbps (can be set it lower if there is no music)
Channels: Stereo
Output Sample Rate: 44.100khz
Encoding quality: Best

- In the “Streaming” tab -

• Check “Enable Streaming” and leave the numbers as they are (this allows your movie to download as it’s playing. this is also known as “hinting.” go figure.)

Encoding Takes Time

Click “Okay”, click “Save”, and go make a banana smoothie or something as this will probably take a while. On a 1.5ghz Powerbook, it takes about 4-5 hours to compress a 22 minute movie with these settings, so you’ll definitely want to experiment with a short clip of perhaps 10 seconds. However, make sure that clip contains a lot of variety so you can see how the settings affect different situations. If you want to have chapter markers in your video, you must use Apple’s Compressor program to preserve the chapter markers in the final file. Thanks Steve and the other guys at Revision3 for their help in figuring this out.

Experiment for Yourself

I’ve reached these settings after much experimentation, and so far these are the best upload settings I’ve found. They work best for Byteful Video because they’re completely compatible with all video iPods, Apple TVs, devices that play MPEG-4 video, as well as all computers with Quicktime 7 installed; and more importantly, the settings are a great balance between a small file size and sharp high quality video. However, depending on how you want to use your video, these settings may not be the best choice for you. As I said before, finding the sweet spot between a small file size and great quality takes time. When you export, just make sure you experiment with only a short piece of your work. You can choose only a small portion of video in iMovie by checking “export selected clip only” when you go to “export” in the “share” menu.

Edit: If you decide to export H.264 video with Quicktime, you may find that your video becomes washed out. Read “How to Fix Washed-Out H.264 Video” for instructions on how to counteract this.

As always, experiment and learn.

Did this tutorial help you? How could I have improved it?
Leave a comment below and let me know.