====== ffmpeg - Encoding - h265 - Constant Rate Factor (CRF) ====== Use this mode to retain good visual quality and do not care about the exact bitrate or filesize of the encoded file. * The mode works exactly the same as in x264, except that maximum value is always 51, even with 10-bit support, so please read the [[https://trac.ffmpeg.org/wiki/Encode/H.264#crf|H.264]] guide for more info. ---- ffmpeg -i "input.mkv" -map 0:v -map 0:a:m:language:eng? -map 0:s:m:language:eng? -map 0:d? -map 0:t? -c:v libx265 -crf 23 -c:a copy -threads 12 -bufsize 4M "out.mkv" ---- ===== Example ===== ffmpeg -i input -c:v libx265 -crf 26 -preset fast -c:a aac -b:a 128k output.mp4 **NOTE:** * **-crf**: CRF affects the quality. * The default is 28, and it should visually correspond to libx264 video at CRF 23, but result in about half the file size. * CRF works just like in x264, so choose the highest value that provides an acceptable quality. * **-preset fast**: Choose a preset. * The default is medium. * The preset determines compression efficiency and therefore affects encoding speed. * Valid presets are ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, and placebo. * Use the slowest preset you have patience for. * Ignore placebo as it provides insignificant returns for a significant increase in encoding time. * **-tune**: Choose a tune (optional). * By default, this is disabled, and it is generally not required to set a tune option. * x265 supports the following -tune options: psnr, ssim, grain, zerolatency, fastdecode. * They are explained in the [[https://trac.ffmpeg.org/wiki/Encode/H.264#crf|H.264 guide]]. ---- ===== References ===== https://trac.ffmpeg.org/wiki/Encode/H.264#crf