From 9d86b215eb990ca52af89c94776dae24f4463e46 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Tue, 26 Nov 2013 19:31:12 -0500 Subject: Stuff. --- Makefile | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5b0b99d --- /dev/null +++ b/Makefile @@ -0,0 +1,69 @@ +FFMPEG ?= ffmpeg +FFMPEG += -v warning $(FFMPEGFLAGS) +OPUSENC ?= opusenc +ZOPFLIPNG ?= zopflipng +JPEGOPTIM ?= jpegoptim +CWEBP ?= cwebp + +DUMP ?= www/dump + +all: video audio images + +# === VIDEO === + +VIDEO := $(wildcard $(DUMP)/video/*.mkv) +MP4 := $(patsubst %.mkv,%.mp4,$(VIDEO)) +WEBM := $(patsubst %.mkv,%.webm,$(VIDEO)) +OGV := $(patsubst %.mkv,%.ogv,$(VIDEO)) +CVIDEO := $(MP4) $(WEBM) $(OGV) + +video: $(CVIDEO) + +%.mp4: %.mkv + $(FFMPEG) -i $< -c:v libx264 -preset slower -tune animation -c:a libfdk_aac $@ + +%.webm: %.mkv + $(FFMPEG) -i $< -c:v libvpx -crf 15 -b:v 1M -c:a copy $@ + +%.ogv: %.mkv + $(FFMPEG) -i $< -c:v libtheora -qscale:v 6 -c:a copy $@ + +# === AUDIO === + +AUDIO := $(shell find $(DUMP)/bgm $(DUMP)/sfx -name '*.ogg') +OPUS := $(patsubst %.ogg,%.opus,$(AUDIO)) +M4A := $(patsubst %.ogg,%.m4a,$(AUDIO)) +CAUDIO := $(OPUS) $(M4A) + +audio: $(CAUDIO) + +%.wav: %.ogg + $(FFMPEG) -i $< -c:a pcm_s16le $@ + +%.opus: %.wav + $(OPUSENC) --bitrate 64 $< $@ + +%.m4a: %.wav + $(FFMPEG) -i $< -c:a libfdk_aac -vbr 2 $@ + +# === IMAGES === + +PNG := $(shell find $(DUMP) -name '*.png') +JPG := $(shell find $(DUMP) -name '*.jpg') +WEBP := $(patsubst %.png,%.webp,$(PNG)) \ + $(patsubst %.jpg,%.webp,$(JPG)) + +images: $(WEBP) + +%.webp: %.png + $(ZOPFLIPNG) -m -y $< $< + $(CWEBP) -q 99 -m 6 $< -o $@ + +%.webp: %.jpg + $(JPEGOPTIM) --strip-all $< + $(CWEBP) -q 90 -m 6 $< -o $@ + +clean: + rm $(CVIDEO) $(CAUDIO) $(WEBP) + +.PHONY: video audio images clean -- cgit v1.2.3-70-g09d2