Now that mobile devices are such an important target for most producers, does it make sense to start encoding all H.264 footage using the Baseline profile? From the tests that I performed this week, encoding all footage using this profile might save encoding and storage resources with minimal loss in quality.
Gosh, it’s hard to remember a time when we weren’t using the H.264 codec, but I guess it’s been since at least 2007, with many producers starting before then. When I first started working with H.264, I remember running comparisons, and finding files encoded using the Main and High profiles clearly superior to Baseline. So the general rule quickly became to encode using the High profile for computer playback, and the Baseline profile for mobile, a dichotomy that continues until today.
Recently, I worked with a client encoding SD video for web delivery. His application was continuing education, and in addition to adaptive streaming he was offering a single file for download and local playback on computers, tablets, mobile phones and other devices. He asked whether he should encode this file using the Baseline profile, which would maximize compatibility, or the High profile, which would optimize quality.
This is important because while computers and many devices can play files encoded using the Main or High profile, many devices can’t, including all pre-iPhone 4S Apple phones and iPod touches. For example, if you check Google’s recommendations for Android devices here, you’ll see that Google still recommends the Baseline profile, even for 720p video encoded at 2 mbps. And while Apple is very specific about which profiles their devices will play, most other vendors aren’t, stating that their devices play H.264, but not specifying which profile. So the Baseline profile is clearly the safest approach.
While the client could certainly produce two files using both profiles, this would cost him both encoding cycles and storage space.
Contents
Does the Main Profile Produce Higher Quality than Baseline?
So the obvious question was, did the High profile produce superior quality to the Baseline profile using his encoding parameters, which were 640x480x29.97@1 mbps. In theory, of course, the High profile should produce better quality because it uses more sophisticated encoding techniques than the Baseline profile, like B-frames and CABAC entropy coding.
To answer the client’s question, I produced two files to these targets, one using the Baseline profile, the other the High profile. While Adobe Media Encoder doesn’t let you manually control B-frame settings or entropy coding, when you choose the High profile, it enables CABAC and B-frames with an interval of two (and three reference frames. The quality was pretty much identical.
So, I ran several tests using three encoding configurations parameters and three software encoders. If you want to skip the commentary and look at the files themselves, I’ve posted them all here. The bottom line was that I found a noticeable difference in only one sequence in four sets of tests, and that was at the most aggressive compression settings, 640x360x29.97 @ 240 kbps.
Here are some screenshots from the various tests; check out the files and see for yourself. The screens represent the most challenging frames in each test file, which is why there is some repetition.
Adobe Media Encoder – 640x480x29.97 @ 500 kbps
This was half the data rate used by the client, with a bits per pixel value of .54 (in contrast, CNN usually publishes at a bits per pixel value of .1 or higher). On these demanding frames, I could see no commercially relevant difference. Click each picture to view it in full resolution in another browser window, or click here to play the videos.
Squeeze – 640x480x29.97 @ 500 kbps x264 codec
I wanted to make sure that the results weren’t codec or encoder specific, so I tried encoding with Sorenson Squeeze using the x264 codec, with B-frames enabled (interval of three, with five reference frames), CABAC and otherwise tuning the preset for top quality. Same result; I saw very little difference between the files; nothing that would convince me that I needed to encode one set for computers using the High profile, and one for devices using Baseline.
AME – 1280x720x29.97 @ 800 kbps x264 codec
Back with the Adobe Media Encoder, I tested using my HD test file and standard HD encoding parameters. Here the bits per pixel value was a very low .029. Here, I saw very little difference between the Baseline, Main and High-encoded clips, and certainly no differences that would convince me to encode multiple files to serve different targets.
Carbon Coder – 640x360x29.97 @ 240 kbps
This configuration is from an adaptive set that I helped configure for a major three-letter network, so it’s live and in use today. While the bits-per-pixel value of .035 is higher than the 720p configuration above, it’s actually a more aggressive configuration because H.264 works more efficiently at higher resolutions. When encoding with the High profile in Carbon Coder, I used a B-frame interval of three, five reference frames, CABAC and otherwise tuned the preset for maximum quality.
This is the only configuration where I saw any noticeable difference in quality, and only in one sequence. Check out the window to the dancer’s right; that’s where it’s most obvious.
The Takeaway
So what to takeaway from all this? Some observations:
- Your mileage certainly may vary based upon source footage, encoding configuration and encoding tool.
- However, before assuming that you need two different files encoded using different profiles to optimize quality for different target platforms, run your own tests, and see if there’s a difference.
Should you stop using the Main and High profiles altogether? That’s a more interesting question that I’ll consider after mulling over these results and perhaps running some additional tests. Clearly, the qualitative differences between the profiles is significantly less than it was when I first started working with H.264. Since files encoded using the Main and High profiles play in fewer places than Baseline encoded files, the lack of qualitative differentiation lessons the incentive to use those less-compatible profiles.
Again, you can check out the files yourself here. If you disagree with my findings, I’d love to see the results of your tests that disprove these, complete with details about encoder and file configurations and such. I’d also love to see the encoded files.