Skip to content

Instantly share code, notes, and snippets.

@martastain
Created March 21, 2019 16:05
Show Gist options
  • Save martastain/2d9501befa446c2d4f2f6294c0b3ca16 to your computer and use it in GitHub Desktop.
Save martastain/2d9501befa446c2d4f2f6294c0b3ca16 to your computer and use it in GitHub Desktop.
NXTV Audiogram generator
INPUTS := $(wildcard ./audio/*.mp3)
OUTPUTS := $(patsubst ./audio/%.mp3,./output/%.mp4,$(INPUTS))
BACKGROUNDS := $(patsubst ./audio/%.mp3,./backgrounds/%.png,$(INPUTS))
AFILTERS := agate
VISUALISATION := showwaves=s=1920x1000:colors=\#ececec:mode=cline
POSTPROC := geq=r='r(X,Y)':a='0.75*alpha(X,Y)'
OVERLAY := overlay=0:300
VFILTER := ${AFILTERS},${VISUALISATION},${POSTPROC}
all: $(OUTPUTS)
./backgrounds/%.png : ./audio/%.mp3
cat bkg.svg | sed 's/\#title\#/$(shell basename -s .mp3 $< | sed 's/[[:lower:]]/\U&/g' | sed 's/\_/\ /' )/' > temp.svg
inkscape --export-png=$@ --export-area-page -w 1920 -h 1080 temp.svg
./output/%.mp4 : ./backgrounds/%.png ./audio/%.mp3
@echo $(word 2, $^)
ffmpeg -y \
-i $(word 2, $^) \
-loop 1 -i $(word 1, $^) \
-filter_complex "[0:a]${VFILTER}[v];[1:v][v]${OVERLAY}[outv]" \
-map "[outv]" \
-map 0:a \
-c:v libx264 -b:v 5M \
-c:a libfdk_aac -ar 48k \
-shortest $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment