Best settings for converting from h264 to hevc?

1

I'm trying to convert some of my library to HEVC to save space. The idea being I re-encode the existing media and save 20-50% file size.

What would be some recommended settings for converting and having minimal quality loss, while saving as much file size as possible (quality over file size).

The current command I'll be using is generally

ffmpeg -i input.mkv -c:v hevc -c:a copy -crf ??? output.mkv

Note that encoding from the original medium is not an option for me right now. I would have to use the current files I have.

cclloyd

Posted 2018-06-25T02:15:58.017

Reputation: 331

Answers

4

There is no best settings because quality is subjective, but the usual guidelines of libx265 (assuming you are using this encoder) is similar to libx264:

  • Use the highest -crf value that gives you an acceptable quality. Default value is 28.
  • Use the slowest -preset you have patience for. Default value is medium.
  • Stream copy the audio (which you are already doing).

Note that you will be re-encoding the artifacts present in your H.264 inputs which will harm compression efficiency.

I generally wouldn't bother re-encoding H.264 to H.265.

See FFmpeg Wiki: H.265 for some basic info.

llogan

Posted 2018-06-25T02:15:58.017

Reputation: 31 929

1Just a couple of quick clarifications:

  • For -crf, lower numbers mean better quality.
  • For -preset, I've not noticed any particular improvement in filesize or quality with presents slower than medium.
  • < – Christophe – 2018-12-14T00:26:14.513

@Christophe According to the ffmpeg docs, slower presets don’t affect quality, only file size. – Simon East – 2019-09-21T15:19:01.407