summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--video.mk38
1 files changed, 38 insertions, 0 deletions
diff --git a/video.mk b/video.mk
new file mode 100644
index 0000000..abc6bd0
--- /dev/null
+++ b/video.mk
@@ -0,0 +1,38 @@
+CLEAN_TARGETS += clean_video
+REAL_CLEAN_TARGETS += real_clean_video
+
+rawDir = rawVideo
+recodedDir = recodedVideo
+
+dest_dir_video ?= $(dest_dir)/$(recodedDir)
+destination_dirs += $(dest_dir_video)
+
+rawVideo = $(wildcard $(rawDir)/*.mp4)
+recoded_video_from_raw = $(rawVideo:$(rawDir)/%=$(recodedDir)/%)
+recoded_video_dest_targets = $(rawVideo:$(rawDir)/%=$(dest_dir_video)/%)
+
+recoded_video: $(recoded_video_from_raw)
+
+$(recodedDir):
+ $(INSTALL) -d -m 0755 '$@'
+
+$(recodedDir)/% : $(rawDir)/% | $(recodedDir)
+ ffmpeg -i $< -movflags faststart -r 15 -c:v libx264 -preset veryfast -tune stillimage -c:a libfdk_aac -vbr 1 -cutoff 4000 $@
+
+install_recoded_video: $(recoded_video_dest_targets)
+
+# $(dest_dir_video):
+ # $(INSTALL) -d -m 0755 '$@'
+
+$(recoded_video_dest_targets): $(dest_dir_video)/% : $(recodedDir)/% | $(dest_dir_video)
+ifneq ($(strip $(recoded_video_from_raw)),)
+ $(INSTALL) -m 0644 '$<' '$@'
+endif
+
+clean_video:
+
+real_clean_video:
+ifneq ($(strip $(recoded_video_from_raw)),)
+ rm -f $(recoded_video_from_raw)
+endif
+