CBR vs VBR: Difference Between Constant Bitrate and Variable Bitrate

October 30, 2020 by
 

One of the most common encoding parameters available for live and on-demand streaming is bitrate control, which dictates how the encoder allocates the encoded audio and video data within the file. There are three common approaches: constant bitrate encoding (CBR), variable bitrate encoding (VBR), and constrained variable bitrate encoding (CVBR). This article defines the terms, briefly discusses their history, and provides recommendations for when to use all three.

 

What’s the TL/DR Answer?

Use CBR for live encoding on-site and transcoding in the cloud, and 200% CVBR for on-demand video in most geographic regions.

 

Defining the Terms

Let’s use the interface of the Adobe Media Encoder to define our terms. As shown in the first screen below, CBR assigns a single data rate to the file and encodes in a single pass. As the name suggests, the encoder maintains a constant bitrate over the duration of the file, which doesn’t vary by the complexity or motion in the video.

 
 

In contrast, with variable bitrate encoding, the encoder varies the bitrate allocation over the file according to encoding complexity, stealing bits from easy-to-encode scenes to apply to hard-to-encode scenes so they look better. In operation, as shown below, you assign both a target bitrate and a maximum bitrate, with some encoders also allowing you to set a minimum bitrate. In essence, you’re telling the encoder to average 2 Mbps over the duration of the video file, but in no cases let the video bitrate exceed 4 Mbps.  

This 4 Mbps is the “constraint” in constrained VBR; in use, almost all VBR is constrained VBR because you always want to set some bandwidth limits to ensure smooth streaming. You would call this configuration 200% constrained VBR because you’re instructing the encoder not to exceed 200% of the target bitrate.

 
 

With our terms defined, let’s see how the Adobe Media Encoder did in meeting our targets, using the files we just encoded as viewed in a free tool named Bitrate Viewer.  Note that this test file has seven seconds of easy-to-encode low motion followed by seven seconds of hard-to-encode high motion. On top is the CBR stream, on the bottom the VBR stream. Bitrate Viewer is in “seconds” view and the dark blue blocks show the data rates for each second of video. The faint blue line is the average bitrate over the file.

On the upper right, you see the average bitrate for both files, which was 2029 kbps for the CBR file and 2019 kbps for the VBR file. So, the Adobe Media Encoder hit the target bitrate for both files. This reinforces the point that the VBR and CBR decision doesn’t impact total bitrate, just how the bits are allocated throughout the file.

In this regard, you also see that the peak bitrate is 3,373 for CBR and 5,360 for VBR, indicating that the bitrate wasn’t perfectly “constant” for the CBR file and that the encoder missed the maximum “constraint” for the VBR file. This is typical for desktop encoders like the Adobe Media Encoder (as opposed to live streaming encoders), where hitting these targets precisely is seldom relevant. In contrast, most streaming encoders offer closer adherence to the target and maximum bitrates.

That said, you can see that the average bitrate is much more consistent in the CBR stream than the VBR stream. Conversely, you also see that while the CBR encoder allocated most of the bits evenly over the entire file, the VBR stream allocated much more of the bits to the hard-to-encode region at the end of the file.

 
 

With these two patterns in mind, ask yourself two questions. First, which encoded file likely exhibits higher overall quality, VBR or CBR? If you think VBR, you’re probably right because the data rate varies according to encoding complexity.

Then consider, which file would you rather stream to a viewer watching on a 3G connection? If you think CBR, you’re probably right because there are no data rate spikes that might exceed the connection speed.

 

Hence, the key benefits of each of the two technologies:

  • VBR usually produces a higher quality file than CBR, though the difference is typically lower than you would think.
  • CBR usually produces a more deliverable file, which is more relevant for mobile delivery than most desktop or living room viewing.

Though not evident from our experiments, CBR encodes infrequently produce transient quality drops when the encoder sacrifices short-term quality to meet the target bitrates. For this reason, most producers avoid CBR whenever possible. 

 

