Technical Brief: Switch from CBR to VBR to Improve Overall Quality and Avoid Transient Quality Issues

Home/Articles/Technical Brief: Switch from CBR to VBR to Improve Overall Quality and Avoid Transient Quality Issues
By | 2016-03-14T00:00:00+00:00 March 14th, 2016|Articles|Comments Off on Technical Brief: Switch from CBR to VBR to Improve Overall Quality and Avoid Transient Quality Issues

Summary (The MPD)

Many streaming producers use constant bitrate encoding (CBR) as a bitrate control technique, either in an attempt to create the most efficient stream for delivery, or to comply with perceived Apple requirements for HTTP Live Streaming (HLS). However, CBR delivers the lowest overall quality of all bitrate control techniques and introduces the potential for dramatic transient quality issues like those shown in Figure 1. (You can download a PDF copy of this Technical Brief, by clicking here). 

VBR_report1a.jpg

Figure 1. Comparison of CBR vs. VBR encoding (click image for full size view). 

A recent survey indicates that many producers have switched over to variable bitrate encoding (VBR) and are ignoring the aforementioned Apple recommendations. Testing reveals that 110% constrained VBR avoids the transient quality issues caused by CBR encoding. Producers still using CBR should consider switching over to constrained VBR to avoid these transient quality issues and improve overall video quality.

Segment 1: Bitrate control is one of the most fundamental encoding options selected for each compressed file

Whenever you encode a file for streaming distribution, you choose a bitrate and a bitrate control technique. This is shown in Figure 2, from the Adobe Media Encoder.

VBR_report2.png

Figure 2. Bitrate control techniques available in the Adobe Media Encoder.

The two most common techniques are:

•          Constant bitrate encoding (CBR), where the same bitrate is applied to the entire file, irrespective of scene complexity. With CBR, you set the target bitrate (Figure 2) but not the Maximum, because the bitrate is not supposed to vary significantly, though it typically does to some limited degree, as shown in Figure 3.

Figure 3 shows a file encoded using CBR. As you can see in the legend on the right, the average bitrate is 4936 kbps, while the peak is 5557 kbps. The wavy light blue line is the floating data rate, which varies minimally over the duration of the file. The individual columns are the size of each encoded Group of Pictures within the file, with a keyframe every three seconds in this 29.97fps file.

VBR_report3.PNG

Figure 3.  A CBR-encoded file in Bitrate Viewer.

Note that CBR is never a complete flatline; a variability of about 5-10% is normal.

•          Variable bitrate encoding (VBR), where the same overall target data rate is met, but the data rate is varied over the duration of the file to match scene complexity. With VBR, you set the Target and Maximum (Figure 2), and in some applications, the minimum as well. When you set a maximum, the VBR encoding is considered constrained, and VBR is often described by the percentage of the constraint. In Figure 2, the Maximum Bitrate is 2.4 Mbps, or 200% of the Target Bitrate of 1.2 Mbps. This technique would be called 200% constrained VBR.

Figure 4 shows the same file as Figure 3 encoded using 200% constrained VBR to the same target bitrate of 5000 kbps. The average bitrate is about the same (4988 kbps vs. 4936 kbps), but the peak bit rate is 9301 kbps, not quite 200% but in the ballpark. The wavy blue data rate line varies much more significantly than in Figure 3, with low rates at the start, and peaks throughout.

VBR_report4.PNG

Figure 4. The same file encoded using 200% constrained VBR.

•          Many producers default to CBR for some or all of their encoding. In the early days of streaming, the connections were so constrained that CBR was recommended to avoid data rate spikes that could stall smooth playback. In Apple Technote TN2224, Apple states “Bit Rate Variability – Should not exceed 10% of target bitrate.” More ominously, Apple’s Media Stream Validator, a tool used to test HLS streams, creates a warning if any stream segment bitrate varies from the target bitrate by over 10%. Not surprisingly, in a recent survey by the Streaming Learning Center, 11 of 16 respondents indicated that they were still using CBR encoding for some of their streams (Figure 5). Admittedly, the number of respondents is too small to be statistically significant, though the responses are valid for informational purposes.

VBR_report5.PNG

Figure 5. Eleven of 16 respondents were still using CBR on some of their streams, as well as other techniques.

As you can see in Figure 5, other bitrate control techniques exist, including Constant Rate Factor (CRF) and Capped CRF. However, since they are best used in very limited instances (mostly synthetic content like screencams and PowerPoint videos with audio) they are not included in this discussion.

Segment 2. CBR Delivers Overall Lower Quality than VBR 

Table 1 shows the results of one set of quality comparisons run for Jan Ozer’s upcoming book, Encoding by the Numbers, which is due out in the summer of ‘2016. These tests involved files encoded to 720p resolution at 2 Mbps using FFmpeg, with VQM scores measured by the Moscow University Video Quality Measurement Tool (VQMT). With VQM, lower scores are better, and in the table, scores in red are the worst, scores in green the best.

VBR_report6.PNG

Table 1. PSNR quality comparison for different bitrate control techniques.

Note the quality delta columns in Table 1. The first shows the total quality difference between the lowest and highest quality file in the group. The second shows the quality difference between the clips encoded using 110% and 200% constrained VBR. As you’ll see, producers can avoid transient quality issues and stay within Apple recommendations by using 110% constrained VBR. However, producers seeking the highest possible quality file, and unconcerned with Apple’s recommendations, should use 200% constrained VBR.

In all test cases, 2 Pass CBR delivered the worst quality, and in five of six, 200% constrained VBR delivered the highest quality. The sole exception was the talking head clip, where 1 pass CBR delivered the highest quality. This result appears to be an anomaly; in similar tests performed on three-low motion, talking-head clips, the results were consistent with all other files in Table 1. The highest variability was seen in the Big Buck Bunny clip, which showed a 14.54% quality differential between the lowest and highest quality clips (Total Quality Delta column).

The overall quality differential is otherwise relatively minor in most other clips. In fact, it’s probably not even observable during normal playback. However, in some instances, CBR files can exhibit a more serious problem; the transient quality drops shown in Figure 1.

Segment 3: CBR’s Transient Quality Issues Are Much More Concerning 

When you’re encoding challenging clips to aggressive parameters, CBR encoding can cause severe, transient quality issues like those shown in Figure 1. Figure 6 is the Results Visualization screen from the Moscow University VQMT tool, which shows the VQM scores (lower scores better) for two files. The file in red was encoded using 110% constrained VBR, while the file in blue is CBR. The circled data spikes show frames, or groups of frames, where the quality of the CBR file suffered dramatically as compared to the 110% constrained VBR file. The worst of these differentials is shown in Figure 1.

VBR_report7.PNG

Figure 6. The data rate spikes in the bottom figure show frames, or groups of frames, where CBR quality is dramatically worse than 110% constrained.

What’s interesting is that the peak bit rate for the CBR file actually exceeds that of the VBR file. You can see this in Figure 7, which shows Bitrate Viewer analyzing the CBR file (on top) and the VBR file. The sideboards on the right show the average and peak bitrates for both files. The average is nearly identical, while the peak rate for the CBR file is 2623 kbps compared to 2539 kbps for the 110% constrained VBR file (but see note 5 below). Whether your concern is streaming efficiency, heeding Apple’s 110% variability recommendations, or both, constrained VBR achieves a superior result, while also delivering overall higher quality and avoiding the transient quality drops seen in the CBR file.

VBR_report8.PNG

Figure 7. Bitrate Viewer analyzing the CBR file up top and 110% constrained VBR file on the bottom.

You can watch a short video illustrating and explaining these issues immediately below.