Why does a H.264 encode of a H.265 video increase the file size?

Viewed 30

So recently I had to use ffmpeg to make a video go from H.265 to H.264 to make it more web compliant.

The file size went from 4.32 MB to 10.32 MB.

In my head we have a video that is done in H.265. H.264 is of course worse and there has already been a run of H.265, so it will barely be able to do something. This is where I imagine it would go from 4.32 MB -> 4.12 MB. However it does not, it rather doubles in size.

Analogy: Let's say you have a professional painter (H.265) that does a painting. Then his older brother (H.264) who is not as good paints over with a little bit of their details. The artwork will now look worse, but at the same time it will cost less.

Have I completely misunderstood how codecs work? Can you "revert" back to a former codec, then resulting in a bigger file size?

1 Answers

In general H.265 is more efficient than H.264. Efficiency means:

  • With H.265 you will get better quality at the same file size or
  • the same quality with a smaller file

This is true if you start with an uncompressed or high quality file and use a high quality H.264 and compare it to high quality H.265 compressor.

If you start with a compressed H.264 file and transcode to H.265 - all bets are off. If you add a generation (decompress and recompress) quality goes down.

If you have a very good H.264 compressor aka 'x264' and compare it to a bad H.265 compressor - H.264 can outperform H.265.

Keep in mind compressors are not standardized - pretty much the only rule for a compressor - it needs to decompress correctly.

Each vendor (or open source project) adds a secrete (or open) sauce.

You can control the quality with a vast set of parameter - including the bitrate. So if you specify a higher bitrate (or the default is higher) then your H.265 may get bigger than H.265 - so try to specify a lower bitrate and compare the quality.

Related