@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
sh 17 lines 1.02 KB
Raw
1 #!/usr/bin/env bash
2 # Captures frames at the given real-time seconds and tiles them into one contact sheet.
3 # Usage: sheet.sh <dir> <seconds,...> [out.png] (frames land in <dir>/probe, sheet in <dir>/sheet.png)
4 set -euo pipefail
5 dir=$(cd "${1:?usage: sheet.sh <dir> <seconds,...> [out.png]}" && pwd)
6 times=${2:?give comma-separated seconds, e.g. 1,4.5,9}
7 out=${3:-$dir/sheet.png}
8 here=$(cd "$(dirname "$0")" && pwd)
9 rm -rf "$dir/probe"
10 node "$here/capture.mjs" "$dir/story.html" "$dir/probe" --at "$times"
11 n=$(ls "$dir/probe"/*.png | wc -l)
12 cols=$(( n < 3 ? n : 3 )); rows=$(( (n + cols - 1) / cols ))
13 # Chromium saves some frames as RGBA and others as RGB; without -reinit_filter 0 the
14 # format change restarts the tile filter and the sheet silently loses frames.
15 ffmpeg -hide_banner -loglevel error -y -reinit_filter 0 -pattern_type glob -i "$dir/probe/*.png" \
16 -vf "format=rgb24,scale=960:-1,tile=${cols}x${rows}:padding=8:color=0x333333" -frames:v 1 -update 1 "$out"
17 echo "sheet -> $out ($n frames; full-size frames in $dir/probe)"