Automatic music video

Much to my surprise, I have come to realise that YouTube is used by many for music listening. That’s too bad, as I don’t know much about making videos.

For a few songs, i used iMovie to cut together some footage and text. See for example From the bottle below

But making these was a bit tedious, especially when it’s the music and not the video that interests me.

So, after some surfing, I ended up with this little script using ffmpeg

ffmpeg -i "The Stage (v1.01).mp3" -i ../cover.jpg -filter_complex "nullsrc=size=1280x768 [base]; [1:v] setpts=PTS-STARTPTS ,scale=768x768 [cover]; [0:a] showwaves=s=512x768:mode=cline [sw]; [base][sw]overlay=x=768 [tmp1]; [tmp1][cover]overlay=x=0 [out]" -map "[out]" -map a:0 -c:v libx264 -shortest -crf 18 -c:a copy "The Stage (v1.01).mkv"

That yields the following video


ffmpeg -i "Beneath the snow (v1.01).mp3" -i ../cover.jpg -filter_complex "nullsrc=size=1280x768 [base]; [1:v] setpts=PTS-STARTPTS ,scale=768x768 [cover]; [0:a]showspectrum=mode=combined:slide=scroll:color=intensity:scale=cbrt:s=512x768[sw]; [base][sw]overlay=x=768 [tmp1]; [tmp1][cover]overlay=x=0 [out]" -map "[out]" -map a:0 -c:v libx264 -shortest -crf 18 -c:a copy "Beneath the snow (v1.01).mkv"

that generated this one

There are more possibilities for using ffmpeg and generating music visualisation, but I found these two to be the simplest to use. This is perfect for us nerdy musicians that want to be able to script all boring stuff out of our lives 🙂

(note that the script does not transcode the music, it leaves it as is = good thing)


Leave a Reply

Your email address will not be published. Required fields are marked *