Developers have an abundance of options when building live-streaming apps. From which streaming protocol to pick to designing the playback interface, every choice impacts user experience (UX). Make the wrong choice, and your users will look for a competitor with better UX.
Picking between constant bitrate vs variable bitrate is one of these decisions that can positively or negatively affect UX. Do you go with better consistency or better quality?
This post discusses how they differ and why the CBR vs VBR debate matters for streaming.
What is CBR vs VBR in Brief?
Constant bitrate (CBR) and variable bitrate (VBR) are two different rate control methods for media. As their names imply, CBR encodes a file with a steady bitrate, while VBR's bitrate changes based on the complexity of the media being encoded.
Bitrate refers to two related concepts:
- the number of bits per second transferred over an internet connection
- the number of bits per second of an audio or video file
A higher bitrate means less audio and video compression.
When video calling or streaming a film online, a higher bitrate produces better quality video and sound but requires more bandwidth. A lower bitrate delivers worse quality with lower bandwidth needs. For files saved to a device or server, higher bitrate files come with higher storage requirements in place of bandwidth demand.
How Do CBR and VBR Differ?
CBR encodes with the same bitrate throughout a file, while VBR adjusts based on a scene, live stream, or call's complexity.
| Aspect | CBR | VBR | |:-----------------------:|:---------------------------------------------------------------------------------------:|:---------------------------------------------------------------------:| | Video and Audio Quality | Reliable quality, although there may be more noticeable degradation with lower bitrates | Higher quality, thanks to distributing bits based on scene complexity | | Encoding Speed | Shorter encoding time | Longer encoding time, particularly for two-pass VBR | | File Size | Larger file sizes with consistent bitrate, regardless of scene complexity | Smaller file sizes of variable bitrate, adapting to scene complexity | | Use Cases | Live streaming and real-time communication | Video-on-demand streaming |
When you set the encoder to a lower bitrate with CBR, complex scenes will have more obvious quality degradation, like motion artifacts and loss of detail. This is because video and audio vary in complexity over the course of a file or stream's duration.
Audio complexity increases when:Â
- there is more volume
- the volume changes frequently between loud and quiet
- more than one voice or instrument is present.
For video, more motion, color, and detail mean more complexity.
For examples of high and low-complexity audio, imagine an orchestra playing their loudest compared to a short conversation excerpt with silent pauses. For video, it'd be an action hero running from an explosion vs. someone's unmoving face against a white background.
That is, CBR's quality will be greater with a higher bitrate, but simpler scenes will take up more storage and require more bandwidth than with VBR.
VBR allocates bits based on the complexity of video and audio in accordance with set encoding parameters. These parameters can include:
- average bitrate
- minimum/maximum bitrate
- file size
- desired quality
Simpler audio and video use fewer bits, and more demanding sequences receive more, giving it the potential to produce better quality video and audio overall. Since the bits are spread out based on complexity, file sizes will likely be smaller than those of media encoded with CBR.
Depending on the codec and encoding software or hardware, you can encode a file with single-pass VBR and two-pass VBR.
- Single-pass VBR encodes the media only once while allocating bits. This leads to faster processing time but less optimal encoding.
- Two-pass VBR goes over the media twice for more refined bitrate allocation, giving higher overall quality and possibly a smaller file size at the cost of much slower encoding.
How Do CBR and VBR Affect Streaming?
CBR encodes faster, is the recommended rate control for major live streaming platforms, and is predictable in terms of data transfer and file storage.
On the other hand, VBR has the potential for greater image and audio quality with a lower file size.
Video conferencing apps can work well with either option with a few considerations. Which communication protocol you use for streaming and ingesting will impact which rate control method to pick. For example, CBR is recommended for optimal performance and quality when streaming over WebRTC using RTMP for ingest with OBS.
Another consideration for calling use cases is security. In some cases where VBR is used with SRTP without padding, eavesdroppers can guess the contents of encrypted audio with enough reliability to make it a potential security risk.
For live streaming, you should guide users on the best way to stream on your platform.
VBR's lower bitrate means less bandwidth is required during simpler sections of a live stream. However, Twitch broadcast guidelines and YouTube both recommend CBR for live streams because the sudden jump in bandwidth demand during more complex portions of the stream with VBR can cause disruptions or quality drops for some viewers.
On-demand video is where VBR has an advantage over CBR --- particularly two-pass VBR. Since this content type doesn't involve a real-time element, the lengthy encoding process is less of a burden. With two-pass VBR, viewers get high-quality content, and the smaller file sizes save on storage costs.
Be sure to thoroughly test VBR and CBR streams with different encoding parameters, resolutions, frame rates, and network conditions to see which settings deliver the best output for your users. Netflix's Video Multi-Method Assessment Fusion (VMAF) can serve as a useful metric for measuring these differences.
Frequently Asked Questions
Which Produces Better Quality Video and Audio?
When all conditions are equal, two-pass VBR produces the highest quality video and audio.
Should I Use CBR or VBR in OBS?
Use CBR if you're using OBS for low latency and real-time use cases, like live streaming or making calls. Use two-pass VBR for the offline recording of on-demand content.
Which Produces Smaller File Sizes?
VBR produces smaller file sizes because it adjusts its bitrate depending on the complexity of individual content sections instead of maintaining a consistent bitrate for complex and simple sections like CBR.
Which Has Better Compatibility?
CBR and VBR should be compatible with all major streaming protocols, including HLS, MPEG-DASH, and CMAF. They're both compatible with standard audio and video codecs used on modern devices, but CBR might be more compatible with legacy devices.