When is re-encoding to x265 likely to save disk space?

I have done a bit of experimenting with this and would like to share some results:


Raw values
height_banded  fps_banded
480p           24            0.103138
               30            0.055509
               60                 NaN
               120                NaN
720p           24            0.062486
               30            0.049581
               60            0.026183
               120                NaN
1080p          24            0.060491
               30            0.046737
               60            0.027326
               120                NaN
4k             24            0.040330
               30            0.033251
               60            0.019706
               120           0.010484

The gist of it is that the more pixels you have either per frame or per second, the more similar each pixel is to each other nearby pixel, both in space and time, and the smaller the file that the encoder will be able to produce for the same effort.

I’ve defined average bits per pixel here as total file size / (FPS * duration * resolution). This will tend to over-penalise lower-resolution files a bit, as the audio is likely to make up a larger proportion of the total file size, but overall I don’t think this is a huge effect, and this is a relatively simple measure to calculate.

There is a lot of variation between files even within the same resolution and FPS categories, but
I find that this is a good heuristic to identify files that are ripe for re-encoding. If they have a much higher bits-per-pixel value than those shown here, there’s a good chance that you can save a decent chunk of disk space without any obvious drop in quality.

Whether this is worthwhile to do or not is another question - it depends whether you plan to distribute the resulting file, and how much it costs you in electricity vs. the cost of buying extra storage. If you think you can get a 2/3 reduction in file size or better, your electricity is cheap, and you have an idle CPU available, I’d say go for it, but otherwise maybe don’t bother.

5 Likes