How to Configure FFmpeg HDCD Filter Decoding Mode
This guide explains how to configure the decoding mode and options of
the hdcd filter in FFmpeg. You will learn how to customize
stereo processing, toggle specific High Definition Compatible Digital
(HDCD) features like Peak Extension and Target Gain, and utilize the
filter’s built-in analysis tools to optimize your high-fidelity audio
conversion workflow.
The Basic HDCD Decoding Command
By default, the FFmpeg hdcd filter detects HDCD encoding
and decodes the 16-bit input into a 20-bit audio stream (typically
outputting to a 24-bit PCM file). The most basic command to apply the
filter is:
ffmpeg -i input.flac -af hdcd output.wavTo customize how the filter decodes the audio, you must pass specific
parameters to the -af hdcd argument.
Configuring Decoding Parameters
You can configure the decoding behavior using several key options,
formatted as key-value pairs separated by colons:
-af hdcd=parameter1=value1:parameter2=value2.
1. Stereo Processing Mode
(process_stereo)
This option controls how the filter handles stereo channels. *
process_stereo=1 (Default): Processes the
left and right channels as a matched stereo pair. If HDCD packets are
detected on only one channel, the filter will apply decoding to both. *
process_stereo=0: Processes each channel
independently. This is useful for dual-mono files or non-standard stereo
tracks where only one channel contains HDCD encoding.
Example Command:
ffmpeg -i input.flac -af hdcd=process_stereo=0 output.wav2. Disabling Peak Extension
(disable_pe)
Peak Extension is an HDCD feature that compresses peaks to increase
dynamic range. The hdcd filter decodes this by expanding
the peaks back to their original levels. You can disable this behavior
if you want to keep the compressed peaks. *
disable_pe=0 (Default): Decodes and
expands Peak Extension. * disable_pe=1:
Disables Peak Extension decoding.
Example Command:
ffmpeg -i input.flac -af hdcd=disable_pe=1 output.wav3. Disabling Target Gain
(disable_tg)
Target Gain is used in HDCD to attenuate the signal volume. By
default, the filter gains back this volume during decoding. You can
disable this volume adjustment if needed. *
disable_tg=0 (Default): Decodes and
applies Target Gain adjustments. *
disable_tg=1: Disables Target Gain
decoding.
Example Command:
ffmpeg -i input.flac -af hdcd=disable_tg=1 output.wav4. Configuring Analyze Mode
(analyze)
Instead of standard decoding, you can configure the filter to output
visual cues in the audio data or logs to analyze how the HDCD file was
authored. * analyze=0 (Default): Standard
decoding mode. * analyze=1: Visualizes
Peak Extension activity. * analyze=2:
Visualizes Target Gain activity. *
analyze=3: Visualizes Transient Filter
activity.
Example Command (to analyze Peak Extension):
ffmpeg -i input.flac -af hdcd=analyze=1 output.wavAdvanced Configuration Example
You can combine multiple parameters to fully customize your decoding mode. For example, if you want to decode a file while processing channels independently and disabling both Peak Extension and Target Gain, use the following command:
ffmpeg -i input.flac -af hdcd=process_stereo=0:disable_pe=1:disable_tg=1 output.wav