What Is Per-Title Encoding?

Written by:
November 15th, 2017

Per-Title Adaptation allows encoding optimization for video delivery

By encoding video at bitrates appropriate to the content of the video file, content providers can make significant bandwidth savings as well as quality improvements.

Introduction

Per-Title Encoding is not a new concept. In fact you can find research online that dates back several years, including this 2012 presentation: Choosing the Segment Length for Adaptive Bitrate Streaming and the 2011 paper: Dynamic Adaptive Streaming over HTTP Dataset, both from our own co-founders. Most of the early research concluded that Per-Title Encoding was effective in test environments, but was not suitable for commercial application because it did not work with a fixed bitrate ladder. This is due to the fact that every piece of content is different, and so each video would require individual analysis as a first step.

In 2015 Netflix managed to mitigate the overhead of the extra analysis step and implement Per-Title Encoding at scale. As a result, they increased the quality of experience and achieved significant bandwidth savings. These optimizations are achieved by increasing or decreasing the bitrate of each bitrate ladder entry based on a complexity measurement for each input file. It sounds simple enough, but believe me, there is a good reason that Netflix took years to make Per-Title Encoding a viable part of their video delivery workflow.

But to fully understand the complexity of the challenge, it’s best to start at the beginning:

What is Per-Title Encoding?

Put simply, it’s a form of encoding optimization that customizes the bitrate ladder of each video, based on the complexity of the video file itself. The ultimate goal is to select a bitrate that provides enough room for the codec to encapsulate enough information to present a perfect viewing experience, but no more. Another way of thinking about it is that the optimized adaptive package has been reduced down to just the information that viewers can actually enjoy. Anything beyond the human eye’s ability to perceive is stripped out.

Complexity comparison for video encoding complexity

Complex scenes with motion and textures require higher bitrates than scenes with less movement.

This “optimal” bitrate varies for each type of content, and even from title to title. Action scenes or sports scenes typically require a higher bitrate to store the information, as they contain a lot of motion and less redundancies making each scene more complex. Therefore they also contain less opportunities to compress data, without impacting the perceived quality of the content. On the other hand, documentaries typically have far less motion during any given scene, which leaves a codec more possibilities to compress the given information more effectively without losing perceptual quality. If you take those characteristics and adjust the encoding profile accordingly, you are able lower the bitrate but still maintain a very good perceived quality for your content.

In order to decide which bitrate fits best for each specific piece of content, you need a good quality metric to measure against. Gathering this information typically requires several encodings where different types of content, all of which need to be encoded with a variety of different bitrate settings. Once that is complete a PSNR (Peak to Signal Noise Ratio) analysis of each encoding needs to be performed to form an objective impression of the effectiveness of these encoding parameters.

Quick Fact #1: If you compare an encoding with a PSNR of 45 dB or higher with its source video, you won’t notice any difference although less information is used to render this content. On the other hand, a PSNR of 35 dB or lower would definitely show noticeable differences between the encoding and its source file.

Based on the results of this analysis, you can derive a custom bitrate ladder to encode each content file accordingly. This approach works, and will result in an improved quality of experience and in the vast majority of cases, a reduction in bandwidth usage as well. This is of course of paramount importance to most online content providers, VoD and OTT platforms in particular.

This is OK for a start, but as you apply this optimization to a large number of titles, you will begin to see limitations in the PSNR metric. An improved method for analysing the visual quality of an image is the Structural SIMilarity (SSIM) index. SSIM is a method for measuring the similarity between two images. Essentially one image is taken as a control, and considered “perfect quality” and the second image in them compared against it and is a useful method for measuring the results of your optimization. SSIM is a perception-based model and is focused on changes (structure, luminance) that impacts the perceived quality. This provides an improved impression about the quality of our content compared to PSNR, but is also a bit more compute intensive.

How you can do it with Bitmovin?

Let’s quickly recap what we have learnt until now. While a fixed bitrate ladder is not ideal for every type of content, being able to create an optimal bitrate ladder for each and every encoding is very time consuming and expensive. So we need a way to efficiently adapt a given bitrate ladder to the complexity needs of the content.

 

Explanation of Per-Title Encoding workflow

As shown in the figure above, the first step of a Bitmovin Per-Title encoding is to compute a “complexity factor” for a given input. With our API, this is done during the “complexity analysis” of your input file. H264 provides an option called CRF (Constant Rate Factor). This factor specifies a “quality level”, which is achieved by varying the bitrate based on the amount of motion detected in the video content. The average bitrate of a CRF encoding, allows us to get an impression of the overall complexity of this video asset and to derive a “complexity factor” from it.

