Ch. 21 · Platform Uploads and Re-encoding

한국어日本語
7 min

Re-encoding Loss: Generations Stack Up

Re-compressing video that has already been through lossy compression takes more out of information that's already been cut. The lower the quality of the input, the less room the second encode has to make up for it, and you can use this site's tool to gauge the direction of the size change.

The principle of generation loss was covered in Chapter 18's archive and upload recipes. Here is a short recap tailored to platform uploads. There are two key points. First, lossy compression cannot bring back information it has thrown away. Second, a re-encode treats the artifacts already in the input (blocking, smearing) as 'content to be drawn' and tries to compress them again. So if the input has a blocky pattern, bits get spent preserving that pattern, and there may not be enough left for the detail that actually matters (blocking, ringing).

Comparing three situations

SituationPlatform inputWhat generally happens after re-encoding
A. You upload a near-lossless sourceAlmost no compression tracesThe loss from the platform's encode is applied just 'once'
B. You upload a file compressed once at high qualityOne small lossLoss stacks twice, but because the first is small it may not be noticeable
C. You upload a file compressed heavily to cut sizeBlocking and banding already presentThe platform's encode adds on top of existing defects, so they can become more prominent

This is a qualitative description. Concrete quality numbers depend on the platform's encoder and settings, and this site has not measured them.

What this site has and hasn't measured

This site's measurements are results of encoding with FFmpeg on my own PC. We have never measured what encoder or settings YouTube or social networks use internally, and we have no data comparing post-re-encode quality across platforms. So nothing in this chapter asserts 'the platform does it this way,' and the tool below is only for predicting size when you re-encode something yourself.

How much does file size change to keep the same quality? A predictor

The re-encode size predictor takes the source codec, the codec to switch to (H.264, HEVC, AV1), and the file size, and reads out how many times larger the file becomes at the same VMAF from this site's public measurement data. For example, when moving between codecs of different compression efficiency, you can see the direction: does the size shrink or grow. The tool reads the numbers from the data file, so this article doesn't list them separately. The result is a reference value based on measurements of four 10-second clips (see the limitations in the measurement article), and it is not guaranteed to match your video or a platform's processing.

Even if you switch codecs, the platform has its own preferred formats

Making your upload file AV1 may shrink it and speed up the upload, but that doesn't mean the re-encoded result gets better. Which codecs and containers a platform accepts is determined by its official help pages. For a general comparison of video codec efficiency, see the CRF sweep measurement.

Generation lossGeneration loss

The effect where each round of lossy compression discards more information and quality degrades step by step.

VMAFVMAF

A metric that compares the original with the encoded result and estimates perceived quality on a scale of roughly 0 to 100. It is the comparison standard for this site's measurements.

Check yourself

What problem can occur in a re-encode when the input video already has blocking?

Check yourself

Which statement about this site's re-encode size predictor is correct?