Default CRF Value for x264 in FFmpeg

This article provides a quick guide to the default Constant Rate Factor (CRF) value for the x264 encoder in FFmpeg. It explains what the default value is, how the CRF scale works, and how to adjust this setting to balance video quality and file size in your encoding projects.

The default CRF value for the x264 encoder (libx264) inside FFmpeg is 23.

Understanding the CRF Scale

Constant Rate Factor (CRF) is the default quality-setting mode for the x264 encoder. Instead of targeting a specific bitrate, it adjusts the bitrate dynamically to maintain a consistent level of visual quality throughout the video.

The CRF scale runs from 0 to 51:

For most H.264 encoding tasks, the recommended CRF range is 18 to 28. * If you need high-quality encodes, use a lower CRF value (e.g., 18 to 21). * If you want to save bandwidth and storage space and do not mind minor compression artifacts, use a higher CRF value (e.g., 24 to 28).

How to Specify CRF in FFmpeg

To set a custom CRF value in FFmpeg, use the -crf flag in your command line. Here is an example of how to encode a video using a CRF of 20:

ffmpeg -i input.mp4 -c:v libx264 -crf 20 output.mp4

If you omit the -crf flag from your FFmpeg command, the encoder will automatically apply the default value of 23.