Archive for the 'How-To' Category

How to Fix the H.264 Gamma Brightness Bug in Quicktime FOREVER


For anyone who has ever experienced problems when exporting H.264 video, this article was meticulously researched just for you.

I wrote this article because many people benefitted from my previous article about this issue regarding what I learned when encoding video for Byteful Video. This article is a followup to that article. However, if you don’t create video, you can safely skip this article; and in the next article we will return to our regularly-scheduled travel programming.

First of all, while researching this article I was shocked at what I discovered versus what I’d heard. It seems there’s a lot of confusion around video, and that’s not surprising considering how absurdly complex it can be. Today, I’d like to clear away the confusion and openly show how I solved this problem one and for all.

When I set out to write this article originally, I thought that the popular video encoding program Handbrake was the solution to the dreaded H.264 gamma brightness bug that has been plaguing video creators for years. And if you export video to H.264, you’ve probably heard of this problem.

Basically, when you export a video from Quicktime Pro as H.264, the resulting video is brighter than the original, and usually it looks horrible.

Yet I’d heard this problem was easily solved using Handbrake because it used a different encoder than Quicktime, namely the award-winning x264 encoder. Yet after conducting various tests, I was able to repeatedly demonstrate that using Handbrake does not solve the brightness bug at all. It doesn’t desaturate the colors as some methods do, but it isn’t the solution. Here’s a simple animation that alternates between a frame from my original uncompressed video and the same frame from Handbrake’s version of the video:

Video Comparison Animation

The main problem with this gamma shift (sometimes referred to as a color shift) is that your video’s black levels become unrealistic, and you loose the ability to have rich shadows. And in case you’re curious, this was done using a slight variant on the iPod encoding preset included in Handbrake, and these results mean that Handbrake decides to treat gamma in the same inaccurate way that Quicktime Pro does. Therefore, it would never be able to solve my problem.

So now that Handbrake had failed, what could I do?

Handbreak video vs. Original

Then it occurred to me, what if I bypassed Handbrake altogether? What if I used the x264 encoder directly with Quicktime Pro?

I decided to give it a try.

I remembered that x264 was also available as a standalone Quicktime plugin, so I did some research. At first, all I found was a stand-alone plugin from 2006, so I grabbed it off of MacUpdate. After a quick install process, I ran a few tests and exported a few different times, trying different settings each time. And, while the gamma problem was completely gone, I could not get any resulting movie files to play on any mobile devices.

Basically, I tried every variation of advanced settings, and nothing would work. This plugin simply doesn’t have the specific settings needed to create a video that will play on an iPhone or iPod.

So I had to resume my research, and I soon realized that Japan is still producing truly awesome people.

I’ll explain.

What finally saved me was a newer plugin by a Japanese guy named Takashi Mochizuki. This plugin is still based on the award-winning x264 project, but it has over ten times as many fine controls on its settings page than the other x264 plugin. This incredible beast is called x264Encoder, and it’s available on Takashi’s site, completely free.

After reading some of the documentation and conducting various tests, I finally refined a way to create flawless H.264 video that works on a variety of devices, all without any gamma bug. But before you can delve into the powerful controls of this new plugin, you have to install it and relaunch your video editor.

x264Encoder Quick Install

  1. Download the plugin on Takashi’s site.
  2. Copy the x264Encoder.component to Mac HD/Library/QuickTime/
    • Make sure you’re opening the Library folder at the root level of your hard drive. Don’t put it in the library folder in your Home, because that won’t work.
    • If you have trouble with installation, please read the directions that come with the plugin. Seriously.
  3. Quit any video editing programs you have open because they’ll need to be relaunched to see the new Quicktime encoder you’ve just installed.
  4. Open your video editing program and do one of the following:
    • In Final Cut Pro, choose:
      File menu > Export > Using Quicktime Conversion
    • In iMovie, choose:
      File menu > Export > Quicktime Tab
      Choose, Compress movie for: Expert Settings
      Click “Share”
  5. Then enter the detailed settings below.

Detailed Instructions for Flawless H.264 Output

Select: “Format: Quicktime Movie”
Click “Options” button
Make sure “Video”, “Sound”, and “Prepare for Internet Streaming” are all checked.
Then, under “Prepare for Internet Streaming”, choose “Fast Start” “Settings” button.

Under Sound, click “Settings” button
Change the settings to this:
Format: AAC
Rate: Recommended
Render Settings: Quality: Normal
MPEG 4 AAC LC Encoder Settings: Target Bit Rate: 160kbps
Click “OK”

