Configure Frequency and Offset in FFmpeg apulsator
This guide explains how to control the panning speed and stereo
channel phase using the hz (frequency) and
offset_l/offset_r (offset) parameters in the
FFmpeg apulsator audio filter. By adjusting these values,
you can customize the rate of the auto-pan effect and define how the
modulation interacts across the left and right stereo channels.
Understanding the Parameters
The apulsator filter produces an auto-pan or tremolo
effect by modulating the amplitude of audio channels using a
low-frequency oscillator (LFO).
- Frequency (
hz): Sets the modulation frequency in Hertz (cycles per second). For example,hz=1means the audio completes one full pan cycle every second. Alternatively, you can usebpmto set the frequency based on musical tempo. - Offset (
offset_landoffset_r): Sets the starting phase offset of the LFO for the left and right channels, represented as a value from0.0to1.0(where1.0corresponds to a full 360° phase rotation).- A standard auto-pan effect requires the left and right channels to
be 180° out of phase. This is achieved by setting a phase difference of
0.5between channels (such asoffset_l=0:offset_r=0.5). - If both offsets are identical (for example,
offset_l=0:offset_r=0), the channels modulate together in phase, creating a tremolo (volume pulse) rather than a stereo pan.
- A standard auto-pan effect requires the left and right channels to
be 180° out of phase. This is achieved by setting a phase difference of
Basic Command Syntax
The general syntax for configuring both options within an FFmpeg command is:
ffmpeg -i input.wav -af "apulsator=hz=0.5:offset_l=0:offset_r=0.5" output.wavIn this command:
hz=0.5slows the pan down to one full cycle every two seconds (0.5 Hz).offset_l=0starts the left channel modulation at phase0.offset_r=0.5offsets the right channel by half a cycle (180°), ensuring that as one side gets quieter, the other gets louder.
Adjusting Frequency Using BPM
If you prefer to lock the panning rate to a specific musical tempo,
replace hz with the bpm option:
ffmpeg -i input.mp3 -af "apulsator=bpm=120:offset_l=0:offset_r=0.5" output.mp3This synchronizes the full pan cycle to 120 beats per minute.
Customizing Offsets for Different Effects
Standard Auto-Pan (Left-Right Ping-Pong): Keep a difference of
0.5between channels:-af "apulsator=hz=1:offset_l=0:offset_r=0.5"In-Phase Tremolo (Mono Modulation): Set matching offsets to make the volume rise and fall simultaneously on both sides:
-af "apulsator=hz=2:offset_l=0:offset_r=0"Quarter-Phase Stereo Sweep (90-Degree Shift): Set a phase difference of
0.25for a less extreme, rotary-like stereo movement:-af "apulsator=hz=0.75:offset_l=0:offset_r=0.25"