Quick Fact #2: The complexity factor has a value range of 0.5 to 1.5. Content which has a complexity factor between 0.5 and 1 is considered to be less complex, while a complexity factor between 1 and 1.5 relates to content with a higher complexity.

Adjusted Encoding Profile

With this “complexity factor” we can adjust the given bitrate ladder. Keep in mind that we do not just consider the “complexity factor” but also the resolution of the bitrate ladder entry we want to adjust.

ResolutionBitrate
[kbps]
Complexity
Impact
WidthHeightlowhigh
1920auto43001.50.3
1280auto25001.30.4
1280auto190010.45
960auto13000.90.9
640auto8000.451
480auto4500.41.3
320auto2600.31.5

For low complexity content we can reduce the higher bitrate levels to a higher degree, without losing on visual quality and also gain the most from the bitrate savings. The lower bitrate levels are adjusted as well, but not as significantly as the higher bitrate levels to avoid degradation of visual quality.

For high complexity content it basically works the other way around. We do not adjust the high bitrate levels too much as a significant increase in bitrate would usually not gain much on visual quality. However, low bitrate levels are increased to a higher degree because adding bitrate we can significantly increase visual quality.

Why is that so? Modern codecs work more efficiently on larger resolutions, because they often contain bigger uniform areas, which can be compressed more effectively. Because of that, less bits are needed per pixel to achieve a similar quality with larger resolutions compared to smaller resolutions.

ABR encoded content

