97

I was rendering a video in After Effects CS5 and when I was formatting it I chose the H.264 codec and in that format, it had a profile with Baseline, Main and High.

So I did a little test – rendering both files with Baseline and High. The only thing I noticed was that the video size was smaller, High delivering the smaller file size.

I just wanted to know what the difference is as in which would be best for quality and best for file size.

1 Answer 1

133

What is a profile?

A H.264 profile more or less defines what "bells and whistles" the encoder can use when compressing your video – and there are lots of H.264 features that the encoder can enable. Which ones it's allowed to enable is defined by the profile. Profiles ensure compatibility between devices that have different decoding capabilities. With profiles, the encoder and decoder agree on a feature set that they can both handle.

What do the different profiles do?

For a detailed list, see H.264 Profiles on Wikipedia.

Generally, the Baseline profile restricts the encoder to certain basic features only. Videos encoded with baseline profile can be easily played back, even on devices with lower computational power, such as old smartphones. Android and iOS phones, for example, used to only be able to play video encoded with the baseline profile. This has changed a little bit in the last years, where more and more phones can actually play main profile video, but not high profile.

So, baseline means:

Primarily for low-cost applications, this profile is most typically used in videoconferencing and mobile applications. It corresponds to the subset of features that are in common between the Baseline, Main, and High Profiles

Main and High just add features to that. Especially the high profile is often used in broadcasting:

The primary profile for broadcast and disc storage applications, particularly for high-definition television applications (for example, this is the profile adopted by the Blu-ray Disc storage format and the DVB HDTV broadcast service).

B slices are for example only allowed in the Main profile and above. They can be used to save on bandwidth, but are harder to decode, which is why some devices might not support them.

What does that have to do with quality?

The profile only indirectly influences the quality. Some features of higher profiles may enable you to get the same quality with lower file sizes as compared to lower profiles.

For example, CABAC entropy coding (Main and High) is more efficient than CAVLC (Baseline). It is also computationally more intensive. Thus, if you give the encoder a certain bit rate to spend, it'll be able to create a better quality video with CABAC than with CAVLC because it achieves much better compression.

This also explains why you achieved smaller file size with the High profile — obviously, you somehow set a constant quality level and the encoder could use more advanced compression techniques to create a video file that has the same quality as the Baseline profile, but with smaller size.

So… which one should you use?

Some basic rules:

  • Baseline profile if you're targeting old mobile devices
  • Main profile for modern devices and web streaming
  • High profile for long-term storage, PCs or Macs, Blu-ray authoring, etc.
9
  • 17
    Since this was written written, pretty much all smartphones including Android and other devices now play main profile and many play high. High profile support, for example, is supported by most devices that claim to play high definition content. You can almost certainly rely on main or higher. Baseline was a highly crippled version of H. 264 designed for the limited devices of decades past. Nov 24, 2014 at 2:42
  • 1
    Not everybody has a recent smartphone. Android still recommends to use the Baseline profile. The same goes for iOS. Of course, some (most new) devices support higher profiles, but if you want to stay compatible with low end hardware, you'll have to choose that. But I edited my answer to reflect what you're saying.
    – slhck
    Nov 24, 2014 at 7:00
  • Interesting - the built in player has been supporting main for me for a while, but your point is valid - you cannot rely on this. You can, however, rely on third party software players for main and high profile, for example players like MX Player have software support for higher profiles - as long as it's ARM based and high enough CPU performance. Nov 24, 2014 at 10:02
  • Note that as of 2016, Google Photos, when doing backups converts uploaded videos which were recorded on an Android Nexus 6 in High profile into the Baseline profile (in "high quality" "free unlimited storage" backup mode)
    – nealmcb
    Aug 9, 2016 at 14:53
  • 2
    @jarno "Main@L4" means "Main Profile at Level 4." If a decoder supports a particular level then that means it supports a certain maximum bitrate and various combinations of frame size and frame rate. See the Levels section of that same Wikipedia page. If you're encoding a video for playback on a specific device your best bet would be to look up what Profile and Levels it supports (this might be available in the user manual) and encode for the highest of (or, certainly, no higher than) those. Mar 27, 2022 at 23:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .