How to Use the FFmpeg apulsator Filter
This article provides a quick guide on how to use the
apulsator filter in FFmpeg to create dynamic audio panning
effects. You will learn what the filter does, its key parameters, and
how to apply it to your audio files using practical command-line
examples.
The apulsator filter in FFmpeg is an audio effect that
automatically pans sound between the left and right channels, creating a
pulsating tremolo or auto-pan effect. It achieves this by using a
Low-Frequency Oscillator (LFO) to modulate the volume of the audio
channels over time.
Basic Syntax
To apply the apulsator filter, use the -af
(audio filter) flag in your FFmpeg command:
ffmpeg -i input.mp3 -af apulsator output.mp3By default, this command applies a sinusoidal pulsation at a frequency of 2 Hz, smoothly moving the audio between the left and right speakers.
Key Parameters
You can customize the pulsation effect by passing specific parameters
to the filter. The syntax for adding parameters is
apulsator=parameter1=value1:parameter2=value2.
hz: Controls the frequency of the pulsation (how fast the sound moves back and forth) in Hz. The default is2.amount: Defines the modulation depth (how far the sound pans). It ranges from0.0(no effect) to1.0(full pan to left and right). The default is1.0.mode: Sets the shape of the LFO waveform. Options include:sine(smooth transition, default)triangle(linear transition)square(abrupt jumping between channels)sawup(gradual rise, sharp drop)sawdown(sharp rise, gradual drop)
offset_landoffset_r: Controls the phase offset for the left and right channels. The values range from0.0to1.0. By default,offset_lis0.0andoffset_ris0.5, which creates the alternating stereo effect.
Practical Examples
1. Fast Stereo Panning To make the audio pan back
and forth rapidly, increase the frequency (hz) to 7 Hz:
ffmpeg -i input.mp3 -af apulsator=hz=7 output.mp32. Subtle Panning Effect If you want a gentler
effect where the audio does not pan completely to the extremes of each
channel, reduce the amount to 0.4:
ffmpeg -i input.mp3 -af apulsator=amount=0.4 output.mp33. Choppy Square Wave Effect To create a harsh,
rhythmic switching effect between speakers, change the wave
mode to square and set the frequency to 3
Hz:
ffmpeg -i input.mp3 -af apulsator=mode=square:hz=3 output.mp3