What’s the Historical Picture?

Most digital broadcast streams are encoded using CBR because the streams are transmitted through fixed bandwidth connections with a low tolerance for stream variations. For this reason, broadcast professionals migrating to streaming production tend to prefer CBR because it’s what they’re used to. During the early years of streaming, when producers attempted to deliver video to 28.8 kbps modem connections, CBR was also strictly adhered to for similar reasons.

Today, because the average video download speed in the U.S. is over 90 Mbps, and 4G and 5G dominate mobile connections, the bandwidth variations caused by VBR encoding typically won’t interrupt last-mile playback. As you’ll read, however, there are still very good reasons to use CBR for live productions.

 

Where Do I Choose between VBR and CBR?

In a live workflow, you have to choose in your on-site streaming encoder and your transcoder. In video on demand (VOD) workflows, you have to choose when encoding the files for upload to your streaming server.

 

Use CBR for Live

Though one-pass VBR encoding is possible, VBR is most effective when the encoder can scan the entire file and identify the hard-to-encode and easy-to-encode regions. Obviously two-pass encoding isn’t available for live encoding, which usually makes CBR the better option.

In addition, when encoding onsite for streaming to the cloud for transcoding and packaging, producers often work with tight outbound bandwidth constraints. In these instances, you want very tight control over your outbound bitrate because data rate spikes could exceed available bandwidth and stop the outbound stream.

Most producers prefer CBR for cloud transcoding of live streams because it keeps outbound bandwidth requirements relatively consistent. Remember that all viewers of a live stream watch the same bits at the same time. If you’re serving thousands of viewers simultaneously, and the bitrate spiked by 200%, you could temporarily exceed the capabilities of your delivery ecosystem. In contrast, even if thousands of viewers were watching a VOD asset simultaneously, they wouldn’t be watching the same sections, so the effect of the variations would even out.

Recognizing that encoders don’t produce total flatlines when delivering CBR video, Apple’s HLS Authoring Specifications state that “live/linear content, the measured peak bit rate MUST be less than 125% of the BANDWIDTH attribute.” This is good advice whether you’re distributing via HLS or DASH.

 

Use Constrained VBR for VOD

Constrained VBR is preferred for VOD video because it delivers better overall quality than CBR and avoids transient quality issues sometimes experienced with CBR. The constraint applied should vary by geographic region and the connection speed of your target viewer.

In terms of region, if your viewers are typically in the U.S., Europe, Scandinavia, or the Asia Pacific, the speed of desktop, living room, and mobile connections are all very high, and unlikely to be exceeded by data rate swings in a CVBR encoded file delivered via VOD. On the other hand, if your typical viewer is watching over 3G or you’re targeting countries with much slower connection speeds, tightly constrained VBR is appropriate.

Referring back to the Apple HLS Authoring Specifications, Apple recommends “For VOD content, the peak bit rate SHOULD be no more than 200% of the average bit rate,” or 200% constrained VBR. If you’re distributing VOD video to viewers watching on relatively high bitrate connections, this is good advice for both HLS and DASH encoding. For countries with lower bitrate connections, use 110% constrained VBR, which would limit maximum bandwidth to 110% of the target.

 

What About Audio?

The same general rules apply for audio-only steaming: use CBR for live and consider VBR for VOD. That said, although virtually every video encoder enables CBR and VBR configuration options for video, relatively few offer the same option for audio.

If audio is an important component of the streaming experience, as with concerts, ballets, operas, and other similar performances, it’s worth experimenting with VBR audio to optimize the on-demand experience. For most other content, going with CBR for live and VOD is probably the simplest option.

 

About Jan Ozer

Jan Ozer is a leading expert on H.264, H.265, and VP9 encoding for live and on-demand production. In his consulting practice, Ozer helps streaming publishers produce highly optimized and deliverable streams and to choose encoders, transcoders, and workflows that optimize… View more