Preview Audio Filterchains with FFplay
Testing complex audio filters directly in ffmpeg can be
time-consuming because it requires rendering, encoding, and saving a new
file to disk before you can listen to the result. By using
ffplay, the lightweight media player included with the
FFmpeg suite, you can listen to audio filterchains rendered in real
time. This guide explains how to apply the -af flag in
ffplay to audition audio filters instantly before
committing to a final ffmpeg render.
Basic Syntax
The syntax for applying audio filters in ffplay is
identical to ffmpeg. You pass the -af (or
-filter:a) option followed by your filter string.
To play an audio file with a filter while disabling the default
video/visualizer display window, use the -nodisp flag:
ffplay -nodisp -af "filter_name=parameter1=value:parameter2=value" input.wavIf you omit -nodisp, ffplay opens an SDL
window displaying an audio waveform or frequency spectrum, which can
also be useful for visual monitoring.
Common Audio Preview Examples
1. Volume and Equalization
To audition a volume boost alongside a peaking equalizer filter:
ffplay -nodisp -af "volume=1.5,equalizer=f=1000:t=q:w=1:g=3" input.mp3In this command:
volume=1.5increases the overall amplitude by 50%.equalizer=f=1000:t=q:w=1:g=3adds a 3dB gain at 1000 Hz with a Q factor of 1.
2. Highpass and Lowpass Filtering
To preview band-limiting (removing low-end rumble and harsh high frequencies):
ffplay -nodisp -af "highpass=f=80,lowpass=f=12000" input.wav3. Dynamic Range Compression
Previewing compressors is critical because incorrect attack, release, or threshold settings can cause audio distortion or unnatural pumping:
ffplay -nodisp -af "acompressor=threshold=-20dB:ratio=4:attack=5:release=50" input.wav4. Loudness Normalization (EBU R128)
To test how dynamic normalization affects your track's balance:
ffplay -nodisp -af "loudnorm=I=-16:TP=-1.5:LRA=11" input.wavLooping for Repetitive Auditioning
When fine-tuning parameters, it is helpful to loop a specific section of the audio file repeatedly:
ffplay -nodisp -ss 00:00:30 -t 10 -loop 0 -af "acompressor=threshold=-15dB:ratio=3" input.wav-ss 00:00:30starts playback at 30 seconds.-t 10limits playback duration to 10 seconds.-loop 0loops playback indefinitely until you close the player.
Migrating from FFplay to FFmpeg
Once the audio sounds correct in ffplay, copy the entire
filterchain string into your ffmpeg command. Replace
ffplay -nodisp with ffmpeg -i and define your
output codecs and container:
Previewing with ffplay:
ffplay -nodisp -af "highpass=f=100,acompressor=threshold=-18dB:ratio=3,volume=1.2" input.wavEncoding with ffmpeg:
ffmpeg -i input.wav -af "highpass=f=100,acompressor=threshold=-18dB:ratio=3,volume=1.2" -c:a aac -b:a 192k output.m4aUsing this workflow prevents unnecessary encoding passes, reduces disk I/O, and ensures your filter parameters are dialled in accurately before rendering large batches of files.