Detect HDCD Audio with FFmpeg hdcd Filter

This guide explains how to check if an uncompressed or lossless audio file contains High Definition Compatible Digital (HDCD) metadata using FFmpeg's built-in hdcd filter. By scanning the audio track without creating a new file, you can quickly determine whether HDCD features—such as peak extension or dynamic gain adjustments—are present in your source media.

The Detection Command

To scan an audio file for HDCD flags, run the file through FFmpeg with the hdcd filter enabled and direct the output to the null muxer. This processes the entire audio stream without writing a new file to your disk:

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

Replace input.flac with the path to your source audio file (typically a 16-bit PCM WAV, FLAC, or ALAC file ripped directly from a CD).

Interpreting the Output

During processing, the filter analyzes the least significant bits of the audio data. Once the scan completes, FFmpeg outputs a summary block in your terminal generated by [Parsed_hdcd_0 ...].

Look for the following lines at the end of the log output:

  • HDCD detected: yes / no: Indicates whether valid HDCD control codes were discovered in the stream.
  • Peak extend: Indicates whether peak extension was actively used (enabled) or not used (never enabled). Peak extend provides extra headroom by compressing peaks above -9 dBFS during mastering, which can be expanded to 24-bit dynamic range upon decoding.
  • Transient filter: Indicates whether the transient filter was triggered by the mastering process.
  • Target gain: Shows if any digital gain matching or attenuation was applied.

If the output reads HDCD detected: no, the audio either lacks HDCD mastering or the flags were corrupted during a previous lossy conversion, resampling, or volume adjustment.

Filtering the Command Output

Because FFmpeg prints standard progress updates to stderr, you can isolate the HDCD detection status directly using filtering tools:

On Linux/macOS:

ffmpeg -i input.flac -af hdcd -f null - 2>&1 | grep -i "hdcd detected"

On Windows (Command Prompt):

ffmpeg -i input.flac -af hdcd -f null - 2>&1 | findstr /i "hdcd"

Important Requirements for Accurate Detection

  1. Bit-Perfect Source: HDCD metadata is encoded into the 16th bit of standard 16-bit Red Book audio. Any alteration to the original data—including software volume normalization, resampling, dither, or lossy encoding (such as MP3 or AAC)—will permanently destroy the HDCD control codes.
  2. Full Scan: Because HDCD control codes may only appear periodically or when specific mastering features are triggered, you must allow FFmpeg to analyze the entire track to guarantee complete detection.