How to Use the HDCD Filter in FFmpeg

This guide explains how to use the High Definition Compatible Digital (HDCD) filter in FFmpeg to decode 20-bit audio data embedded within standard 16-bit HDCD-encoded audio files. You will learn the essential command-line syntax, how to detect HDCD encoding in your source files, and how to configure key parameters to ensure high-fidelity audio extraction.

Understanding the HDCD Filter

HDCD is a recording process that encodes 20-bit audio resolution into a standard 16-bit CD-DA audio track using a form of dynamic range expansion and transient filtering. To retrieve the original 20-bit depth, you must decode the file using FFmpeg’s hdcd audio filter and save the output in a format that supports at least 24-bit depth, such as a 24-bit WAV or FLAC file.

Basic Command Syntax

To decode an HDCD-encoded audio file, apply the -af hdcd filter and specify a 24-bit output codec (like pcm_s24le for WAV or flac for FLAC).

ffmpeg -i input.wav -af hdcd -c:a pcm_s24le output.wav

If you prefer to output to a FLAC file, use this command:

ffmpeg -i input.wav -af hdcd output.flac

Note: FFmpeg automatically selects a 24-bit sample format for FLAC when the filter outputs 24-bit audio.

Detecting and Analyzing HDCD Content

If you are unsure whether a CD rip actually contains HDCD encoding, you can run the filter and send the output to a null destination. FFmpeg will analyze the audio and display statistics in the terminal.

ffmpeg -i input.wav -af hdcd -f null -

At the end of the process, look at the console output for the [Parsed_hdcd_0] lines. If the output shows HDCD detected: yes, your file contains HDCD data. The log will also show whether features like “Peak Extension” or “Transient Filter” were detected and utilized.

Key Filter Options

The hdcd filter has several optional parameters that you can customize depending on your specific hardware or audio preferences:

To pass these options to the filter, use the following syntax:

ffmpeg -i input.wav -af "hdcd=disable_atf=true:enable_es=true" output.flac