How to Use FFmpeg Chroma Offset to Improve Quality

This article explains how to use the chroma offset parameters in FFmpeg to enhance the visual quality of your video encodes. You will learn how adjusting the quantization relationship between brightness (luma) and color (chroma) channels can prevent color bleeding, reduce banding, and improve overall color accuracy, along with practical command-line examples.

Understanding Chroma Offset

During video compression, encoders like H.264 (libx264) and H.265 (libx265) compress brightness (luma) and color (chroma) information separately. Because the human eye is much more sensitive to changes in brightness than in color, encoders automatically allocate less bitrate to chroma channels by assigning them a higher Quantization Parameter (QP).

While this compression technique is efficient, it can lead to issues like color bleeding, loss of detail in highly saturated areas (such as red text on a dark background), and color banding in dark scenes.

The chroma offset parameter allows you to manually adjust the QP of the chroma channels relative to the luma channel. By using a negative offset, you instruct the encoder to lower the chroma QP, allocating more bitrate to color detail and significantly improving visual quality.

How to Apply Chroma Offset in FFmpeg

In FFmpeg, chroma offsets are primarily configured through encoder-specific parameters. Below are the configurations for the most common video encoders.

1. Using libx264 (H.264)

For standard H.264 encoding, you can pass the chroma_qp_offset option inside the -x264-params flag.

ffmpeg -i input.mp4 -c:v libx264 -crf 20 -x264-params chroma_qp_offset=-2 output.mp4

2. Using libx265 (HEVC/H.265)

For H.265 encoding, the parameter is passed inside the -x265-params flag.

ffmpeg -i input.mp4 -c:v libx265 -crf 22 -x265-params cbqpoffs=-2:crqpoffs=-2 output.mp4