Skip to content

Instantly share code, notes, and snippets.

@7shi
Last active April 8, 2025 07:45
Show Gist options
  • Save 7shi/eda1c78a6c5602554e02a3d1e37197aa to your computer and use it in GitHub Desktop.
Save 7shi/eda1c78a6c5602554e02a3d1e37197aa to your computer and use it in GitHub Desktop.
[Makefile] Movie Workflow
all:
rm -f _output.mp4
for mp4 in *.mp4; do echo file $$mp4; done > list.txt
ffmpeg -f concat -i list.txt -c copy _output.mp4
ifdef NO
NEXT_NO := $(shell echo $$(printf "%02d" $$((10#$(NO) + 1))))
endif
last:
@if [ -z "$(NO)" ]; then \
echo "Error: NO variable is required."; \
exit 1; \
fi
ffmpeg -i $(NO)-*.mp4 -update 1 -q:v 1 $(NEXT_NO).png
tempo:
@if [ -z "$(TEMPO)" ] || [ -z "$(INPUT)" ] || [ -z "$(OUTPUT)" ]; then \
echo "Error: TEMPO, INPUT, and OUTPUT variables are required."; \
exit 1; \
fi
ffmpeg -i $(INPUT) -vf "setpts=PTS/$(TEMPO)" -af "atempo=$(TEMPO)" $(OUTPUT)
cut:
@if [ -z "$(DUR)" ] || [ -z "$(INPUT)" ] || [ -z "$(OUTPUT)" ]; then \
echo "Error: DUR, INPUT, and OUTPUT variables are required."; \
exit 1; \
fi
ffmpeg -i $(INPUT) -t $(DUR) -c copy $(OUTPUT)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment