Configure DSD Decimation and Cutoff in FFmpeg
This article explains how to configure decimation and cutoff frequency when decoding Direct Stream Digital (DSD) files to Pulse Code Modulation (PCM) using FFmpeg. You will learn how FFmpeg handles DSD decimation by default, how to customize the output sample rate (resampling), and how to apply low-pass filters to eliminate high-frequency DSD quantization noise.
Understanding DSD to PCM Conversion in FFmpeg
DSD audio uses a 1-bit high-sample-rate format (typically 2.8224 MHz
for DSD64). When FFmpeg decodes DSD to PCM, it uses an internal library
called dsd2pcm.
- Decimation: By default, FFmpeg decimates the signal by a fixed factor of 8. For DSD64, this outputs a 352.8 kHz PCM stream.
- Cutoff Frequency: Because DSD relies on noise shaping, there is a massive amount of high-frequency quantization noise above 20 kHz. To prevent this noise from reaching your DAC or speakers, a low-pass filter must be applied to establish a cutoff frequency.
Configuring Decimation (Output Sample Rate)
Because the decoder’s hardware-level decimation is fixed at 8x,
further decimation is achieved using FFmpeg’s resampling filters. You
can downsample the output to standard rates like 88.2 kHz or 176.4 kHz
using the -ar flag or the aresample
filter.
For the highest quality, use the SoX resampler engine:
ffmpeg -i input.dsf -af "aresample=resampler=soxr" -ar 88200 output.flacIn this command, the DSD file is decoded to 352.8 kHz PCM and then decimated further to 88.2 kHz.
Configuring the Cutoff Frequency
To remove high-frequency noise, you must chain a lowpass
audio filter to the command. The f parameter defines the
cutoff frequency in Hertz.
Recommended cutoff frequencies: * DSD64: 24,000 Hz to 30,000 Hz * DSD128: 40,000 Hz to 50,000 Hz
Example: 24 kHz Cutoff and 88.2 kHz Decimation (DSD64)
To convert a DSD64 file (.dsf or .dff) to
an 88.2 kHz FLAC file with a steep 24 kHz cutoff filter:
ffmpeg -i input.dsf -af "lowpass=f=24000, aresample=resampler=soxr" -ar 88200 output.flacExample: 40 kHz Cutoff and 176.4 kHz Decimation (DSD128)
To convert a high-rate DSD128 file to 176.4 kHz PCM while preserving more high-frequency headroom with a 40 kHz cutoff:
ffmpeg -i input.dsf -af "lowpass=f=40000, aresample=resampler=soxr" -ar 176400 output.wavDouble-Pole Low-Pass Filter for Steeper Roll-Off
A single low-pass filter might have a shallow slope. To create a steeper roll-off to completely isolate ultrasonic noise, you can stack two low-pass filters in your filtergraph:
ffmpeg -i input.dsf -af "lowpass=f=24000, lowpass=f=24000, aresample=resampler=soxr" -ar 88200 output.flac