CODECbench can easily be used to calculate ‘Per-Title’ optimization values when encoding content. The main idea behind Per-Title optimization is that one should choose bitrate values for encoding that depend on the rate distorsion curves for the content being encoded. Netflix has a good overview of how this works in their platform. Per-Title tries to answer these questions:
- Given a desired video quality, what’s the optimal bitrate for this content?
- Given a number of different resolutions for video available, at what moment does one need to switch from one resolution to the next?
Netflix and others approach this problem by drawing a convex hull on top the of the PSNR curves of the different resolutions, then drawing samples from this convex hull to obtain the resolution x bitrate pairs.
CODECbench does this slightly different by using a full scale metric like SSIM and establishing a minimum desired quality for such metric across the encoding of the title. By using a full metric CODECbench avoids having to derive a convex hull line that has to be suboptimally sampled. Then using the ‘Optimal Bitrate Resolution Switching’ report we can calculate our switch points.
Let’s look at an example for the coastguard sequence SSIM RD curve in 4 different resolutions..
In order to find out the bitrate switching points, we just have to define a ‘minimum’ level of quality desired for the sequence. For example values of 0.8, 0.9 and 0.95 would be reasonable for SSIM. We add a ‘minqual’ parameter to the SSIM report to obtain the switching points:
"minqual": [0.8, 0.9, 0.95] #minimum quality required. Scalar values are acceptable too
One the sequences above this produces for 0.9 and 0.95:
Bitrate switch for 1920×1080@0.9 at 1658351.3268310914 bps. 1280×720 qual at br is 0.9324741017417775
Bitrate switch for 1280×720@0.9 at 989156.8165966908 bps. 640×480 qual at br is 0.9428834337863248
Bitrate switch for 640×480@0.9 at 485318.3305768017 bps. 320×240 qual at br is 0.9349399124018616
Minimum bitrate for 320×240@0.9 at 280510.36393845885 bps.
Bitrate switch for 1920×1080@0.95 at 3857779.601799102 bps. 1280×720 qual at br is 0.9628820330960579
Bitrate switch for 1280×720@0.95 at 2493719.9488699837 bps. 640×480 qual at br is 0.9737948824384565
Bitrate switch for 640×480@0.95 at 1163040.4454250892 bps. 320×240 qual at br is 0.9714908213551666
Minimum bitrate for 320×240@0.95 at 659464.021887705 bps.
Notice how precisely at the point where the switch happens the previous resolution will always have a higher quality metric. This is expected, as the resolution we are switching from is being encoded with more bits than needed.
Go ahead and check this out with your own sequences and CODECbench