How to Use FFmpeg apulsator for Audio Auto-Pan

This guide explains how to use the FFmpeg apulsator filter to create a dynamic auto-pan effect that automatically sweeps audio back and forth between the left and right channels. You will learn the basic syntax of the filter, understand its key parameters like frequency and depth, and see practical command-line examples to apply this spatial audio effect to your audio or video files.

Understanding the apulsator Filter

The apulsator filter is an audio modulation tool in FFmpeg that uses a Low-Frequency Oscillator (LFO) to modulate the volume of the left and right channels out of phase. This phase offset creates the psychoacoustic perception of the sound physically moving from left to right and back again.

Key Parameters

To customize the auto-pan effect, you can adjust several parameters within the filter:

Practical Examples

To apply the filter, use the -af (audio filter) flag in your FFmpeg command.

1. Basic Auto-Pan Effect

This command applies a standard auto-pan effect using the default settings (a smooth sine wave at a speed of 2 Hz):

ffmpeg -i input.mp3 -af "apulsator" output.mp3

2. Slow and Subtle Panning

For a slower, gentler transition that does not fully mute either channel, lower the frequency (hz) and decrease the modulation depth (amount):

ffmpeg -i input.mp3 -af "apulsator=hz=0.5:amount=0.7" output.mp3

In this example, the sound takes 2 seconds to pan from one side to the other, and the depth is capped at 70% to prevent hard-panning.

3. Linear “Ping-Pong” Panning

To make the audio sweep back and forth at a constant, linear speed rather than a smooth curve, change the LFO wave shape to triangle:

ffmpeg -i input.mp3 -af "apulsator=hz=1:timing=triangle" output.mp3

4. Applying to Video Files

You can also apply this effect directly to the audio track of a video file while keeping the original video stream intact without re-encoding it:

ffmpeg -i input.mp4 -af "apulsator=hz=1" -c:v copy output.mp4