Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Makefile to convert audio files to videos, with audio waves display.
# Makefile to convert audio files to videos, with audio waves display
# What you need to upload a nice audio on Youtube but you don't have a video
#
# Needs:
# - a music/ folder with flac files
# - a covers/ folder with 1920x1080 pictures,
# each with the same name than the flac, ending with "-1080p.png"
# - a video/ folder to store the generated videos
# Here you can select to keep the original flac codec, or convert to mp3
acodec=copy
#acodec=libmp3lame -b:a 320k
# Conversion command
ffmpeg-youtube=ffmpeg -y -r 1 -i $< -loop 1 -i $(@:video/%.mp4=covers/%-1080p.png) -acodec $(acodec) -c:v libx264 -strict -2 -crf 23 -preset ultrafast -shortest -filter_complex "[0:a]showwaves=s=1920x540:mode=cline:split_channels=1:colors=\#ffffff80|\#ffffff80,format=argb[w];[1:v][w]overlay=(W-w)/2:(H-h)/2[v]" -map "[v]" -map 0:a $@
FLAC=$(wildcard music/*.flac)
MP4=$(FLAC:music/%.flac=video/%.mp4)
video/%.mp4: music/%.flac
$(ffmpeg-youtube)
.PHONY: all clean
all: $(MP4)
clean:
rm $(MP4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.