Skip to content

Add project page + hero video playbook and ffmpeg scripts - #1470

Open
jonfroehlich wants to merge 5 commits into
masterfrom
project-video-playbook
Open

jonfroehlich wants to merge 5 commits into
masterfrom
project-video-playbook

Conversation

@jonfroehlich

@jonfroehlich jonfroehlich commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Adds a playbook for publishing project pages with hero (banner) videos and official YouTube videos, based on the December 2026 batch of page updates.

  • docs/PROJECT_VIDEO_PLAYBOOK.md: the rules (no text in hero images/videos; one small 2:1 loop per project with poster + alt text; poster and gallery thumbnail show the system's effect; official video on the lab channel with the logo prologue; no identifiable participants; unpublished work stays hidden), why the spec follows from how the 500 px hero renders (safe area ~360x312), and step-by-step: find source → pick moment → render → YouTube with prologue → /admin entry.
  • scripts/video/make_hero.sh: cut → largest 2:1 crop → 1600x800 H.264, no audio, faststart, crossfade loop. Tries CRF 27/29/31 for a 2.5 MB target: over the target it warns (exit 0); over the 10 MB hard cap it exits 3 (10 MB is the most the site will serve once Banner videos: enforce size/format at upload (reject or re-encode oversized videos) #1468 lands; the 2.5 MB target is unchanged). STILL_AT=<sec or H:MM:SS.mmm> rotates the seamless loop so the payoff moment is frame 0; invalid values exit 2. Also writes the 1600x500 poster and 1000x600 gallery thumbnail (colour-converted for JPEG).
  • scripts/video/add_prologue.sh: prepends the lab logo animation (path via LOGO), matching the source frame rate (capped at 60 for VFR files), H.264/AAC for YouTube.
  • CLAUDE.md: one-line pointer to the playbook.

Both scripts avoid GNU-only tools; tested on Linux only (macOS untested). Docs/scripts only; no app code changes. Related: #1468 (server-side enforcement of banner video size/format), #1469 (hide private projects from bios).

🤖 Generated with Claude Code — Opus 5.5, claude-opus-5-5

docs/PROJECT_VIDEO_PLAYBOOK.md records how we publish a project page with
a hero (banner) video and an official YouTube video: no text in hero
media, one small (<= 2.5 MB) 2:1 loop per project with a poster and alt
text, official video on the lab channel with the logo prologue, and the
/admin steps. scripts/video/make_hero.sh renders the loop, poster, and
gallery thumbnail; scripts/video/add_prologue.sh prepends the lab logo
animation for YouTube uploads. CLAUDE.md points to the playbook.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HFUXRa2hBVnK4hXzY8dK68

@jonfroehlich jonfroehlich left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at head a9be7aedf52bf44ac8b7e6359dc7eea0f16d9f0d (review round 1, comment only).

Summary: no blocking findings. On Linux with a 16:9 source, both scripts do what the playbook says. There are 8 should-fix items (4 in the scripts, 4 in the playbook text) and a few nits.

How I tested: ran both scripts from a detached checkout of this head against synthetic ffmpeg sources (testsrc2, sine, mandelbrot+noise) with ffmpeg n8.0.1 (static build) on Linux, including paths with spaces, a relative output directory, and invocation from another directory. Rendering claims were checked in headless Chromium with a static page that uses the base.html carousel markup and loads the repo's CSS in template order. Nothing was run on macOS, Firefox or Safari.

What checked out

  • make_hero.sh on 1920x1080/30 fps, 1280x720/23.976 fps and a variable-frame-rate source (r_frame_rate 60, average 42): output is 1600x800, H.264 High, level 4.0, yuv420p, 30 fps, SAR 1:1, a single video stream (no audio), moov before mdat, 1.7 to 1.9 MB at CRF 27.
  • The loop is seamless. On an 11 s cut (10 s loop), the last frame matches source frame 29 and the first frame matches source frame 30 (PSNR 31 to 32 dB against the source, versus 18 dB for the adjacent frame). The seam difference (18.4 dB on this fast-changing test pattern) is the same as any other pair of consecutive frames (17.9 to 19.3 dB).
  • Poster is 1600x500 and equals the centre band (y 150 to 650) of frame 0. Thumbnail is 1000x600, which matches PROJECT_THUMBNAIL_SIZE (500x300, 5:3).
  • speed, ypos and extra_vf work as described (a 6 s cut at 0.5 gives an 11 s loop).
  • add_prologue.sh: output is 1920x1080 H.264 + AAC 48 kHz stereo; frame rate follows the source (30, 24000/1001, 60); audio is silent for exactly the logo's 5.000 s and the source audio starts there; a source with no audio gets a silent track; a missing LOGO gives the intended error and exit 1.
  • Geometry: at 360 px wide the project-page hero shows the centre 576x800 of the master, and at 2560 px it shows 1600x312, so the "576x312" figure is right for the project-page video (but see S8).
  • Admin steps match the code: BannerInline is on the project form, a blank banner title falls back to the project name, staff can preview a hidden project, Banner.cropping is 1600x500.
  • Both scripts are committed as mode 100755.

Should-fix: scripts

S1. The size cap is not enforced, and three different numbers are in play. The playbook says target 2.5 MB and hard cap 4 MB, the script header and PR body say "<= ~2.7 MB", and the loop tests 2,700,000 bytes. When CRF 31 is still over, the script keeps the file and exits 0 with no warning. Reproduced: a busy 12 s cut at speed 0.5 (the playbook recommends 0.5 to 0.85) printed crf=31 3040KB 23.000000s, exit 0, 3,113,763 bytes. Nothing checks 4 MB either. Suggest one number, and a non-zero exit (or at least a loud warning) when the last CRF is still over it.

S2. stat -c %s is GNU-only. Not run on macOS; simulated with a stat stand-in that rejects -c the way BSD stat does. Result: the size test errors on every pass ([: : integer expression expected), so the loop always falls through to CRF 31 (the lowest quality) regardless of size, the final printf then fails on $(( /1024 )), and the script exits 1 after writing the files. add_prologue.sh line 32 has the same call; with the same stand-in it exits 1 after a successful encode. wc -c < file is portable.

S3. Sources wider than 2:1 fail. crop=iw:iw/2:... needs ih >= iw/2. Reproduced with a 2560x1080 source: Invalid too big or non positive size for width '2560' or height '1280', exit 234, and a 0-byte <slug>-inter.mp4 left behind. The same expression rejects 1920x900 (checked on the crop filter alone), which is what the playbook's own "pre-crop the toolbars" advice can produce. This expression handled 2560x1080, 1920x1080 and 1278x720 in my test: crop='min(iw,2*ih)':'min(ih,iw/2)':(iw-ow)/2:(ih-oh)*$y.

S4. add_prologue.sh takes r_frame_rate, which is not the real frame rate for some variable-frame-rate files. Reproduced on a synthetic 30 fps MP4 with millisecond-jittered timestamps (ffprobe: r_frame_rate=1000/1, avg_frame_rate=1000/33): the output was 1000 fps, 10,938 frames for 10.9 s, H.264 level 6.1. I do not know how common this is in the lab's real sources; screen recorders and phones are the usual producers of such files. avg_frame_rate, or a cap at 60, avoids it.

S5. The poster and thumbnail JPEGs come out with shifted colours for BT.709 sources. The stills are cut from the BT.709 hero and written as JPEG with only a range conversion, not a matrix conversion, and browsers decode JPEG as BT.601. Reproduced with a BT.709-tagged source in headless Chromium at 1600 px, same pixel in poster and video: red is e70001 in the poster versus fd0002 in the video; yellow is f9ff07 versus fcfd0a. So the colours visibly change when the video replaces the poster. Adding scale=in_color_matrix=bt709:out_color_matrix=bt601:out_range=pc,format=yuvj420p to the poster command brought red to fa0100 (poster-versus-video screenshot PSNR 27.6 dB to 31.9 dB). Hard-coding BT.709 as the input matrix also matches what Chromium assumed for the untagged 1600x800 hero in my other test.

Should-fix: playbook

S6. The contact-sheet command silently shows only the first 3 min 20 s. fps=1/5 with tile=8x5 and -frames:v 1 is 40 tiles, which is 200 s. Reproduced on a 400 s source: one 2560x900 sheet whose last tile is stamped 00:03:15, exit 0, the second half of the video never shown. Drop -frames:v 1 and write sheet_%02d.jpg, or scale the interval to the duration.

S7. Rule 7 says member bios filter hidden project names "as of #1469", but #1469 is an open, unmerged PR. At this head website/utils/bio_utils.py still builds the sentence from person.get_projects with no visibility filter. Either merge #1469 first or reword until it lands.

S8. "Keep the subject in the center ~576x312 px of the master (visible on every screen)" does not hold in two cases. Both rendered in headless Chromium:

  • Poster on phones. The poster is the 1600x500 crop, shown in the same object-fit: cover box. At 390 px wide the poster shows the centre 390 px of the master at 1:1, while the video shows the centre 624 px scaled by 0.625. So the poster is 1.6x tighter than the video (about 1.11x at 1440 px). Rule 3 names the poster as what reduced-motion visitors see, so on a 360 px phone they see only the centre 360 px.
  • Landing page. index.css loads after base.css and redefines .banner-video (width: auto, min-width: 100%, centred with a transform). Measured video box at a 360 px viewport: 1600 px wide, offset -620 px, so only the centre 360 px of the master is visible, versus 576 px on a project page. This applies to any banner that also has landing_page checked.

A safe area of about 360x312 covers both; otherwise the paragraph should say it describes the project-page video only.

Nits

  • N1. The rendering paragraph cites base.html, but the 500 px height and object-fit: cover live in website/static/website/css/base.css (.carousel ... { height: 500px }, .banner-video).
  • N2. Banner.video help text still says "Ideally, video should be 10MB or less", and validate_video_upload accepts .mov while the template hardcodes type="video/mp4". Both contradict rule 4 until #1468 lands; worth a sentence in the playbook so editors are not confused by the admin form.
  • N3. Missing arguments give $1: unbound variable with no usage line, and -h does the same. make_hero.sh also needs python3, realpath and GNU stat, which the "Install tools once" line does not mention.
  • N4. The loop is 1 s shorter than the cut (an 11 s cut gives a 10 s loop); the header does not say so. A cut under 2 s after speed is not rejected: 1.5 s in gave a 1.0 s file and exit 0 (I did not inspect its content).
  • N5. A failed run leaves <slug>-inter.mp4 in the output directory (seen in S3). A trap ... EXIT would clean up.
  • N6. A source whose width is not exactly twice the cropped height keeps a non-square SAR: 1278x720 in gave 1600x800 with SAR 639:638. setsar=1 after the scale fixes it (checked together with the S3 expression).
  • N7. Derived from code, not tested on a server: the gallery thumbnail is uploaded with its own filename to projects/images/ (no random suffix, unlike banners), so <slug>-thumb.jpg for a hidden project is fetchable under /media/ by anyone who guesses the name. Rule 7 could say to hold media uploads for unpublished work, or to use a non-descriptive filename.
  • N8. Untested reasoning: extra_vf runs before setpts, so minterpolate=fps=30 combined with speed below 1 would interpolate first and then duplicate frames when slowed.

Not checked

Real footage of any kind (all sources were synthetic), HDR or 10-bit sources, macOS, Firefox and Safari, the actual lab logo animation, and YouTube's handling of the prologue output.

🤖 Generated with Claude Code — Fable 5.2, claude-fable-5-2

jonfroehlich and others added 2 commits December 1, 2026 10:59
make_hero.sh:
- One size policy: 2.5 MB target (warn), 4 MB hard cap (exit 3).
- Portable: wc -c instead of GNU stat, awk instead of python3, no realpath.
- Crop the largest 2:1 rectangle, so sources wider than 2:1 work; setsar=1.
- Convert BT.709 to BT.601 full range for the poster/thumbnail JPEGs so
  their colours match the video.
- extra_vf runs after setpts, so minterpolate sees the slowed timeline.
- STILL_AT rotates the seamless loop so the payoff moment is frame 0
  (poster and thumbnail), keeping it seamless.
- Usage/-h, argument checks, minimum cut length, intermediates removed
  on any exit.

add_prologue.sh:
- Use r_frame_rate only when <= 60 fps; otherwise the rounded average,
  capped at 60 (VFR files reporting 1000/1).
- wc -c instead of GNU stat; usage/-h; generic LOGO path in examples.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HFUXRa2hBVnK4hXzY8dK68
- New rule 6: poster and gallery thumbnail show the system's effect;
  STILL_AT puts that moment at frame 0.
- Safe area is 360x312 (poster on phones and the landing page are
  tighter than the project-page video); cite base.css for sizing.
- Hidden-project rule no longer assumes #1469 has merged; notes that
  /media/ uploads keep their filenames.
- Contact sheet writes sheet_%02d.jpg so long videos are fully covered.
- Size rule matches the script and explains the stale admin help text.
- Tool requirements; no personal paths in examples.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HFUXRa2hBVnK4hXzY8dK68
@jonfroehlich

Copy link
Copy Markdown
Member Author

Fix round 1 for review 1. New head: 4b5949d1c275e2ac8062c6e28a5e59da1fcd6f5b. Two commits: 9a6c83f (scripts) and 4b5949d (playbook).

How I tested: each should-fix was reproduced on the old head first, then the new scripts were run on synthetic lavfi sources with ffmpeg n8.0.1 (static) on Linux: 16:9, 2:1, 2560x1080, VFR (r 60/avg 42), 1278x720, BT.709-tagged, a 1 s clip, a busy and a noisy cut at speed 0.5, all from paths with spaces, invoked from another directory, plus one relative-path run, and a BSD-style stat stand-in on PATH. Outputs were checked with ffprobe. Not run on macOS itself.

Should-fix

  • S1 (size cap): fixed in 9a6c83f. One policy everywhere: 2.5 MB target, 4 MB hard cap (MB = 10^6 bytes). CRF 27/29/31 stops at the first under 2.5 MB; still over at CRF 31 prints a warning and exits 0; over 4 MB exits 3 with the files kept for inspection and "do not upload". Reproduced old behaviour (busy cut at 0.5: 3,060,861 bytes, exit 0, no message); now the same cut warns, and a noisy cut (4,904,858 bytes) exits 3. The numbers follow Banner videos: enforce size/format at upload (reject or re-encode oversized videos) #1468's text. Provisional: the exact target/cap and "warn vs fail" split are the maintainer's call.
  • S2 (GNU stat): fixed in 9a6c83f. Both scripts use wc -c < file; python3 (replaced by awk) and realpath are also gone. Reproduced the old failure with the stand-in (/1024: syntax error); with the stand-in both scripts now succeed (make_hero picked CRF 27 at 998 KB; add_prologue ran all five prologue cases with it).
  • S3 (wider than 2:1): fixed in 9a6c83f with your expression, crop='min(iw,2*ih)':'min(ih,iw/2)':(iw-ow)/2:(ih-oh)*$y. Reproduced exit 234 and the 0-byte -inter.mp4 on 2560x1080; now 2560x1080, 1920x1080, 1600x800 and 1278x720 all give 1600x800 SAR 1:1.
  • S4 (r_frame_rate on VFR): fixed in 9a6c83f. Uses r_frame_rate when it is 60 fps or less (keeps 24000/1001 exact), otherwise the average rounded and capped at 60, with a note on stderr. Reproduced 1000 fps / 10,938 frames / level 6.1 on the jittered file; now 30 fps, 328 frames, level 5.0. 30 fps, 24000/1001 and the r60/avg42 file are unchanged (30, 24000/1001, 60).
  • S5 (BT.709 vs JPEG): fixed in 9a6c83f with your scale=in_color_matrix=bt709:out_color_matrix=bt601:out_range=pc,format=yuvj420p on both stills. Measured on the BT.709-tagged source, poster decoded as BT.601 JPEG versus frame 0 decoded as BT.709: PSNR 27.8 dB with the old command, 41.8 dB now.
  • S6 (contact sheet): fixed in 4b5949d. Drops -frames:v 1 and writes sheet_%02d.jpg, with a line saying each sheet covers 200 s. On a 400 s source it now writes two sheets ending at 00:06:35.
  • S7 (Rule 7 and Hide private projects from auto-generated member bios #1469): fixed in 4b5949d. Now rule 8; it says filtering is proposed in Hide private projects from auto-generated member bios #1469 and that, until it merges, a hidden project's name shows in member bios, so check them. True either way.
  • S8 (safe area): fixed in 4b5949d. Safe area is now ~360x312, with a paragraph explaining the two tighter views (poster at 1:1 on phones, landing page at natural width). The review step now says 360 px and to look at the poster too. I did not re-render in a browser; this uses your measurements.

Nits

  • N1: fixed (4b5949d): cites base.css for sizing, base.html for markup.
  • N2: fixed (4b5949d): rule 4 says the admin form still says 10 MB and accepts .mov until Banner videos: enforce size/format at upload (reject or re-encode oversized videos) #1468 lands, and to follow the rule.
  • N3: fixed (9a6c83f, 4b5949d): -h/--help and wrong argument counts print the usage line (exit 0 / 2); playbook lists ffprobe, bash, awk.
  • N4: fixed (9a6c83f): header and playbook say the loop is 1 s shorter than the cut; a cut under 3 s after speed (loop under 2 s) exits 2 (the 1 s clip now does).
  • N5: fixed (9a6c83f): trap ... EXIT removes the intermediates; no -inter.mp4 left after the failing runs.
  • N6: fixed (9a6c83f): setsar=1; 1278x720 now gives SAR 1:1.
  • N7: agreed, fixed in the text (4b5949d): the hidden-project rule says /media/ uploads are public and keep their filename, so use a neutral filename or upload at publish time. Not tested on a server, same as your note.
  • N8: confirmed and fixed (9a6c83f): extra_vf now runs after setpts. On a 2 fps source at speed 0.5 with minterpolate=fps=30:mi_mode=blend, the old order gave 90 changed frames in 180 (every frame doubled); the new order gives 180 of 180.

Also

  • Still frame shows the payoff (maintainer request). New rule 6: the poster and gallery thumbnail must show the system's effect (e.g. the translated sign, not the original). make_hero.sh takes STILL_AT=<seconds into the loop> and rotates the seamless loop so that moment is frame 0, so the poster stays equal to the first frame of playback with no jump. Checked: with STILL_AT=4, frame 0 matches frame 120 of the unrotated loop (PSNR 32.4 dB, versus 22.8 dB for frames 119 and 121), and both joins look like any adjacent pair (22.8 dB at the wrap, versus 22.7 dB for an ordinary pair; the crossfade seam is unchanged at 25.9 dB). A STILL_AT past the end exits 2. Step 3 shows how to sheet the first render to find the time.
  • Replaced the personal Dropbox paths in the examples with /path/to/... and "the lab Dropbox".

CI

All three checks pass on 4b5949d: test, e2e and a11y (run 46721255168). They do not exercise these scripts.

🤖 Generated with Claude Code — Opus 5.5, claude-opus-5-5

@jonfroehlich jonfroehlich left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review round 2 (comment only). Head reviewed: 4b5949d1c275e2ac8062c6e28a5e59da1fcd6f5b. Range: a9be7aedf52bf44ac8b7e6359dc7eea0f16d9f0d..4b5949d1c275e2ac8062c6e28a5e59da1fcd6f5b (9a6c83f scripts, 4b5949d playbook).

Summary: no blocking findings. All of S1 to S8 and N1 to N8 are closed, and I found no regressions. STILL_AT works for valid values. One new should-fix: an invalid STILL_AT is silently ignored. Four nits.

How I tested: same setup as round 1 (ffmpeg n8.0.1 static on Linux, synthetic sources, headless Chromium for rendering). I re-ran every round-1 case against the new head. Nothing was run on macOS, Firefox or Safari.

Round-1 findings

# Status What I checked at the new head
S1 size cap Closed Busy 12 s cut at speed 0.5: crf=31, 3,113,763 bytes, WARNING on stderr, exit 0. Same cut at 0.3: 4,669,208 bytes, ERROR, exit 3, files kept. Header, playbook and script agree on 2.5 MB / 4 MB, and #1468 does state those two numbers.
S2 GNU stat Closed Ran both scripts with PATH holding only bash sed wc tr mkdir rm head awk ffmpeg ffprobe plus a stat that rejects -c (so no python3, realpath or GNU stat): exit 0, CRF 27 chosen. Output is byte-identical with gawk, mawk and busybox awk.
S3 wider than 2:1 Closed 2560x1080, 2000x1000, 1920x1080 and 1278x720 all give 1600x800. ypos 0 and 1 give identical files for the wide source and different files for 16:9, as the header says.
S4 VFR frame rate Closed The r_frame_rate=1000/1 file now gives 30 fps, 328 frames, level 5.0, with the stderr note. 30, 24000/1001 and the r60/avg42 file are unchanged (330, 264 and 1260 frames; silence still ends at 5.000 s).
S5 poster colours Closed In Chromium at 1600 px, poster versus video on the red bar: BT.709-tagged source fa0100 / fd0002 (was e70001 / fd0002); untagged source fe1800 / ff1800; a BT.601-tagged HD source also matches.
S6 contact sheet Closed 400 s source gives sheet_01.jpg and sheet_02.jpg, last tile 00:06:35. A 290 s source gives a full sheet and a partial one. The new hero-sheet command in step 3 also runs.
S7 #1469 wording Closed #1469 is still open; the rule 8 text is true whether or not it merges.
S8 safe area Closed The 360x312 figure and the explanatory paragraph match my round-1 measurements.
N1, N2, N7 Closed Text read against the code.
N3 usage Closed -h / --help exit 0; 0, 4 and 9 arguments exit 2 with the usage line; a missing source exits 2 before creating the output directory. Same for add_prologue.sh (0 and 3 arguments exit 2). See R2-3 for a detail.
N4 short cuts Closed A 2.93 s cut exits 2 with a clear message; a 3.0 s cut gives a 2.0 s loop.
N5 leftovers Closed No -inter, -loop or -rot files after any failing run; exit codes survive the trap (2, 3, 234).
N6 SAR Closed 1278x720 gives SAR 1:1.
N8 extra_vf order Closed 2 fps source, speed 0.5, minterpolate: on the old head consecutive frames alternate about 60 dB / 48 dB (every second frame a repeat); on the new head they are uniform at 50 to 54 dB.

No regressions: for the same arguments, the default (no STILL_AT) hero is byte-identical to the one the round-1 head produced, so the round-1 spec and seam checks carry over. Paths with spaces, a relative output directory, a relative source and invocation from another directory all still work.

STILL_AT

Valid values behave as documented:

  • Frame 0 is the intended moment, and nothing is dropped or repeated. With STILL_AT=4 on a 300-frame loop, every one of the 300 frames matches the unrotated loop shifted by exactly 120 frames (minimum per-frame PSNR 40.5 dB; a shift of 119 or 121 gives 22.8 dB). STILL_AT=4.51 rounds up to the next frame (shift 136).
  • Both joins are seamless. New wrap (last frame to frame 0) 18.4 dB and the old crossfade join, now mid-file, 18.3 dB, against 18.1 to 18.9 dB for ordinary consecutive pairs on this fast-changing pattern.
  • Poster and thumbnail equal frame 0 (41.0 dB and 39.4 dB against frame 0; 19.3 dB against frame 1). The STILL_AT=4 poster matches unrotated frame 120, not frame 0.
  • STILL_AT=0, 0.0 and an empty value give output byte-identical to the default. A value equal to or past the loop length exits 2.

Should-fix

R2-1. An invalid STILL_AT is silently ignored: the script exits 0 with an unrotated loop. Reproduced on a 4 s loop:

STILL_AT Result
-1, abc, nan, inf exit 0, no message, output byte-identical to the unrotated run
00:00:02.5, 2,5 awk syntax errors on stderr, then exit 0 with the unrotated output
1e0 ffmpeg Unable to parse option value "1e0" as duration, exit 234
2s, " 2 " rotated, by accident of how awk reads them

The 00:00:02.5 case is the likely one in practice: the step-3 sheet stamps each tile as HH:MM:SS.mmm, so that is the form the editor reads off before re-running. The run looks successful, and the poster is then not the payoff frame, which is the point of rule 6. Suggest rejecting anything that is not plain non-negative seconds before the first encode. This pattern accepts 4, 4.5, 0, .5 and rejects every value in the table above (pattern tested in bash, not wired into the script):

case $still in ''|*[!0-9.]*|*.*.*|.) echo "make_hero.sh: STILL_AT must be seconds into the loop, e.g. 4.5 (got '$still')" >&2; exit 2 ;; esac

Nits

  • R2-2. A STILL_AT in the last second of the loop gives a double-exposed poster. That second is the crossfade, so frame 0 becomes a blend of two moments. Reproduced with STILL_AT=3.5 on a 4 s loop: frame 0 is 34.3 dB from a 50/50 blend of the source at 4.5 s and 0.5 s, and 24.2 dB from either one alone. Worth one sentence in step 3 (pick a moment before the last second), or a warning from the script.
  • R2-3. -h / --help print the usage to stderr, so make_hero.sh --help | less shows nothing. The usage text is also pulled by line number (sed -n '4,5p', '5,6p'), which breaks quietly if the header is edited.
  • R2-4. The PR description is stale. It still says "auto-CRF to stay ≤ ~2.7 MB" and does not mention the 4 MB cap, exit 3, or STILL_AT.
  • R2-5. "They run on Linux and macOS" (playbook) and "Works with GNU and BSD/macOS userlands" (header) are still untested on macOS by either of us. I see no GNU-only or bash-4-only construct left, and the restricted-PATH run above supports that, but BSD awk and bash 3.2 were not exercised. The contact-sheet commands also need an ffmpeg with drawtext (libfreetype), which the tools line does not mention.

Not checked

Real footage, HDR or 10-bit sources, macOS, Firefox and Safari, the actual lab logo animation, and YouTube's handling of the prologue output. The 2.5 MB / 4 MB policy itself is marked provisional by the author; I only checked that the script, header and playbook implement it consistently.

🤖 Generated with Claude Code — Fable 5.2, claude-fable-5-2

- make_hero.sh rejects a STILL_AT that is not non-negative seconds
  (exit 2, before any encode) and also accepts the H:MM:SS.mmm stamp
  the contact sheet prints.
- Warns when STILL_AT falls in the loop's last (crossfade) second.
- -h/--help print usage to stdout; usage is found by its "Usage:" block
  rather than by line number (both scripts).
- Playbook and header: tested on Linux only, macOS untested; contact
  sheets need ffmpeg's drawtext (libfreetype).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HFUXRa2hBVnK4hXzY8dK68
@jonfroehlich

Copy link
Copy Markdown
Member Author

Fix round 2 for review 2. New head: 001fe728edf3fef76dcdf0def7f53aa25f5ecd18 (one commit, 001fe72, on top of 4b5949d). Same setup as before: ffmpeg n8.0.1 static on Linux, synthetic sources; nothing run on macOS.

  • R2-1 (invalid STILL_AT ignored): fixed in 001fe72. Reproduced first: -1 and abc exited 0 with an unrotated loop. The script now validates before any encode. I chose to accept the sheet's H:MM:SS.mmm stamp rather than reject it, since that is what the editor reads off a tile: a value is plain non-negative seconds (4, 4.5, .5) or [H:]M:SS(.mmm) with the decimal only in the last field, and it is converted to seconds with awk. Everything else exits 2 with STILL_AT must be seconds into the loop, e.g. 4.5 or 0:00:04.5 (got '...'). Tested: -1, abc, nan, inf, 2,5, 1e0, 2s, " 2 ", ., 1.2.3, 1.5:30, :5, 5:, 1::2, 1:. all exit 2 with that message; 4, 4.5, .5, 0, 0:00:02.5, 0:02.5, 1:00:00 pass validation. STILL_AT=0:00:02.500 gives a hero and poster byte-identical to STILL_AT=2.5, and 0:04 on a 4 s loop exits 2 (past the end).
  • R2-2 (still in the crossfade): fixed in 001fe72. The script warns when STILL_AT is within the loop's last second (STILL_AT=3.5 on a 4 s loop prints the warning, exit 0), and step 3 and the header say to pick an earlier moment.
  • R2-3 (usage on stderr, by line number): fixed in 001fe72, both scripts. -h/--help print to stdout (exit 0); a wrong argument count prints to stderr (exit 2). The usage is now the header's # Usage: block up to the next bare # line, not fixed line numbers.
  • R2-4 (stale PR description): fixed. Rewritten to cover the 2.5 MB target / 4 MB cap and exit 3 (marked provisional), STILL_AT, the payoff-still rule, the safe area and the frame-rate cap. It keeps the attribution line.
  • R2-5 (macOS claim, drawtext): fixed in 001fe72. The playbook and the header now say the scripts avoid GNU-only tools but are tested on Linux only, macOS untested; the tools line says the contact-sheet commands need drawtext (libfreetype).

No regressions: without STILL_AT, and with STILL_AT=2.5, the hero and poster are byte-identical to the ones the previous head (4b5949d) produced from the same input. The thumbnail is not always byte-identical, but that is ffmpeg, not this change: three back-to-back runs of the unchanged thumbnail command on the same hero gave two different files, 56 dB apart (I assume threaded scaling).

CI on 001fe72: test, e2e and a11y all pass (run 46726311298); none of them exercises these scripts.

🤖 Generated with Claude Code — Opus 5.5, claude-opus-5-5

The site will cap the served banner video at 10 MB (#1468), so the
script's hard cap matches it. The 2.5 MB target is unchanged. Rule 4 and
step 3 of the playbook now say 10 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HFUXRa2hBVnK4hXzY8dK68

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant