2

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.

10

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.

3
  • 1
    Just 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 Dec 14 '18 at 0:26
  • @Christophe According to the ffmpeg docs, slower presets don’t affect quality, only file size. – Simon East Sep 21 '19 at 15:19
  • { ffmpeg -strict 2 -hwaccel auto -i "inputfile.mp4" -c:v hevc_nvenc -rc vbr -cq 24 -qmin 24 -qmax 24 -profile:v main10 -pix_fmt p010le -b:v 0K -c:a aac -map 0 "outputfile.mp4" } – Sriram Murali May 8 '20 at 17:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.