Tutorial: H.264 Encoding in Apple Compressor and Adobe Media Encoder
If you're a streaming producer you have to know how to produce H.264 for both Flash distribution and for mobile devices. Fortunately, Adobe Media Encoder makes this simple with multiple presets for desktop and mobile players which I'll show you how to find and customize in this tutorial.
Customizing H.264 Encoding Presets
So that’s the overview; now let’s get into customizing your presets for H.264 encoding. If you click on a preset in the Preset column of the Queue section at the top of the interface, the Export Settings dialog opens once again. We’ve seen this before when exporting from Premiere Pro. Here you’ll see five tabs that control the basic options in the encoding interface.
The Filters Tab
The first tab on the left is the Filters tab. One filter that will be familiar in name and function to Final Cut users is the Gaussian Blur filter (Figure 6, below). If you’ve got very noisy video, you might want to try applying the Gaussian Blur at the encode stage (if not before).

Figure 6. The Gaussian Blur filter
The Multiplexer Tab
The Multiplexer tab (Figure 7, below) is where you customize the multiplex settings for 3GPP (cell phone use), MP4 (general-purpose MP4 use), and None, which is separate audio and video files. If you do choose MP4, you’ve got 3 options to choose from. First is Standard, which includes upload to You Tube, upload to UGC sites, and general-purpose H.264 production. You’ve also got PSP, which provides stream compatibility that you can set for Play Station Portable, and the third option, iPod.

Figure 7. The Multiplexer tab
The Audio tab
In the Audio tab you’ll find typical parameters. First you choose your codec. Your choices include AAC, AAC+ Version 1, and AAC+ Version 2 (Figure 8, below). Typically, I’ll use just AAC because it’s the most broadly compatible.

Figure 8. Codec choices in the Audio tab
Output Channels choices include Mono, Stereo, and 5.1. You can also choose an Audio Quality setting–Low, Medium, or High—although that typically has no effect because the bit rate controls the quality.
You choose your bit rate in the Bit Rate Settings field below. You can also choose whether bit rate has precedence over frequency, which is typically the option that I select.
The FTP Tab
In the FTP tab, if you’re producing a file that you want to upload to a remote location via FTP after the encoding is completed, just select the checkbox shown in Figure 9 (below), fill in the credentials, and Adobe Media Encoder will upload the file to that FTP site once encoding is complete.

Figure 9. The FTP tab
The Video Tab
So let’s come back to the Video tab, which is where you do most of the heavy lifting when you’re encoding video (Figure 10, below). The first thing you’ll notice is that Adobe uses the MainConcept H.264 video codec, and that’s true for both H.264 production and H.264 production for Flash. That’s important because it’s much higher quality than the Apple codec that Apple uses in Compressor and we’ll see some examples of that later in the tutorial.

Figure 10. The Video tab
A lot of this stuff is going to look pretty standard if you’ve produced compressed video before: You’ve got your resolution, you’ve got your frame rate, and field order. All streaming files are progressive, so you can just leave the Field Order setting at the default Progressive (None).
Then you’ve got your aspect ratio. This is a 16:9 file that we’re using in this example, so Widescreen 16:9 is the right option. When I’m encoding files with the Adobe Media Encoder I toggle back and forth between the Source and Output windows because if there is a mismatch between the source file and that output pixel aspect ratio, it’ll show up here in the black bars (Figure 11, below).

Figure 11. The black bars in the video window indicate a mismatch between the source file and the output pixel aspect ratio.
So toggle this back and forth and then you can set the Pixel Aspect Ratio field to Square Pixels or you can set it for Widescreen 16:9. Both work, and you’ll know that it works when you toggle back and forth between Source and Output because there will be no black bars or other issues.
Profile and Level
Now let’s come back to Profile and Level, which are the two H.264 encoding parameters you can access directly in this interface (Figure 12, here). Typically you won’t select the Render at Maximum depth, because it doesn’t add any quality, and it takes a little bit more time.

