Last active
April 4, 2018 07:40
-
-
Save kassoulet/11045af1153c322dc84b3954add95a0d to your computer and use it in GitHub Desktop.
Makefile to convert audio files to videos, with audio waves display.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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