Under Video, click “Size” button
Just look at this to make sure that it’s the size you want. (I mention this because when testing, I noticed that this would default to “Compressor Native” which was too small.)
Click “OK”

Under Video, click “Settings” button (this is the really important part)
Change the settings to this:
Compression Type: x264 Encoder
Frame rate: Current
Key Frames: Automatic
UNCHECK Frame Reordering
Encoding: Best Quality (Multi-pass)
Data Rate: Restrict to 1500 kbps (if you want iPods to be able to play it)

Alternatively, you could just make your settings look like this:

x264 Video Compression Settings

Then click “Options” button at the bottom left of the window.

This is where it starts to look a little crazy, but it’s easier than it looks.
So hang in there! This is totally worth it.

Now, you will see this vast array of options:

x264 libavcodec settings

But you don’t have to worry about setting all of this up because presets are included!

Click the “Load Preset” button at the bottom left, and a sheet will slide down.

Presets make it easy to make iPhone-ready video

x264 load presets

If you’d like people on mobile devices like the iPhone, iPad, or iPod touch (as well as the PSP and Zune) to be able to play your video, choose the “iPod Tuned” preset. (According to the x264 docs, this takes a bit longer to encode than “iPod Default”, but the results look better. It’s worth it.)

Click “OK”

And while we’re here, click on the “Values” tab to look at all the settings you don’t have to worry about because Mochizuki-san provided some excellent presets! Domo arigatou, Mochizuki-san!

The Key is Setting the Gamma

To finish up, let’s activate the color spacing tag that fixes the problem that spawned this entire situation.

Click on the “Tagging” tab and check the checkbox “Add gamma 2.2 (SD/HD content)”. Adding this gamma tag simply and elegantly solves the problem without any unnatural color filtering or adjusting. That’s why this method is superior to all other methods. No “BlackWhite” restore, brightness filter, or strange alpha channel methods are needed. This is an important point. Shifting the brightness or contrast during exporting in order to fix the gamma problem is a bad idea. Not only does the export take longer, but worse, you always lose more quality than if you hadn’t adjusted. That’s why I’m so thankful that Mochizuki-san has put so much work into this plugin.

x264 Color Space Tagging

Now that you’ve set the gamma, you’re settings are complete!

Click “OK”
Click “OK” again
Click “OK” once more

Then click “Save”, and wait. (It may take hours depending on the speed of your machine and the length of your video. I recommend that, before you spend hours encoding your entire video, that you experiment on a clip only a few seconds long to confirm that it looks the way you want it.)

The result? Beautifulness.

The resulting video will not only have the same brightness as the original, but it will also play back on mobile devices like the iPhone, iPad, or iPod touch. Also, I’ve heard that every time you use Takashi’s x264Encoder, an angel gets its wings; and although I happen not to have concrete evidence for that at the moment, you will believe me. Yes, yes you will. I thank Takashi very much, because at the end of the day, using this plugin lets me say two words I love to say.

Problem solved.


Recommended Reading:

  1. How to Fix Washed-Out H.264 Video
  2. How to Encode Video for a Podcast
  3. How to Make a Widescreen Movie without an HD Camera


Magellan's Travel



How I Solved my Travel Dilemma in 60 Seconds using the Law of Attraction


What if Reality, your daily experience of life, didn’t work like how you thought it worked at all?

And how would you find out?

More and more over the last few years, I’ve come across stories and first-hand accounts of how powerful intentions are, and how the intentions I hold in my mind affect more than just my own actions. I kept coming across stories about something called the Intention-Manifestation model of reality that suggested that my thoughts and intentions actually ripple out into the Universe and eventually reflect back to me, often in powerful ways. It stated that these intentions reflect back to me from the Universe itself, because the Universe is reflecting back to me the reality that’s most aligned with my thoughts and beliefs. On the surface, it seemed strange and maybe even a little crazy the first time I heard about it, but as I’ve experimented with this worldview more and more, I’ve been startled at how my life has been transformed.

So today, I’d like to share with you the story of something really inexplicable and outright weird that happened to me which wonderfully illustrates the powerful ways Intention-Manifestation can occur while travelling. And perhaps along the way, you’ll gain a new sense of curiosity and wonder for this strange universe we live in.

Many Names, One Principle

This worldview goes by a few different names, and you may have come across this theory before since discussion of it among philosophers and well-known thinkers has been growing over the past few years. The phenomenon is referred to as the Law of Attraction or the Intention-Manifestation model of reality.

