Posted on

Quickly Create Music Videos Using ffmpeg

I’m going to disclose the command line that I use to generate a simple music video from an audio file and an image. The video will contain the original audio and an XY scope visualization of the audio superimposed over a custom background. The process depends on a few things:

  • ffmpeg – search the internet for download and installation instructions suitable for your platform
  • an image file to serve as a background. To use the command below, you’ll want to make a 1920×1080 image
  • an audio file (of course!)

The following are four separate commands for the Windows command line. Other platforms will be slightly different. You’ll want to change the first three to refer to your own filenames. (You can guess the role of file in the process). The last command is doing the heavy lifting and is a single, really long, command. If you’re not familiar with using a command line interface (typing in commands to a big blank window) you’ll want to know how to copy-paste to a command window and, note that every character is essential.

SET IMAGEFILE="test.png"
SET AUDIOFILE="test1.wav"
SET OUTFILE="testout.mp4"

ffmpeg -loop 1 -i %IMAGEFILE%  -i %AUDIOFILE%  -filter_complex "[1:a]avectorscope=s=1920x1080:draw=line:mode=lissajous_xy:rc=100:gc=120:bc=255:rf=9:gf=9:bf=9,format=yuv420p[v],[v]split[m][a];[m][a]alphamerge[keyed];[0][keyed]overlay=eof_action=endall" %OUTFILE%

That’s it! I hope it works for you.