How to reduce video file size with HEVC (H.265) codec?

I have been into video transcoding lately and my sole goal is to reduce video file size to the point that it does not hamper the video quality. I am comfortable with the FFmpeg tool for video transcoding tasks. I have heard that HEVC (H.265) gives better compression than H.264 video codec but when I try to transcode videos with HEVC codec my video file size does not reduce much compared to the same video transcoded with H.264 codec, is there any way to reduce video file size further with HEVC codec?

In order to reduce the video file size with the HEVC codec, an important point is to understand that HEVC takes less bitrate compared to AVC to give the same visual quality which allows it to produce video files in lower sizes. It is true that the HEVC codec gives better compression compared to the AVC codec.

But output video file size depends a lot on the rate control method you are using to transcode your video. If you are using CRF (Constant Rate Factor) rate control method specifying -crf option in FFmpeg, you have to set -crf value lower compared to what you are setting with H.264 codec which will allow FFmpeg to set a target bitrate such that it produces video file lower in size.

For example:

ffmpeg -i input.mp4 -c:v libx265 -crf 28 -preset medium -c:a copy output.mp4


  • -i input.mp4 is the input video file.
  • -c:v libx265 sets the video codec to HEVC (H.265) using the libx265 encoder.
  • -crf 28 controls the Constant Rate Factor (CRF), which specifies the video quality and file size. Values typically range from 18 to 28.
  • -preset medium sets the encoding preset. The medium preset provides a good balance between both encoding speed and file size reduction.
  • -c:a copy copies the audio stream without re-encoding, making sure that there is no loss in audio quality and maintaining the original audio format.
  • output.mp4 is the output video file.

With the HEVC codec and this command, you can compress the video to get a smaller file size without sacrificing good video quality. For your particular needs, adjust the CRF value and setting to obtain the ideal balance.

Keep that in mind, when you are using the rate control method which involves specifying target bitrates such as CBR (Constant Bitrate) and VBR (Variable Bitrate). You need to set bitrate 10-15% lower than what you are setting for AVC codec which will result in 10-15% better compression with HEVC codec.

I am trying this out but why does encoding HEVC in the “Quality” option take ages?

Because HEVC is trying out new techniques to enhance quality. It will experiment with various techniques until it can minimize the file size while maintaining the highest quality possible.