chafa is the resolution I actually wanted

This commit is contained in:
Priec
2026-06-02 17:17:35 +02:00
parent 55eb4bbf00
commit 6ccf372f65
3 changed files with 23052 additions and 3966 deletions

View File

@@ -1,5 +1,11 @@
.PHONY: help serve size validate tidy video video-list video-frames video-bundle clean
# ASCII render resolution (override on the command line):
# make video NAME=nature1 SIZE=160x48 SCALE=640
SIZE ?= 80x24
SCALE ?= 320
FPS ?= 12
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
@@ -49,11 +55,11 @@ video-frames: ## Extract PNG frames from video/<NAME>.mp4 and chafa each to ASCI
{ echo "ffmpeg not found. Run via: nix develop -c make video-frames NAME=$(NAME)"; exit 1; }
@command -v chafa >/dev/null 2>&1 || \
{ echo "chafa not found. Run via: nix develop -c make video-frames NAME=$(NAME)"; exit 1; }
@echo " extracting frames at 12 fps from video/$(NAME).mp4"
@ffmpeg -y -loglevel error -i video/$(NAME).mp4 -vf "fps=12,scale=320:-1" build/$(NAME)/frame-%03d.png
@echo " chafa: 80x24 ascii per frame"
@echo " extracting frames at $(FPS) fps from video/$(NAME).mp4"
@ffmpeg -y -loglevel error -i video/$(NAME).mp4 -vf "fps=$(FPS),scale=$(SCALE):-1" build/$(NAME)/frame-%03d.png
@echo " chafa: $(SIZE) ascii per frame"
@for f in build/$(NAME)/frame-*.png; do \
chafa -f symbols -c none -s 80x24 --symbols ascii --animate off "$$f" > "$${f%.png}.txt"; \
chafa -f symbols -c none -s $(SIZE) --symbols ascii --animate off "$$f" > "$${f%.png}.txt"; \
done
@echo " rendered $$(($$(ls build/$(NAME)/frame-*.png | wc -l))) PNG + ASCII frames in build/$(NAME)/"