CLEAN_TARGETS += clean_video REAL_CLEAN_TARGETS += real_clean_video ## Video encoder options # with added voice low-pass filter and frame rate reduced to 15 (good for slides) ffmpegOptions ?= -movflags faststart -r 15 -c:v libx264 -preset veryfast -tune stillimage -c:a libfdk_aac -vbr 1 -cutoff 4000 # remove audio track and recode video (good for slides) #ffmpegOptions ?= -movflags faststart -r 15 -c:v libx264 -preset veryfast -tune stillimage -an # remove audio track and recode video (do not change frame rate) # ffmpegOptions ?= -movflags faststart -c:v libx264 -preset veryfast -tune stillimage -an # recode video with no filters # ffmpegOptions ?= -movflags faststart -c:v libx264 -preset veryfast -tune stillimage -c:a libfdk_aac -vbr 1 rawDir ?= rawVideo recodedDir ?= recodedVideo readyDir ?= readyVideo video_ext_in ?= mp4 video_ext_out ?= mp4 dest_dir_video_recoded ?= $(dest_dir)/$(recodedDir) dest_dir_video_ready ?= $(dest_dir)/$(readyDir) destination_dirs += $(dest_dir_video_recoded) $(dest_dir_video_ready) rawVideo = $(wildcard $(rawDir)/*.$(video_ext_in)) recoded_video_from_raw = $(rawVideo:$(rawDir)/%.$(video_ext_in)=$(recodedDir)/%.$(video_ext_out)) recoded_video_dest_targets = $(rawVideo:$(rawDir)/%.$(video_ext_in)=$(dest_dir_video_recoded)/%.$(video_ext_out)) readyVideo = $(wildcard $(readyDir)/*.$(video_ext_out)) ready_video_dest_targets = $(readyVideo:$(readyDir)/%=$(dest_dir_video_ready)/%) recoded_video: $(recoded_video_from_raw) $(dest_dir_video_ready): $(INSTALL) -d -m 0755 '$@' $(dest_dir_video_recoded): $(INSTALL) -d -m 0755 '$@' $(recodedDir): $(INSTALL) -d -m 0755 '$@' $(recodedDir)/%.$(video_ext_out) : $(rawDir)/%.$(video_ext_in) | $(recodedDir) ffmpeg -i $< $(ffmpegOptions) $@ install_recoded_video: $(recoded_video_dest_targets) install_ready_video: $(ready_video_dest_targets) # $(dest_dir_video_recoded): # $(INSTALL) -d -m 0755 '$@' $(recoded_video_dest_targets): $(dest_dir_video_recoded)/% : $(recodedDir)/% | $(dest_dir_video_recoded) ifneq ($(strip $(recoded_video_from_raw)),) $(INSTALL) -m 0644 '$<' '$@' endif $(ready_video_dest_targets): $(dest_dir_video_ready)/% : $(readyDir)/% | $(dest_dir_video_ready) ifneq ($(strip $(readyVideo)),) $(INSTALL) -m 0644 '$<' '$@' endif clean_video: real_clean_video: ifneq ($(strip $(recoded_video_from_raw)),) rm -f $(recoded_video_from_raw) endif