The following results show how this approach actually works. Less complex input files have bigger adjustments of their upper bitrate ladder entries and smaller ones for the lower values. Although the bitrate was reduced by 30%, the PSNR and SSIM stayed almost the same, so your customers would experience the same quality using less bandwidth, so your distribution costs would be reduced. This can be seen for the Cartoon “Glass Half”. Its PSNR value dropped from 51.51 dB to 47.78 dB, however it is still a very good quality, and your customers won’t notice because the differences are too small for the human eye to perceive. (remember Quick Fact #1).

Com-
plexity
WidthStatic
Bitrate
Bits
per
Pixel
PerTitle
Bitrate
Bits
per
Pixel
Bitrate
change
Static
PSNR
PerTitle
PSNR
PSNR
change
Static
SSIM
PerTitle
SSIM
SSIM
change
Sintel0.837192042070000.11231870000.085-24.25%45.1543.83-2.91%0.9830.979-0.42%
Animation128023550000.14118540000.111-21.27%38.9838.63-0.92%0.9660.963-0.35%
24 FPS128017900000.10714970000.090-16.37%38.5738.27-0.77%0.9620.959-0.33%
2.353 DAR96011960000.12710190000.108-14.80%36.9236.69-0.62%0.9460.943-0.32%
6407090000.1706570000.157-7.33%35.1235.03-0.25%0.9170.915-0.14%
4803910000.1663650000.155-6.65%32.7732.64-0.40%0.8870.886-0.14%
3202200000.2112090000.200-5.00%30.9830.93-0.18%0.8530.853-0.09%
Droneflight0.814192041440000.06729840000.048-27.99%41.5639.95-3.88%0.9710.960-1.20%
Documentary128023840000.08617920000.065-24.83%37.7437.25-1.29%0.9490.942-0.74%
30 FPS128017950000.06514510000.053-19.16%37.2636.88-1.02%0.9420.942-0.01%
1.778 DAR96012110000.0789990000.064-17.51%36.0735.81-0.71%0.9260.9361.08%
6407260000.1056630000.096-8.68%34.6334.55-0.22%0.9010.9212.26%
4803970000.1023650000.094-8.06%33.5233.46-0.17%0.8780.8992.43%
3202240000.1302100000.122-6.25%32.4932.46-0.11%0.8530.8762.76%
ToS1.046192042320000.11542890000.1161.35%42.7142.780.16%0.9850.9850.02%
Movie128024090000.14724530000.1501.83%38.2338.260.09%0.9730.9730.02%
24 FPS128018220000.11118590000.1132.03%37.6937.720.08%0.9690.9700.03%
2.400 DAR96012090000.13112600000.1374.22%36.0136.100.25%0.9580.9580.08%
6407180000.1757510000.1834.60%33.6433.720.23%0.9310.9320.10%
4803960000.1724200000.1826.06%30.9531.040.31%0.8980.9000.17%
3202240000.2192390000.2336.70%28.4628.540.28%0.8540.8550.19%
Caminandes1.091192041560000.08442720000.0862.79%40.9841.080.26%0.9730.9730.03%
Animation128023390000.10624250000.1103.68%37.3737.430.18%0.9630.9630.05%
24 FPS128017720000.08018410000.0833.89%36.8136.900.23%0.9590.9590.07%
1.778 DAR96011840000.09512820000.1038.28%35.5235.680.43%0.9480.9490.14%
6407090000.1287740000.1409.17%33.8233.960.42%0.9290.9310.16%
4803910000.1264370000.14011.76%32.1932.360.54%0.9100.9120.23%
3202210000.1602510000.18213.57%30.3530.530.59%0.8840.8860.23%
Motocross2.283192044610000.08661980000.12038.94%37.3038.954.42%0.9570.9691.18%
Action128025270000.11038000000.16550.38%35.2236.583.85%0.9420.9561.55%
25 FPS128019210000.08328820000.12550.03%34.2235.674.24%0.9290.9471.99%
1.778 DAR96012890000.09919350000.14950.12%33.3634.754.17%0.9180.9382.20%
6407760000.13511670000.20350.39%31.8132.973.66%0.8920.9132.34%
4804320000.1336500000.20150.46%30.0331.073.47%0.8540.8772.61%
3202480000.1723720000.25850.00%28.2229.062.99%0.8100.8282.29%
Glass Half0.764192030220000.06120910000.042-30.81%51.5147.78-7.22%0.9970.995-0.27%
Cartoon128019420000.08813770000.062-29.09%38.2137.82-1.02%0.9820.980-0.25%
24 FPS128015020000.06811660000.053-22.37%37.9337.59-0.91%0.9810.978-0.24%
1.778 DAR9609960000.0807940000.064-20.28%35.5335.28-0.68%0.9670.964-0.26%
6406020000.1095410000.098-10.13%33.1033.02-0.24%0.9410.940-0.13%
4803330000.1073020000.097-9.31%31.2231.15-0.23%0.9120.911-0.15%
3201900000.1371770000.128-6.84%29.4429.39-0.15%0.8760.875-0.10%

Highly complex videos on the other hand also show the expected behavior. While upper bitrate ladder entries are adjusted less, the lower bitrate ladder entries were increased accordingly in order to be able to still achieve an improved level of quality, which wouldn’t be the case if a fixed bitrate ladder would have been used.

All of these example encodings with playable comparisons are available to view on our demonstration page.

Can this workflow be optimized further?

Of course, there is always room for further improvements and optimizations, but there is are tradeoffs between efficiency and costs. Given a defined set of resolutions, the best possible bitrate ladder can be found by encoding the input file with a different set of bitrates for each resolution and performing a PSNR analysis for each of those. Those results will show us, which bitrate (x axis) provides the best possible quality (y axis) for a specific resolution. This bitrate is at the apex of each blue line, shown in the graph below. Based on that, you get a convex hull, which is then used, to select the pairs of resolution and bitrate which fits best for your encoding and its bitrate ladder.

 

Per-Scene Adaptation convex hull and pair resolutions

(Source: Netflix)

Although this allows us to define an “optimal” bitrate ladder for a particular video, it requires several encodings (e.g. 5 encodings with a different bitrate per rendition, and 5 renditions = 25 encodings to determine the final bitrate ladder). It isn’t guaranteed that those encodings are sufficient to determine a bitrate ladder, because you can’t tell beforehand if your range of bitrate is sufficient to determine the quality behavior of a resolution. This makes this approach more expensive also and increases the time it takes to determine the bitrate ladder.

In our described workflow, we are using one CRF encoding to evaluate the complexity factor of one low resolution encoding to adjust the bitrate of all entries in our bitrate ladder. Creating a CRF encoding for each resolution, would allow us to adjust the bitrate more specifically and would lead to further quality improvements and/or bandwidth savings.

Another optimization would be to specifically analyze your set of input files to evaluate their characteristics, and calculate an optimized complexity factor, which represents the complexity of your input files more precisely. These results can also be used with a machine learning approach.

Another simple optimization would be to take the specific details of the input file as a reference and adjust the bitrate ladder accordingly. This can be done already using Stream Conditions, so codec configurations can be skipped if they don’t meet certain conditions, e.g. that the input file resolution needs greater or equal than the width/height configured in the codec configuration. In this example the conditions avoid any possibility of upscaling, which goes hand in hand with losing quality.

Conclusion

Even though optimizing your content requires a little extra processing in the form of trial encodings, it is definitely worth it. The relatively small increase in encoding cost is easily outweighed by the bandwidth savings and the overall improvement in customer experience.

For more information, reach out to our solutions team for a demonstration or find out more about how Bitmovin can help you to solve complex problems in your video workflow.

Simple Share Buttons