Video: voxel titles, new opening with world turn, app punch-ins and callouts, six-screen montage, props sequence; site carries the new film

This commit is contained in:
ZacharyZhang-NY committed 2026-10-09 00:36:35 -04:00
1 parent 70cd57bd5d
commit 4d8bd05633
37 files changed
+2672 -165

No files matched your search

+1 -1
View File
@@ -15,7 +15,7 @@ const { x, y, w, h } = plan.window;
const css = `
html, body { margin: 0; width: 1920px; height: 1080px; background: transparent; }
.hole { position: absolute; left: ${x}px; top: ${y}px; width: ${w}px; height: ${h}px; border-radius: 10px;
box-shadow: 0 0 0 1px rgba(0,0,0,.07), 0 18px 48px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.05), 0 0 0 3000px #fbfbfa; }
box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 0 0 3000px #fbfbfa; }
.cap { position: absolute; left: ${x}px; right: ${1920 - x - w}px; top: ${y + h}px; bottom: 0;
display: flex; align-items: center; gap: 28px; color: #1d1d1f; -webkit-font-smoothing: antialiased; }
.name { font: 700 30px/1 "SF Pro Display", system-ui; letter-spacing: -0.01em; color: #3d7fe5; min-width: 150px; }
+14 -5
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Pulls stills at boundaries and mid-sections for review.
# Pulls stills at boundaries and fixes, plus contact sheets.
set -euo pipefail
here="$(cd "$(dirname "$0")" && pwd)"
film="$here/../out/ElyOffice-launch.mp4"
@@ -7,9 +7,18 @@ out="$here/../out/edit/check"
rm -rf "$out"
mkdir -p "$out"
ffprobe -v error -show_entries format=duration:stream=codec_name,profile,width,height,r_frame_rate,pix_fmt -of compact "$film"
# Frames: scene ends, plate mids, cuts, inner cuts, section ends.
frames=(0 120 257 258 400 514 515 545 578 579 640 700 771 772 805 835 836 870 899 900 960 1028 1029 1060 1092 1093 1120 1141 1142 1180 1221 1222 1260 1285
1286 1320 1349 1350 1400 1450 1542 1543 1575 1607 1608 1630 1655 1656 1700 1799 1800 1835 1864 1865 1950 2057 2058 2200 2315 2450 2572 2699)
frames=(0 60 128 129 250 386 450 513 514 515 540 560 570 576 578 579 640 700 771 772 800 830 835 836 900 957 965 1011
1029 1080 1092 1093 1150 1286 1330 1349 1350 1427 1430 1500 1543 1580 1600 1607 1608 1700 1800 1850 1864 1865 1900 1990
2057 2185 2186 2200 2230 2260 2290 2310 2314 2315 2350 2400 2420 2470 2530 2572 2620 2699)
expr=$(printf "+eq(n\\,%s)" "${frames[@]}")
ffmpeg -v error -y -i "$film" -vf "select='${expr:1}'" -fps_mode passthrough -frame_pts 1 "$out/%05d.png"
ls "$out" | wc -l
ls "$out"/*.png | wc -l
cd "$out"
ls [0-9]*.png | split -l 12 - sheet-
for list in sheet-*; do
args=()
while read -r f; do args+=(-i "$f"); done < "$list"
n=$(wc -l < "$list" | tr -d ' ')
ffmpeg -v error -y "${args[@]}" -filter_complex "$(for i in $(seq 0 $((n - 1))); do printf "[%d]scale=640:360[s%d];" "$i" "$i"; done)$(for i in $(seq 0 $((n - 1))); do printf "[s%d]" "$i"; done)xstack=inputs=$n:layout=$(python3 -c "print('|'.join(f'{(i%3)*640}_{(i//3)*360}' for i in range($n)))"):fill=black" "$list.png"
rm "$list"
done
+134 -29
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""Composites the launch film from scenes, recordings and captions."""
"""Composites the launch film from scenes, recordings, layers and captions."""
import json
import math
import subprocess
@@ -10,11 +10,15 @@ HERE = Path(__file__).resolve().parent
OUT = HERE.parent / "out"
SCENES = OUT / "scenes"
REC = OUT / "rec"
EXTRA = OUT / "extra"
WORK = OUT / "edit"
FILM = OUT / "ElyOffice-launch.mp4"
FPS = 30
BEAT = 60 / 112
TOTAL = 2700
RGB_IN = "scale=in_color_matrix=bt709:in_range=tv,format=rgb24"
# Recording is shrunk into a padded frame for clean edges.
PAD = 4
def run(args):
@@ -33,19 +37,64 @@ def lerp(points, x):
def piecewise(points, var):
"""An ffmpeg expression for lerp over var."""
if len(points) == 1:
return f"{points[0][1]:.4f}"
expr = None
for i in range(len(points) - 2, -1, -1):
(x0, y0), (x1, y1) = points[i], points[i + 1]
seg = f"({y0:.6f}+({var}-{x0:.6f})*{(y1 - y0) / (x1 - x0):.6f})"
expr = seg if expr is None else f"if(lt({var},{x1:.6f}),{seg},{expr})"
seg = f"({y0:.4f}+({var}-{x0:.4f})*{(y1 - y0) / (x1 - x0):.6f})"
expr = seg if expr is None else f"if(lt({var},{x1:.4f}),{seg},{expr})"
return expr
def knots(values):
"""Breakpoints where a per-frame series stops being linear."""
keep = [(0, values[0])]
for k in range(1, len(values) - 1):
if abs(values[k - 1] - 2 * values[k] + values[k + 1]) > 1e-3:
keep.append((k, values[k]))
if len(values) > 1:
keep.append((len(values) - 1, values[-1]))
return keep
def frames_expr(values):
"""Per-frame value; perspective counts input frames from one."""
return "+".join(f"eq(in,{k + 1})*{v:.3f}" for k, v in enumerate(values))
def solve(a, b):
"""Gaussian elimination for a small dense system."""
n = len(b)
m = [row[:] + [b[i]] for i, row in enumerate(a)]
for c in range(n):
p = max(range(c, n), key=lambda r: abs(m[r][c]))
m[c], m[p] = m[p], m[c]
for r in range(n):
if r != c:
f = m[r][c] / m[c][c]
m[r] = [x - f * y for x, y in zip(m[r], m[c])]
return [m[i][n] / m[i][i] for i in range(n)]
def homography(src, dst):
"""3x3 map taking four src points to four dst points."""
a, b = [], []
for (x, y), (u, v) in zip(src, dst):
a.append([x, y, 1, 0, 0, 0, -u * x, -u * y]); b.append(u)
a.append([0, 0, 0, x, y, 1, -v * x, -v * y]); b.append(v)
h = solve(a, b) + [1]
return lambda x, y: ((h[0] * x + h[1] * y + h[2]) / (h[6] * x + h[7] * y + 1),
(h[3] * x + h[4] * y + h[5]) / (h[6] * x + h[7] * y + 1))
def padded(corners):
"""Pins for the padded frame so the content meets `corners`."""
content = [(PAD, PAD), (1920 - PAD, PAD), (PAD, 1080 - PAD), (1920 - PAD, 1080 - PAD)]
h = homography(content, corners)
return [h(0, 0), h(1920, 0), h(0, 1080), h(1920, 1080)]
def piece_chain(label, piece, start, f0, f1, out):
"""Retimes one recording piece into frames f0..f1 of a section."""
anchors = [((start + b) * BEAT, s) for b, s in piece["anchors"]]
@@ -82,10 +131,12 @@ def section(s, scene, end, plan):
inputs += ["-framerate", FPS, "-i", SCENES / scene["name"] / "%05d.png"]
inputs += ["-loop", 1, "-framerate", FPS, "-i", WORK / "cards" / "frame.png"]
inputs += ["-loop", 1, "-framerate", FPS, "-i", WORK / "cards" / f"{app}.png"]
inputs += ["-loop", 1, "-framerate", FPS, "-i", WORK / "cards" / "frame.png"]
chains.append(f"{''.join(parts)}concat=n={len(parts)}:v=1:a=0[rec]")
chains.append(f"[rec]split[ra][rb]")
chains.append(plate_chain(scene, f"[ra]trim=end_frame={n_plate},setpts=PTS-STARTPTS", k, "plate"))
chains.append(full_chain(s, plan, f"[rb]trim=start_frame={n_plate},setpts=PTS-STARTPTS", length - n_plate, k, "full"))
chains.append("[rec]split[ra][rb]")
chains.append(plate_chain(scene, "[ra]trim=end_frame=%d,setpts=PTS-STARTPTS" % n_plate, k, f"[{k + 3}:v]format=rgba", "plate"))
chains.append(full_chain(app, plan, "[rb]trim=start_frame=%d,setpts=PTS-STARTPTS" % n_plate,
first + n_plate, length - n_plate, k, f"[{k + 1}:v]", "full"))
chains.append("[plate][full]concat=n=2:v=1:a=0,format=rgb24[v]")
target = WORK / f"{app}.mkv"
run([*inputs, "-filter_complex", ";".join(chains), "-map", "[v]", "-frames:v", length,
@@ -93,11 +144,11 @@ def section(s, scene, end, plan):
return target
def plate_chain(scene, rec, k, out):
"""Pins the recording onto the plate's screen face."""
def plate_chain(scene, rec, k, card, out):
"""Pins the recording to the screen face, then flattens it into the window."""
data = json.loads((SCENES / f"{scene['name']}.json").read_text())["frames"]
landed = next(f["corners"] for f in data if f["corners"])
corners = [f["corners"] or landed for f in data]
corners = [padded(f["corners"] or landed) for f in data]
pins = ":".join(
f"{axis}{c}='{frames_expr([fr[c][j] for fr in corners])}'"
for c in range(4) for j, axis in enumerate("xy")
@@ -106,28 +157,48 @@ def plate_chain(scene, rec, k, out):
f",colorchannelmixer=aa={f['opacity']:.3f}:enable='eq(n,{f['local']})'"
for f in data if f["opacity"] < 0.999
)
flats = "".join(
f",colorchannelmixer=aa={f['flat']:.4f}:enable='eq(n,{f['local']})'"
for f in data if f["flat"] < 0.9999
)
return (
f"{rec},scale=800:450:flags=area,scale=1912:1072:flags=bicubic,format=rgba,"
f"pad=1920:1080:4:4:color=black@0,setsar=1,perspective={pins}:sense=destination:eval=frame:interpolation=cubic"
f"{fades}[pin];[{k}:v]format=rgba[bg];[bg][pin]overlay=format=rgb:eof_action=repeat,format=rgb24,setsar=1[{out}]"
f"{rec},scale=1920-{2 * PAD}:1080-{2 * PAD}:flags=area,format=rgba,"
f"pad=1920:1080:{PAD}:{PAD}:color=black@0,setsar=1,"
f"perspective={pins}:sense=destination:eval=frame:interpolation=cubic{fades}[pin];"
f"{card}{flats}[mask];"
f"[{k}:v]format=rgba[bg];[bg][mask]overlay=format=rgb:shortest=1[bm];"
f"[bm][pin]overlay=format=rgb:eof_action=repeat,format=rgb24,setsar=1[{out}]"
)
def full_chain(s, plan, rec, n, k, out):
"""Letterboxes the recording with a slow push and the caption."""
def view_expr(app, first, n):
"""Per-frame crop of the recording from the fx layer, or the whole."""
path = EXTRA / f"{app}-fx" / "view.json"
if not path.exists():
return [[0, 0, 1920, 1080]] * n
view = json.loads(path.read_text())
rects = view["rects"]
if view["first"] != first or len(rects) < n:
raise SystemExit(f"{path}: frames {view['first']}+{len(rects)} do not cover {first}+{n}")
return rects[:n]
def full_chain(app, plan, rec, first, n, k, card, out):
"""Letterboxes the recording with the fx punch-ins and the caption."""
w = plan["window"]
fx, fy = s["focus"]
z = f"(1+{plan['push'] - 1:.4f}*in/{n - 1})"
cw, ch = f"(1920/{z})", f"(1080/{z})"
left = f"clip({fx}-{cw}/2,0,1920-{cw})"
top = f"clip({fy}-{ch}/2,0,1080-{ch})"
quad = (f"x0='{left}':y0='{top}':x1='{left}+{cw}':y1='{top}':"
f"x2='{left}':y2='{top}+{ch}':x3='{left}+{cw}':y3='{top}+{ch}'")
rects = view_expr(app, first, n)
series = {
"left": [r[0] for r in rects], "top": [r[1] for r in rects],
"right": [r[0] + r[2] for r in rects], "bottom": [r[1] + r[3] for r in rects],
}
e = {name: piecewise(knots(v), "(in-1)") for name, v in series.items()}
quad = (f"x0='{e['left']}':y0='{e['top']}':x1='{e['right']}':y1='{e['top']}':"
f"x2='{e['left']}':y2='{e['bottom']}':x3='{e['right']}':y3='{e['bottom']}'")
rise = "round(12*pow(max(0,1-t/0.2),2))"
return (
f"{rec},perspective={quad}:sense=source:eval=frame:interpolation=cubic,"
f"scale={w['w']}:{w['h']}:flags=lanczos,pad=1920:1080:{w['x']}:{w['y']}:color=0xfbfbfa,setsar=1,format=rgba[lb];"
f"[{k + 1}:v]format=rgba[fr];[lb][fr]overlay=format=rgb:shortest=0[lf];"
f"[lb]{card}overlay=format=rgb:shortest=1[lf];"
f"[{k + 2}:v]format=rgba,fade=in:st=0:d=0.2:alpha=1[cap];"
f"[lf][cap]overlay=x=0:y='{rise}':format=rgb:eval=frame,trim=end_frame={n},format=rgb24,setsar=1[{out}]"
)
@@ -137,18 +208,52 @@ def scene_input(name):
return ["-framerate", FPS, "-i", SCENES / name / "%05d.png"]
def layers():
"""Delivered layers, later starts on top; grid under its fx."""
found = []
for path in sorted(EXTRA.glob("*/manifest.json")):
m = json.loads(path.read_text())
if m["fps"] != FPS or m["kind"] not in ("base", "over"):
raise SystemExit(f"{path}: unexpected manifest")
have = len(list(path.parent.glob("[0-9]*.png")))
if have != m["count"]:
raise SystemExit(f"{path}: {have} frames, manifest says {m['count']}")
found.append(m | {"dir": path.parent})
rank = lambda m: (m["first"], m["kind"] != "base", m["name"] != "fx-grid")
return sorted(found, key=rank)
def starts():
"""Each app name layer starts no earlier than its plate."""
scenes = json.loads((SCENES / "scenes.json").read_text())["scenes"]
return {f"type-{s['name'][6:]}": s["first"] for s in scenes if s["name"].startswith("plate-")}
def film(made):
"""Joins every part and the music into the final MP4."""
"""Joins every part, lays the delivered layers on top, adds music."""
order = ["opening", "rise", *made, "files", "props", "end"]
inputs = []
for part in order:
inputs += ["-i", part] if isinstance(part, Path) else scene_input(part)
graph = ["".join(f"[{i}:v]" for i in range(len(order)))
+ f"concat=n={len(order)}:v=1:a=0,format=rgb24,settb=1/{FPS},setpts=N[base0]"]
last = "base0"
floor = starts()
for j, m in enumerate(layers()):
if m["first"] < floor.get(m["name"], 0):
m = m | {"first": floor[m["name"]], "count": m["count"] - (floor[m["name"]] - m["first"])}
index = sum(1 for a in inputs if a == "-i")
inputs += ["-framerate", FPS, "-start_number", m["first"], "-i", m["dir"] / "%05d.png"]
hold = ",tpad=stop_mode=clone:stop=1" if m["name"] == "opening" else ""
graph.append(f"[{index}:v]format=rgba{hold},settb=1/{FPS},setpts=N+{m['first']}[l{j}]")
graph.append(f"[{last}][l{j}]overlay=format=rgb:eof_action=pass:repeatlast=0[base{j + 1}]")
print(f"layer {m['name']}: {m['kind']} {m['first']}..{m['first'] + m['count'] - 1}")
last = f"base{j + 1}"
music = sum(1 for a in inputs if a == "-i")
inputs += ["-i", OUT / "music.wav"]
joined = "".join(f"[{i}:v]" for i in range(len(order)))
graph = (f"{joined}concat=n={len(order)}:v=1:a=0,"
"scale=out_color_matrix=bt709:out_range=tv,format=yuv420p[v]")
run([*inputs, "-filter_complex", graph, "-map", "[v]", "-map", f"{len(order)}:a",
"-frames:v", 2700, "-c:v", "libx264", "-profile:v", "high", "-preset", "slow", "-crf", 18,
graph.append(f"[{last}]setpts=N/{FPS}/TB,scale=out_color_matrix=bt709:out_range=tv,format=yuv420p[v]")
run([*inputs, "-filter_complex", ";".join(graph), "-map", "[v]", "-map", f"{music}:a",
"-frames:v", TOTAL, "-c:v", "libx264", "-profile:v", "high", "-preset", "slow", "-crf", 18,
"-colorspace", "bt709", "-color_primaries", "bt709", "-color_trc", "bt709", "-color_range", "tv",
"-r", FPS, "-c:a", "aac", "-b:a", "192k", "-t", "90", "-movflags", "+faststart", FILM])
@@ -166,7 +271,7 @@ def main():
if not only or s["app"] in only:
target = section(s, scenes[i], scenes[i + 1]["first"], plan)
made.append(target)
if not only:
if not only or "film" in only:
film(made)
+4 -11
View File
@@ -1,25 +1,21 @@
{
"window": { "x": 144, "y": 40, "w": 1632, "h": 918 },
"push": 1.16,
"sections": [
{
"app": "doc", "title": "ElyDoc", "en": "Write. Offline.", "zh": "离线写作。",
"focus": [780, 470],
"pieces": [
{ "src": "doc", "anchors": [[0, 1.0], [4, 3.4], [9, 8.0], [10, 8.8], [12, 10.3], [15, 12.7], [16, 13.6]] }
{ "src": "doc", "anchors": [[0, 1.0], [4, 3.4], [9, 8.0], [10, 8.8], [12, 10.3], [15, 12.233], [16, 13.6]] }
]
},
{
"app": "table", "title": "ElyTable", "en": "Sum it. Chart it.", "zh": "求和,出图。",
"focus": [700, 430],
"pieces": [
{ "src": "table", "anchors": [[0, 1.0], [4, 3.9], [8, 7.3]] },
{ "src": "table", "anchors": [[8, 17.0], [12, 20.3], [16, 23.6]] }
{ "src": "table", "anchors": [[8, 17.0], [12, 19.933], [15, 22.683], [16, 23.6]] }
]
},
{
"app": "show", "title": "ElyShow", "en": "Animate. Present.", "zh": "加动画,去放映。",
"focus": [900, 470],
"pieces": [
{ "src": "show", "anchors": [[0, 0.6], [4, 4.2], [7, 6.6]] },
{ "src": "show", "anchors": [[7, 11.8], [12, 15.0]] },
@@ -28,14 +24,12 @@
},
{
"app": "pdf", "title": "ElyPDF", "en": "Mark up. Sign.", "zh": "批注,签名。",
"focus": [1090, 540],
"pieces": [
{ "src": "pdf", "anchors": [[0, 0.8], [4, 4.8], [6, 6.3], [8, 8.2], [9, 9.2], [12, 12.7], [15, 15.4], [16, 16.6]] }
{ "src": "pdf", "anchors": [[0, 0.8], [4, 4.6], [5, 5.083], [8, 8.2], [9, 9.0], [13, 13.0], [14, 13.9], [16, 15.9]] }
]
},
{
"app": "tree", "title": "ElyTree", "en": "Stage. Commit. Look back.", "zh": "暂存,提交,回看历史。",
"focus": [830, 420],
"pieces": [
{ "src": "tree", "anchors": [[0, 0.8], [4, 3.6], [5, 4.1], [7, 7.2]] },
{ "src": "tree", "anchors": [[7, 10.4], [8, 11.4], [9, 13.2], [11, 15.5], [16, 19.9]] }
@@ -43,9 +37,8 @@
},
{
"app": "mark", "title": "ElyMark", "en": "Markdown, two ways.", "zh": "Markdown,可视与源码。",
"focus": [1000, 460],
"pieces": [
{ "src": "mark", "anchors": [[0, 0.6], [4, 2.8], [7, 5.9], [12, 10.4], [15, 12.7], [16, 13.6]] }
{ "src": "mark", "anchors": [[0, 0.6], [4, 2.8], [7, 5.9], [12, 10.267], [15, 12.55], [16, 13.6]] }
]
}
]