How to Generate Pink Noise with FFmpeg

Generating pink noise with FFmpeg is a straightforward process that utilizes the tool’s built-in audio source filters. This guide provides a direct, step-by-step tutorial on how to create a pink noise audio file using simple FFmpeg commands, explaining the necessary parameters to customize the duration, sample rate, and output format for your needs.

To generate pink noise, you will use the anoisesrc (audio noise source) filter inside FFmpeg. This filter allows you to specify the color of the noise, the sample rate, the amplitude, and the duration of the output file.

The Basic Command

Open your terminal or command prompt and run the following command to generate a 10-second WAV file of pink noise:

ffmpeg -f lavfi -i "anoisesrc=color=pink:sample_rate=48000:amplitude=0.5" -t 10 output.wav

Command Breakdown

Generating Pink Noise in MP3 Format

If you need a compressed, widely compatible format like MP3 and want a longer duration (for example, 5 minutes), use the following command:

ffmpeg -f lavfi -i "anoisesrc=color=pink:sample_rate=44100:amplitude=0.5" -t 300 -b:a 192k output.mp3

In this variation: * -t 300 sets the duration to 300 seconds (5 minutes). * -b:a 192k sets the audio bitrate to 192 kbps to ensure high-quality MP3 compression.