How to Generate an Audio Tone in FFmpeg?

FFmpeg also has the ability to generate sounds or tones natively. With the right kind of scripting you could make chiptune like music straight from the terminal. In this example, generating a single 2000Hz sound for 10 seconds is enough for now:

 $ ffmpeg -f lavfi -i "sine=frequency=2000:duration=10" output.mp3  

A new argument, lavfi, needs to be introduced here as this time there is no input media. Libavfilter,or lavfi as seen above, is an input virtual device that allows for filters, like sine, to virtually create data for future output.

sine
	Indicates the sine filter name. Sine generates signals made from sine waves

frequency, f
	Indicates the tone or frequency (with default 440Hz)

duration, d
	Indicates the duration of the generated frequency output

Love FFmpeg? Grab a copy of FFmpeg For Beginners on Kindle or Paperback to learn over 120 ways to master FFmpeg!

buy now on amazon