Figure 12. Profile and Level, the two H.264 encoding parameters you can set in the Video tab
Bitrate Encoding Settings
Figure 13 (below) shows your Bit Rate Encoding Settings. For most general purpose encoding, you’re going to want to choose VBR, 2 Pass. If you’re encoding for adaptive streaming or encoding for limited-bit rate connections such as cellular, you may want to use CBR. If you choose VBR, 2 Pass, you can choose your target data rate, which we have at 6Mbps (six megabits per second) in Figure 13.

Figure 13. Choosing VBR, 2 Pass, 6Mbps for video encoding
With VBR (which stands for variable bit rate), you can also set the maximum bit rate. Typically I’ll set that at twice the target, so in this case I’d choose 12. If you want to set the keyframe distance (the interval between key frames in which the VBR encoder assesses and sets a bit rate), you select the Set Keyframe Distance checkbox, and then you can put in any interval that you want. Typically, when I’m producing for streaming or for upload, I’ll use 300 frames, which is 10 seconds with a 29.97 file.
At the bottom of the screen, selecting Maximum Render Quality, which will produce the maximum quality. It could cost you in encoding time, but not so much if you’ve got an NVIDIA CUDA card in your system, which I recommend for all CS5.5 production.
You would select the Use Frame Blending checkbox if you changed the frame rate between the source and the output footage. We didn’t do that with this clip. If you’ve previewed your video on a timeline, you might want to choose Use Previews, which could speed encoding time by using previews that were produced in the Premiere Pro. Again, we didn’t do that with this clip so that’s not an issue.
H.264 Parameters
Next, let’s come back to the H.264 parameters. First, we’ll look at encoding profiles. Your choices include Baseline, Main, and High. As we’ll see, you can choose only Main or Baseline in Compressor 4, and that’s probably one of the reasons that the quality isn’t as good in Compressor as what you get with the Adobe Media Encoder.
When I’m producing for computer playback of online video, typically I’ll use the High Profile. I don’t really care about Level in this scenario because that’s not relevant when you’re producing for computer playback.
If you’re producing for mobile device playback then you typically want to let Adobe Media Encoder choose the profile and the level (Figure 14, below). With mobile delivery, you don’t want to adjust the profile or level because if you do adjust them and you take the encoded video out of spec for the targeted device, the file may not load or it may not play.

Figure 14. When encoding for mobile devices, let AME pick the level.
Let’s come back to the preset that I was using for OnlineVideo.net. Figure 15 shows the profile and level that I have set for this particular file.

Figure 15. Encoding settings (including Profile and Level) for the file we’re encoding with our OnlineVideo.net presets
Entropy Encoding and B-Frames
How does Adobe Media Encoder handle entropy encoding and B frames, which are two pretty critical parameters to H.264 encoding? The chart in Figure 16, below illustrates that.

Figure 16. Profile-Dependent Entropy Encoding and B-Frames
For most H.264 encoding, the profile that you choose controls both entropy coding and B-Frames. So if you choose the Baseline profile, you use CAVLC as opposed to CABAC, and you have no B-Frames. That makes sense because the Baseline profile can’t handle CAVLC or B-Frames. If you encode using the Main Profile, Adobe Media Encoder uses CABAC entropy coding and inserts 3 B-Frames. If you use the High Profile, it also uses CABAC, but it uses the two B-Frames.
The only exception to this is when you’re producing for Apple i-devices. If you produce in this configuration, Adobe Media Encoder will always use CAVLC and will not insert any B-Frames into the compressed stream. All other configurations let the selected profile control whether you use B-Frames and which version of entropy coding.
Related Articles
Two types of noises degrade the audio you shoot with your video: random noises like microphone clicks and pops, and consistent noises like white noise or air conditioning hum. This tutorial demonstrates how to remove both of them in Adobe Audition CS6.
When you compress video for the web, the video can darken and colors can become muted. In this tutorial, I'll show you how to correct color and adjust brightness and color saturation with Adobe Premiere Pro's Fast Color Corrector.