Recently, this has been showing up in popular media, too. You’ve probably heard of a movie called “The Secret”, and if you haven’t, you probably will. This movie is the most popular explanation of the Law of Attraction that has emerged in the last few decades. (And for the sake of saving ink, paper, time, and my sanity, I’ll abbreviate Law of Attraction as LOA for the rest of this article.)

Beyond simply being an enjoyable movie, “The Secret” contains some pretty powerful ideas, and it’s one of the more profound movies that I’ve seen in the last few years. However, to be honest, I was pretty disappointed in the movie, because it gave a disproportionately large amount of time to how to use the LOA to become wealthy and earn more money. Perhaps the book that the movie is based off of is better, but the movie put the wrong emphasis on what the LOA truly is.

Many People throw out The Baby

Now, there’s nothing wrong with becoming wealthy; but, because of the way the movie discussed money and wealth, there’s a real danger that people will make a false association that the LOA is always about wealth and becoming rich, which it is definitely not. There are various problems that arise when you become preoccupied with the wealth-creation aspect of the LOA.

Probably the biggest problem is that, for complex reasons (which would require another article to adequately explain), people new to the LOA invariably fail to manifest the money of their dreams. So guess what they do? They throw out the entire LOA model and decide that, since they couldn’t generate wealth in x-number of days, it’s completely bogus.

Forget “throwing the baby out with the bath water” — that’s like throwing out the entire bathtub.

Over a cliff.
Onto sharks.
With lasers on their heads.

It’s not pretty.

See, the LOA basically states that every thought is an intention. That means any and every thought is an intention, including any worries, hopes, and recurrent thoughts you may have throughout the day. According to the LOA, your sum total reality is a reflection of the sum total of your thoughts/intentions; and therefore, you’re directly responsible for everything in your life.

It follows then, that to change your life, you have to change your thoughts, right?

Yep!

Easy?

No.

It’s pretty darn difficult, because to change your thoughts, you have to reevaluate, and sometimes completely rebuild, your belief frameworks (or core belief systems).

I’m not going to sugarcoat this. Challenging your belief frameworks, and growing from that, is one of the hardest tasks you can ever take on. But there’s no rush, and over the longterm fewer things are more rewarding than challenging your belief frameworks and growing from the experience.

An Interesting side note

Recently it’s come to my attention that this principle may even be hinted at in the Gospel of Mark in reference to prayer. I’ll quote the relevant part of chapter 11, and you can come to your own conclusions:

Now in the morning, as they passed by, they saw the fig tree dried up from the roots. And Peter, remembering, said to Him, “Rabbi, look! The fig tree which You cursed has withered away.”

So Jesus answered and said to them, “Have faith in God. For assuredly, I say to you, whoever says to this mountain, ‘Be removed and be cast into the sea,’ and does not doubt in his heart, but believes that those things he says will be done, he will have whatever he says. Therefore I say to you, whatever things you ask when you pray, believe that you receive them, and you will have them.

~ Yehoshua of Nazareth
As chronicled in the Gospel of Mark 11:20-24 (NKJV)

Story Preface: Expectations Restrict You

So now that you’ve just had a beginner’s crash course in what the LOA is, I can preface my story.

I feel really lucky that this particularly inexplicable thing happened to me, because it clearly demonstrated to me, first hand, that the real key when using the LOA is to not hold specific expectations about the outcome of what you want to happen. I’ve found that, once I’m clear about what I want, any attachment to a particular outcome limits the LOA from working as it should.

Basically, expectations I hold about how something will manifest actually minimize the chance of anything manifesting in a profound way.

Instead, I found that if I have faith that what I need will come to me in its own perfect time, and I remain very flexible about how and when it will arrive (i.e., not placing specific expectations on outcomes), intentions manifest into realities a heck of a lot faster, and in more compelling ways.

Recently, I saw this summarized beautifully on twitter:

Attachment is the enemy of manifestation.
~ Steve Pavlina

And frankly, I never would have believed that my thoughts actually have a such a profound, and inexplicably-fluid, effect on my reality… until I began to experience it for myself. But I never could have experienced the LOA at work in my own life until I started relaxing my own beliefs about reality a bit. For instance, I started asking myself questions like, “What if this really is how reality works? What if I don’t understand the link between my mind and my reality as well as I thought?”

Once I opened myself up to the possibility, some weird things started happening to me. Some wonderful, weird things. The story below is one such example.

How I Manifested a Solution in 60 Seconds Flat

So how did I solve my travel dilemma in 60 seconds flat using the LOA? Well, the following story happened to me just last month, and it’s an excellent example of the LOA at work.

