Files
hoelee-blog/scripts/banner-gen
hoelee e6476e1d15
Deploy / build (push) Successful in 24s
post(devops): every player stuttered on the same video — the file was blameless (EN+ZH) + og/banner
The converted HEVC stuttered in VLC, Chrome and on an iPad (offline) while the source played fine.
Container timing was perfect (5818/5818 frame intervals at exactly 0.040000 s, no dup/backward PTS,
ctts not flat) and a full decode printed nothing. Cross-decoder SSIM found the real defect: NVDEC's
legacy av1_cuvid wrapper returns frames from the wrong timestamps - 106 of 5819 frames, SSIM down to
0.330, deterministically, roughly every 30 frames - and the HEVC output was a faithful encode of those
wrong pictures (min 0.991 against the NVDEC decode, min 0.330 against a software decode). Fix is one
line (-hwaccel cuda -hwaccel_output_format cuda -c:v av1, verified 1.000000 over 1500 frames; vp9_cuvid
unaffected). Adds the content gate (structure AND pictures, defect-shaped thresholds) to the pipeline.
2026-10-08 04:52:04 +08:00
..

banner-gen — per-post banner/hero image generator

Generates a branded 1600×900 (16:9) banner image for a blog post — shown at the top of the article, above the title. Matches the site's cobalt-blue branding and the "terminal / debugging" visual language (siblings with scripts/og-gen/, which produces the 1200×630 social-share image).

Usage

node scripts/banner-gen/generate.mjs <post-slug>

Reads the post's category from frontmatter, fills template.html, renders with headless Chrome, and writes public/banners/<slug>.png.

Then add banner: /banners/<slug>.png to the post frontmatter (en + zh) — [...slug].astro renders it above the H1 title.

Customizing content

Each post's banner content lives in BANNERS in generate.mjs, keyed by slug, with three parts:

  • titlebar — the terminal window's title-bar text
  • lines — terminal body rows: { t, text } where t ∈ cmd · dim · err (red) · ok (green) · hl (amber) · prompt ($)
  • flow — bottom pipeline steps: { n: '1', label: '...', err?: true }

No entry → a generic default banner.

Requirements

  • Google Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe (CHROME_PATH to override).
  • Node 20+.

Relationship to og-gen

  • og-gen → public/og/<slug>.png (1200×630, 2:1) for social sharing.
  • banner-gen → public/banners/<slug>.png (1600×900, 16:9) for the article hero. The banner is a "filled" visual (terminal + flow pipeline), not a poster — avoid large empty margins.