blob: fc53522cee5e919fb6e0aeb36178ec4c18b30065 (
plain)
- # Make snippet for rendering development animation
- #
- # Copyright 2025, Jonas Smedegaard <dr@jones.dk>
- # SPDX-License-Identifier: GPL-3-or-later
- #
- # Setup:
- # In main Makefile...
- # * optionally set variable VIDEO_FILES
- # * optionally set variable VIDEO_TITLE
- # * include this make snippet
- #
- # Dependencies:
- # * gource <http://gource.io/>
- # * ffmpeg <https://www.ffmpeg.org/>
- # * perl
- # ffmpeg executable and generic scripting arguments
- FFMPEG = ffmpeg -hide_banner -nostdin -y
- # title to optionally include in animation
- #VIDEO_TITLE =
- # list of target animation files
- VIDEO_FILES ?= animation.mp4
- videos: $(VIDEO_FILES)
- %.log:
- gource --output-custom-log - | perl -p \
- -e 's/(LICENSE|README|txt)\K$$/.plaintext/;' \
- -e 's/q?md\K$$/.markdown/;' \
- -e 's/(otf|woff2)\K$$/.font/;' \
- -e 's/(jpe?g|png)\K$$/.image/;' \
- -e 's/(html|pdf|svg)\K$$/.layout/;' \
- -e 's/(css|json|gitignore|ya?ml)\K$$/.data/;' \
- -e 's/(js|lua|Makefile|mk|rb|rust|scss|sh|tex)\K$$/.code/' \
- > $@
- %_ffv.mkv: %.log
- gource $< -1280x720 -r 25 --multi-sampling \
- --disable-input --hide mouse,progress,filenames,bloom \
- $(VIDEO_TITLE:%=--title "%") --highlight-users --key \
- -o - | $(FFMPEG) -r 25 -f image2pipe -vcodec ppm -i - \
- -vcodec ffv1 -level 3 -threads 0 $@
- %.mp4: %_ffv.mkv
- $(FFMPEG) -i $< -vcodec libx264 -preset slow -pix_fmt yuv420p \
- -crf 27 -tune animation -threads 0 -bf 0 $@
- %_hevc.mp4: %_ffv.mkv
- $(FFMPEG) -i $< -vcodec libx265 -preset slow -pix_fmt yuv420p \
- -crf 26 -tune animation -threads 0 -bf 0 $@
- %.webm: %_ffv.mkv
- $(FFMPEG) -i $< -vcodec libvpx \
- -crf 30 -threads 0 -bf 0 $@
- %_vp9.webm: %_ffv.mkv
- $(FFMPEG) -i $< -vcodec libvpx-vp9 \
- -crf 30 -threads 0 -bf 0 $@
- %_av1.mkv: %_ffv.mkv
- $(FFMPEG) -i $< -vcodec libaom-av1 \
- -crf 30 -threads 0 -bf 0 $@
- .PHONY: videos
|