I had just set out on a long bicycle trip out of Madison. I’d carefully packed my travel inventory into my pack and attached the pack to my bike’s rack using some handy bungee cords. After biking for a few minutes, I suddenly remembered that I’d forgotten something crucially important.

My front tire’s air pressure had been low for a few days, and I’d meant to stop somewhere and fill it up the day before. I’d forgotten, which resulted in a very interesting dilemma:

1. I could go back and fall way behind schedule.
2. Or I could press on but risk ruining my wheel’s rim if the tire lost any more pressure.

Don’t you just love dilemmas?

Just 60 Seconds later

After stopping (in my mind) and screaming “KAHN!!!” to the sky (again, in my mind), I thought to myself, “Where the heck am I going to find an air pump station around here?”

I didn’t know the far-western side of Madison that well, and the thought occurred to me that it would be really great if I ran into an opportunity to refill my front tire without spending a bunch of extra time looking for a gas station with an air pump.

Guess what happened 60 seconds later.

After arriving at the next intersection, I saw a fellow biker head towards me. For various reasons, I got the feeling that he really knew what he was doing (though not because he was wearing a spandex biking outfit, because he wasn’t, thank goodness). So as I was about to pass him, a small voice inside of me said, in a not-so-small tone, “ASK HIM ABOUT FILLING UP YOUR LOW TIRE!”

It continued, “SERIOUSLY. RIGHT NOW.”

Sigh.

I’d heard this small, still voice before, and I had the feeling that I’d regret it if I didn’t listen to its advice.

So I did.

It turned out that he actually had an air pump with him (and if you’ve done some biking, you’ll know this isn’t exactly common anymore), and he was really glad to help. He even pumped the air for me, and 30 seconds later my tire was at the correct air pressure again. I thanked him profusely. He smiled. And after saying farewell, I was on my way once again.

So what just happened there?

Let’s recap: I went from thinking about needing to fill up the air in my tire, to someone connecting an air pump to my tire in about… 60 seconds flat.

Think the Law of Attraction is crazy?

To be completely clear, I don’t expect to convince anyone anything with just one story, or even many stories for that matter. Convincing you is not my goal. My goal is to get you curious. My goal is to get you really suspicious, suspicious of your current beliefs about the way reality works. After all, if you consider yourself a true skeptic, you must be at least slightly skeptical of your own opinions and beliefs. Otherwise, how pure is your skepticism, really?

Now, challenging your belief frameworks isn’t easy. It took me time to internalize and understand this particular framework and open myself up to these kinds of possibilities. It’s easy to write off these kinds of stories if they’re perceived as isolated cases. It’s a lot harder to brush them all off as coincidences if they’re happening to you personally and things start to manifest more quickly and more often.

And that’s exactly what happens the more you open yourself up to the possibility that this is how reality actually works.

Challenging at first, but The Blanket does exist!

The concept of the LOA may sound weird, and that’s because it is. But in my experience, it works. (And I’m not alone. Many thousands, perhaps millions of people around the world also use the LOA every day. One good place to meet people who use the LOA are on discussion boards like this one.)

So the LOA may strike you as weird, but do you want to hear something that’s even weirder? If you decide that the LOA is completely impossible, that’s an intention, too. By denying the possibility of the Law of Attraction, you actually send out the intention to have the Universe reflect situations back to you that are designed to raise more doubt in you over whether the LOA is real or not. So in essence, by “deciding” that the LOA is impossible, you use the LOA against itself in your own life.

It’s like believing that, once you put a blanket over your head, you can decide it doesn’t exist because you can’t see anything!

This Wonderful Universe loves Congruency

But don’t worry. If you want to try this out yourself, you can. You just need to keep in mind that any conflicting thoughts you generate will result in conflicting realities. And conflicting realities usually cancel eachother out which results in nothing ending up manifesting. So the less conflicting your thoughts are, the better. (This is called being Congruent.)

So if you remember only 1 idea from this article, remember this:

The more time and the more you can lock onto the feeling of what it will feel like when you’re living with the results of what you want to manifest, the quicker it can manifest.

The feeling part is really important since the emotional energy behind any thought regulates how powerful the thought is. So be responsible, be congruent, and really tune into the feeling of what it will feel like once you’re living with the results of having/being/achieving what you want… and let me know how it goes!

And as far as the story goes, anything like that ever happen to you?
I’d love to hear your stories in the comments.

Funny and wonderful universe we live in, isn’t it?


Recommended Reading:

  1. How to Get Paid to Travel 1,000 miles: Craigslist


Magellan's Travel