caelum0x 524f2ddea5 fix(near-hackathon): re-voice false "live on two other chains" claim in pitch demo video
Narration line 2 said Cred402 is "already live on two other chains, and
now native NEAR" — false. Live checks against
cred402-1.onrender.com/v1/x402/{algorand,qie}/status both return
configured:false. The deck was already corrected (4eb21fe); this patches
the video's narration to match.

New line 2: "Cred402 sells credit scores to AI agents over a pay per
call payment protocol, and now it's enforced natively on NEAR." Same
Aura-2 voice (aura-2-asteria-en — re-derived acoustically, since no
voice ID was recorded in the original build: synthesized the real line 1
text in all 5 cataloged voices and compared pitch/spectral-centroid
against the shipped audio; asteria matched an order of magnitude closer
than the next candidate). Same per-line Deepgram nova-3 QC round-trip.

Only the line 2 window (8.9s-17.766s) was touched — confirmed by frame
diff that this whole span is a single static held title card in the
shipped video, so the patch could re-render just that card + new
captions + new audio and splice it between the untouched first 8.9s and
untouched remainder (which includes line 3's unmoved 19.5s start).
Re-transcribed the full final audio with nova-3 to confirm lines 1 and
3-6 are unchanged.

Duration unchanged (70.6s), resolution/fps/codec unchanged (1920x1080,
30fps, h264/aac). Re-mastered loudness: -14.8 LUFS integrated / -1.8
dBTP true peak (both within spec).

Reproducible recipe: media/video-recipe/line2-fix/ (generate_line2_audio.py
-> render_line2_assets.mjs -> build_patch.sh).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-11 02:06:42 +03:00

94 lines
4.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# build_patch.sh — splice the re-voiced narration line 2 into
# ../../cred402-near-spendguard-pitch-demo.mp4 without touching any other
# line's audio or timing. See README.md "Judge-review correction,
# 2026-11-11" for why, and generate_line2_audio.py / render_line2_assets.mjs
# for how the new audio/caption/plate assets in this folder were made.
#
# The whole edit window (8.9s -> 17.766667s on the film's master clock) is,
# in the shipped video, a single STATIC held title card (card2 "what it
# is") with nothing else moving behind the captions — confirmed by
# extracting frames across that range and diffing them. That's what makes
# a clean, surgical patch possible: this script re-renders only that
# window (new audio + new caption pills over the SAME plate background,
# ../render_cards.mjs's card2 params, re-rendered at its held frame) and
# concatenates it between the untouched first 8.9s and the untouched
# remainder (17.766667s onward — everything from there, including line 3's
# audio at 19.5s, is byte-for-byte the original).
#
# Run from this directory:
# bash build_patch.sh
# Writes ../../cred402-near-spendguard-pitch-demo.mp4 (overwrites in
# place — the original is in git history / commit 4eb21fe if you need it).
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MEDIA="$(cd "$HERE/../.." && pwd)"
ORIG="$MEDIA/cred402-near-spendguard-pitch-demo.mp4"
WORK="$(mktemp -d)"
trap 'rm -rf "$WORK"' EXIT
PATCH_START=8.9 # unchanged l2 slot start from the original build
PATCH_END=17.766667 # frame 533 @ 30fps — nearest frame boundary to
# the original slot end (17.756); l3 starts at
# 19.5s either way, so the ~11ms snap touches
# nothing audible or visible.
PATCH_DUR=8.866667
GAIN=$(python3 -c "import json;print(json.load(open('$HERE/l2_take.json'))['gain_db'])")
ffmpeg -y \
-i "$ORIG" \
-loop 1 -i "$HERE/plate.png" \
-loop 1 -i "$HERE/cue_00.png" \
-loop 1 -i "$HERE/cue_01.png" \
-loop 1 -i "$HERE/cue_02.png" \
-i "$HERE/voice/l2.mp3" \
-filter_complex "
[0:v]trim=start=0:end=${PATCH_START},setpts=PTS-STARTPTS,fps=30,format=yuv420p[v1];
[0:v]trim=start=${PATCH_END},setpts=PTS-STARTPTS,fps=30,format=yuv420p[v3];
[1:v]format=yuv420p[plate];
[2:v]format=rgba[c0];
[3:v]format=rgba[c1];
[4:v]format=rgba[c2];
[plate][c0]overlay=enable='between(t,0.24,3.44)':shortest=0[p1];
[p1][c1]overlay=enable='between(t,3.44,5.76)':shortest=0[p2];
[p2][c2]overlay=enable='between(t,6.00,8.16)':shortest=0,trim=duration=${PATCH_DUR},setpts=PTS-STARTPTS,fps=30,format=yuv420p[patchv];
[0:a]atrim=start=0:end=${PATCH_START},asetpts=PTS-STARTPTS[a1];
[0:a]atrim=start=${PATCH_END},asetpts=PTS-STARTPTS[a3];
[5:a]aresample=48000,volume=${GAIN}dB,aformat=channel_layouts=mono,apad,atrim=duration=${PATCH_DUR},asetpts=PTS-STARTPTS[a2];
[v1][a1][patchv][a2][v3][a3]concat=n=3:v=1:a=1[outv][outa]
" \
-map "[outv]" -map "[outa]" \
-c:v libx264 -preset slow -crf 16 -pix_fmt yuv420p \
-c:a pcm_s16le -ar 48000 -ac 1 \
"$WORK/intermediate.mp4" \
-loglevel error -stats
# Two-pass loudnorm (measure, then apply with the real measured values),
# same recipe as the original build (README: "mastered with two-pass
# loudnorm (I=-14, TP=-1.5) plus a final gain nudge and alimiter"). The
# video stream is copied, not re-encoded again — only audio changes here.
STATS=$(ffmpeg -i "$WORK/intermediate.mp4" \
-af loudnorm=I=-14:TP=-1.5:LRA=11:print_format=json -f null - 2>&1)
I=$(echo "$STATS" | grep -o '"input_i" *: *"[^"]*"' | grep -o '\-\?[0-9.]*' | tail -1)
TP=$(echo "$STATS" | grep -o '"input_tp" *: *"[^"]*"' | grep -o '\-\?[0-9.]*' | tail -1)
LRA=$(echo "$STATS" | grep -o '"input_lra" *: *"[^"]*"' | grep -o '\-\?[0-9.]*' | tail -1)
THRESH=$(echo "$STATS" | grep -o '"input_thresh" *: *"[^"]*"' | grep -o '\-\?[0-9.]*' | tail -1)
echo "measured: I=$I TP=$TP LRA=$LRA thresh=$THRESH"
# Target TP -2.0 / alimiter -2.0dB, not -1.5 — ebur128's true-peak
# measurement (inter-sample peaks) runs ~0.3-0.4dB hotter than loudnorm's
# own single-pass estimate on this track, so -1.5 undershot the <=-1.5dBTP
# requirement by ~0.1dB on the first pass. -2.0 lands at a measured
# -1.8dBTP with comfortable margin (original shipped video: -1.9dBTP).
ffmpeg -y -i "$WORK/intermediate.mp4" \
-map 0:v -map 0:a \
-c:v copy \
-af "loudnorm=I=-14:TP=-2.0:LRA=11:measured_I=${I}:measured_TP=${TP}:measured_LRA=${LRA}:measured_thresh=${THRESH}:linear=true,alimiter=limit=-2.0dB:level=disabled" \
-c:a aac -b:a 160k -ar 48000 -ac 1 \
"$ORIG" -loglevel error
echo "wrote $ORIG"
ffprobe -v error -show_entries format=duration -of default=nw=1:nk=1 "$ORIG"
ffmpeg -i "$ORIG" -af ebur128=peak=true -f null - 2>&1 | tail -14