@usemosio/cli-linux-x64 1.0.0-next.1 → 1.0.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES.md +22 -0
- package/apps/studio/dist/assets/Workspace-Dr-hVeFd.js +34 -0
- package/apps/studio/dist/assets/{agent-panel-CqJuv5Sn.js → agent-panel-DMrVed-J.js} +5 -5
- package/apps/studio/dist/assets/{boundary-bK2S8z05.js → boundary-DL9veUlN.js} +1 -1
- package/apps/studio/dist/assets/{feedback-BqzXUdVd.js → feedback-x6ZumR_x.js} +1 -1
- package/apps/studio/dist/assets/index-C6juWzGV.js +1984 -0
- package/apps/studio/dist/assets/index-CjDBKmB_.css +2 -0
- package/apps/studio/dist/assets/inspector3d-sqergHSP.js +1 -0
- package/apps/studio/dist/index.html +4 -3
- package/apps/studio/dist-host/studio-host.mjs +262 -3
- package/bin/mosio +0 -0
- package/bin/mosio-agent +0 -0
- package/crates/mosio/src/adapters/mosio-three.js +112 -8
- package/crates/mosio/src/adapters/room-env-pmrem.json +1 -0
- package/crates/mosio/src/runtime.js +205 -6
- package/fixtures/camera-inspect/mosio.json +56 -0
- package/fixtures/camera-inspect/scenes/behind.html +22 -0
- package/fixtures/camera-inspect/scenes/cut.html +18 -0
- package/fixtures/camera-inspect/scenes/edges.html +18 -0
- package/fixtures/camera-inspect/scenes/good.html +23 -0
- package/fixtures/camera-inspect/scenes/read.html +22 -0
- package/fixtures/camera-inspect/scenes/shake.html +23 -0
- package/fixtures/camera-inspect/scenes/speed.html +18 -0
- package/fixtures/camera-inspect-vertical/mosio.json +31 -0
- package/fixtures/camera-inspect-vertical/scenes/good.html +20 -0
- package/fixtures/camera-inspect-vertical/scenes/safe.html +18 -0
- package/fixtures/cloudrun-gpu/audio/music.wav +0 -0
- package/fixtures/cloudrun-gpu/audio/vo.wav +0 -0
- package/fixtures/cloudrun-gpu/mosio.json +18 -0
- package/fixtures/cloudrun-gpu/scenes/cube.html +25 -0
- package/fixtures/direct-seek/mosio.json +4 -0
- package/fixtures/direct-seek/scenes/clock.html +9 -0
- package/fixtures/direct-seek/scenes/meta.html +11 -0
- package/fixtures/direct-seek/scenes/pure.html +11 -0
- package/fixtures/direct-seek/scenes/slow.html +11 -0
- package/fixtures/direct-seek-media/mosio.json +6 -0
- package/fixtures/direct-seek-media/scenes/pure.html +11 -0
- package/fixtures/gl-readback/mosio.json +16 -0
- package/fixtures/gl-readback/scenes/compositor.html +23 -0
- package/fixtures/gl-readback/scenes/readback.html +23 -0
- package/fixtures/inspect-physics/expect.json +18 -0
- package/fixtures/inspect-physics/mosio.json +29 -0
- package/fixtures/inspect-physics/scenes/calm.html +46 -0
- package/fixtures/inspect-physics/scenes/physics.html +47 -0
- package/package.json +1 -1
- package/primitives/README.md +23 -2
- package/primitives/example/shared/mosio-prims.js +349 -1
- package/primitives/impact-burst/golden/f030.png +0 -0
- package/primitives/impact-burst/golden/f032.png +0 -0
- package/primitives/impact-burst/golden/f036.png +0 -0
- package/primitives/impact-burst/impact-burst.js +51 -0
- package/primitives/impact-burst/primitive.json +130 -0
- package/primitives/impact-burst/scene.html +24 -0
- package/primitives/stick-figure/golden/f030.png +0 -0
- package/primitives/stick-figure/golden/f092.png +0 -0
- package/primitives/stick-figure/golden/f140.png +0 -0
- package/primitives/stick-figure/primitive.json +179 -0
- package/primitives/stick-figure/scene.html +40 -0
- package/primitives/stick-figure/stick-figure.js +297 -0
- package/primitives/zoom-through/primitive.json +7 -2
- package/primitives/zoom-through/zoom-through.js +6 -5
- package/scripts/3d-acceptance.sh +8 -1
- package/scripts/3d-attach-bench.mjs +119 -0
- package/scripts/3d-bake-room-env.mjs +74 -0
- package/scripts/3d-e2b-job.sh +1 -0
- package/scripts/3d-gen-heavy-fixture.py +65 -0
- package/scripts/3d-trace-summary.py +14 -0
- package/scripts/acceptance/camera-inspect.sh +49 -0
- package/scripts/acceptance/direct-seek.sh +68 -0
- package/scripts/acceptance/export.sh +5 -3
- package/scripts/acceptance/frames.sh +7 -2
- package/scripts/acceptance/hardening.sh +37 -6
- package/scripts/acceptance/hub.sh +208 -0
- package/scripts/acceptance/inspect.sh +21 -2
- package/scripts/acceptance/revisions-git.sh +137 -0
- package/scripts/acceptance/revisions-sync.sh +323 -0
- package/scripts/acceptance/revisions.sh +118 -4
- package/scripts/acceptance/segcache.sh +100 -0
- package/scripts/acceptance/split.sh +78 -0
- package/scripts/bootstrap.sh +20 -1
- package/scripts/check-error-codes.py +9 -1
- package/scripts/check-file-size.sh +45 -0
- package/scripts/ci.sh +4 -4
- package/scripts/dedupe-report.sh +47 -0
- package/scripts/e2b/template/provision.sh +1 -1
- package/scripts/fastpath/cdp.mjs +25 -0
- package/scripts/fastpath/dbg.mjs +11 -0
- package/scripts/fastpath/e2b.mjs +40 -0
- package/scripts/fastpath/features/gen.py +109 -0
- package/scripts/fastpath/features/mosio.json +100 -0
- package/scripts/fastpath/features/scenes/backdrop.html +11 -0
- package/scripts/fastpath/features/scenes/blend.html +11 -0
- package/scripts/fastpath/features/scenes/canvas2d.html +11 -0
- package/scripts/fastpath/features/scenes/filter.html +11 -0
- package/scripts/fastpath/features/scenes/gradient.html +11 -0
- package/scripts/fastpath/features/scenes/iframe.html +11 -0
- package/scripts/fastpath/features/scenes/image.html +11 -0
- package/scripts/fastpath/features/scenes/svg.html +11 -0
- package/scripts/fastpath/features/scenes/text.html +11 -0
- package/scripts/fastpath/features/scenes/typo.html +11 -0
- package/scripts/fastpath/features/scenes/video.html +11 -0
- package/scripts/fastpath/features/scenes/video2.html +11 -0
- package/scripts/fastpath/features-xfade/mosio.json +49 -0
- package/scripts/fastpath/features-xfade/scenes/image.html +11 -0
- package/scripts/fastpath/features-xfade/scenes/video.html +11 -0
- package/scripts/fastpath/fixtures/gen_layout.py +80 -0
- package/scripts/fastpath/fixtures/l12-no-reset/assets/img/photo-1015.jpg +0 -0
- package/scripts/fastpath/fixtures/l12-no-reset/mosio.json +34 -0
- package/scripts/fastpath/fixtures/l12-no-reset/scenes/main.html +20 -0
- package/scripts/fastpath/fp.mjs +91 -0
- package/scripts/fastpath/inpage.js +68 -0
- package/scripts/fastpath/recipes.py +49 -0
- package/scripts/fastpath/sandbox.sh +68 -0
- package/scripts/fastpath/sandbox10.sh +57 -0
- package/scripts/fastpath/sandbox11.sh +18 -0
- package/scripts/fastpath/sandbox12.sh +30 -0
- package/scripts/fastpath/sandbox13.sh +16 -0
- package/scripts/fastpath/sandbox14.sh +28 -0
- package/scripts/fastpath/sandbox15.sh +36 -0
- package/scripts/fastpath/sandbox16.sh +60 -0
- package/scripts/fastpath/sandbox17.sh +34 -0
- package/scripts/fastpath/sandbox18.sh +59 -0
- package/scripts/fastpath/sandbox19.sh +67 -0
- package/scripts/fastpath/sandbox2.sh +41 -0
- package/scripts/fastpath/sandbox20.sh +34 -0
- package/scripts/fastpath/sandbox21.sh +22 -0
- package/scripts/fastpath/sandbox22.sh +22 -0
- package/scripts/fastpath/sandbox23.sh +21 -0
- package/scripts/fastpath/sandbox3.sh +151 -0
- package/scripts/fastpath/sandbox4.sh +161 -0
- package/scripts/fastpath/sandbox5.sh +69 -0
- package/scripts/fastpath/sandbox6.sh +85 -0
- package/scripts/fastpath/sandbox7.sh +81 -0
- package/scripts/fastpath/sandbox8.sh +62 -0
- package/scripts/fastpath/sandbox9.sh +130 -0
- package/scripts/fastpath/srv.mjs +15 -0
- package/scripts/fastpath/www/probe.html +1 -0
- package/scripts/gen-media-fixtures.sh +1 -0
- package/scripts/gl-readback-check.sh +26 -0
- package/scripts/hpbench/make-bench-fixtures.sh +43 -0
- package/scripts/hpbench/render-cgroup.sh +56 -0
- package/scripts/install.sh +2 -1
- package/scripts/npm-clean-install-proof-win.sh +64 -0
- package/scripts/platform-smoke.sh +80 -0
- package/scripts/prim.mjs +31 -13
- package/scripts/user-journey.sh +68 -0
- package/skills/mosio-3d/SKILL.md +31 -3
- package/skills/mosio-brief/SKILL.md +80 -0
- package/skills/mosio-brief/references/brief.md +141 -0
- package/skills/mosio-brief/references/copy.md +99 -0
- package/skills/mosio-brief/references/narration.md +61 -0
- package/skills/mosio-brief/references/storyboard.md +98 -0
- package/skills/mosio-collab/SKILL.md +104 -0
- package/skills/mosio-collab/references/hub.md +62 -0
- package/skills/mosio-engine/SKILL.md +44 -13
- package/skills/mosio-engine/references/camera.md +12 -2
- package/skills/mosio-engine/references/character.md +88 -0
- package/skills/mosio-engine/references/checks.md +11 -4
- package/skills/mosio-engine/references/delivery.md +29 -2
- package/skills/mosio-engine/references/kit-primitives.md +8 -4
- package/skills/mosio-engine/references/layout.md +8 -0
- package/skills/mosio-engine/references/plan.md +3 -1
- package/skills/mosio-engine/references/project.md +15 -3
- package/skills/mosio-engine/references/publish.md +79 -0
- package/skills/mosio-engine/references/registry.md +27 -15
- package/skills/mosio-engine/references/timeline.md +19 -1
- package/skills/mosio-engine/references/timing.md +2 -1
- package/skills/mosio-import/SKILL.md +1 -1
- package/skills/mosio-import/references/from-hyperframes.md +1 -1
- package/skills/mosio-import/references/from-remotion.md +1 -1
- package/skills/mosio-media/SKILL.md +16 -4
- package/skills/mosio-media/references/audio.md +29 -11
- package/skills/mosio-media/references/captions.md +26 -5
- package/skills/mosio-media/references/editing.md +70 -0
- package/skills/mosio-media/references/footage.md +40 -8
- package/skills/mosio-media/references/voice.md +52 -7
- package/skills/mosio-replicate/references/mosio.md +1 -1
- package/toolchain.lock.json +151 -4
- package/apps/studio/dist/assets/Workspace-KSOFeEgc.js +0 -32
- package/apps/studio/dist/assets/index-B-uuTqe9.js +0 -1785
- package/apps/studio/dist/assets/index-CajSh04l.css +0 -2
- package/apps/studio/dist/assets/inspector3d-vDz97X99.js +0 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Round 7 (FP_SCRIPT=sandbox7.sh, MOSIO_BIN_FILE=<release build>): the per-worker sequential canvas scheduler.
|
|
3
|
+
# 1. P1, P2, stickman, features: canvas (direct output, frame-granular slices) with the runtime barrier's 3 task
|
|
4
|
+
# drains vs 1 (MOSIO_CANVAS_DRAINS), wall time and pixel hashes (drains=1 is only adopted if no frame changes)
|
|
5
|
+
# 2. bitrate curve of the direct output: 0.05 / 0.1 / 0.2 bit per pixel per frame, SSIM vs lossless and size
|
|
6
|
+
set -uo pipefail
|
|
7
|
+
cd /home/user/fp
|
|
8
|
+
B=/home/user/bench/engines/mosio; O=/home/user/out; W=/home/user/work; mkdir -p "$O" "$W"
|
|
9
|
+
export BENCH_DIR=/home/user/bench MOSIO_HOME=/opt/mosio
|
|
10
|
+
MOSIO=/home/user/mosio-custom
|
|
11
|
+
ms() { python3 -c 'import time;print(int(time.time()*1000))'; }
|
|
12
|
+
proj() { rm -rf "$2"; cp -r "$1" "$2"; mkdir -p "$2/assets"; cp -r /home/user/bench/assets/. "$2/assets/"; }
|
|
13
|
+
lossless() {
|
|
14
|
+
python3 - "$1/mosio.json" <<'PY'
|
|
15
|
+
import json, sys
|
|
16
|
+
m = json.load(open(sys.argv[1])); m.setdefault("output", {})["lossless"] = {"codec": "h264", "crf": 0, "preset": "ultrafast", "pix_fmt": "yuv420p", "gop_frames": 30}
|
|
17
|
+
json.dump(m, open(sys.argv[1], "w"))
|
|
18
|
+
PY
|
|
19
|
+
}
|
|
20
|
+
score() {
|
|
21
|
+
ffmpeg -v info -i "$1" -i "$2" -lavfi "[0:v]scale=in_range=auto:in_color_matrix=auto,format=gbrp[a];[1:v]scale=in_range=auto:in_color_matrix=auto,format=gbrp[b];[a]split[a1][a2];[b]split[b1][b2];[a1][b1]ssim;[a2][b2]psnr" -f null - > "$W/m.log" 2>&1
|
|
22
|
+
echo "ssim_$(grep -o 'All:[0-9.]*' "$W/m.log" | tail -1) psnr_$(grep -o 'average:[0-9.inf]*' "$W/m.log" | tail -1) bytes=$(stat -c %s "$1")"
|
|
23
|
+
}
|
|
24
|
+
summary() {
|
|
25
|
+
python3 - "$1" <<'PY' 2>/dev/null
|
|
26
|
+
import json, sys
|
|
27
|
+
r = json.load(open(sys.argv[1])); e = r["execution"]; sl = e["slices"]; n = sum(s["to"] - s["from"] for s in sl)
|
|
28
|
+
keys = sorted({k for s in sl for k in s["in_page_ms"] if k not in ("replayed",)})
|
|
29
|
+
st = {k: round(sum(s["in_page_ms"].get(k, 0) for s in sl) / n, 2) for k in keys}
|
|
30
|
+
print("slices", [(s["from"], s["to"]) for s in sl][:12], "replayed", [s["in_page_ms"].get("replayed") for s in sl][:12])
|
|
31
|
+
print(" per_frame", st)
|
|
32
|
+
print(" load_ms_max", max(round(s["load_ms"]) for s in sl), "replay_ms_max", round(max(s["in_page_ms"].get("replay", 0) for s in sl)),
|
|
33
|
+
"transcode_tail_ms_max", round(max(s["transcode_ms"] for s in sl)), "canvas_ms", e.get("canvas_ms"), "launch_ms", round(r["profile"]["browser_launch_ms"]),
|
|
34
|
+
"mux_ms", round(r["profile"]["concat_mux_ms"]), "warn", [w["code"] for w in r.get("warnings", [])])
|
|
35
|
+
PY
|
|
36
|
+
}
|
|
37
|
+
"$MOSIO" --version 2>/dev/null | head -1
|
|
38
|
+
minssim() { ffmpeg -v info -i "$1" -i "$2" -lavfi "[0:v]scale=in_range=auto:in_color_matrix=auto,format=gbrp[a];[1:v]scale=in_range=auto:in_color_matrix=auto,format=gbrp[b];[a][b]ssim=stats_file=$W/s.txt" -f null - > /dev/null 2>&1; python3 -c '
|
|
39
|
+
import sys; v=[float(l.split("All:")[1].split()[0]) for l in open(sys.argv[1])]; i=min(range(len(v)),key=v.__getitem__); print(f"ssim_min={v[i]:.4f}@f{i}")' "$W/s.txt"; }
|
|
40
|
+
(cd /home/user/fp/features && python3 gen.py)
|
|
41
|
+
for p in p1 p2 stickman features; do
|
|
42
|
+
src="$B/$p"; [ $p = stickman ] && src=/home/user/fp/_local/stickman; [ $p = features ] && src=/home/user/fp/features
|
|
43
|
+
proj "$src" "$W/m-$p"
|
|
44
|
+
# features: keep its <video> scenes on the canvas path so every frame is hashed
|
|
45
|
+
export MOSIO_CANVAS_VIDEO=0; [ $p = features ] && export MOSIO_CANVAS_VIDEO=1
|
|
46
|
+
t0=$(ms); "$MOSIO" render "$W/m-$p" -o "$W/$p-png.mp4" --workers 8 --no-cache > /dev/null 2>&1; t1=$(ms)
|
|
47
|
+
echo "png $p wall_ms=$((t1 - t0))" | tee -a "$O/r7.txt"
|
|
48
|
+
for d in 3 1; do
|
|
49
|
+
for r in 1 2; do
|
|
50
|
+
t0=$(ms); MOSIO_CANVAS_DRAINS=$d "$MOSIO" render "$W/m-$p" -o "$W/$p-d$d.mp4" --workers 8 --no-cache --capture canvas > "$W/rep.json" 2> "$W/err.log"; rc=$?; t1=$(ms)
|
|
51
|
+
echo "canvas $p drains=$d run=$r rc=$rc wall_ms=$((t1 - t0))" | tee -a "$O/r7.txt"
|
|
52
|
+
done
|
|
53
|
+
MOSIO_CANVAS_PROFILE=1 MOSIO_CANVAS_DRAINS=$d "$MOSIO" render "$W/m-$p" -o "$W/$p-d$d.mp4" --workers 8 --no-cache --capture canvas > "$W/rep.json" 2> "$W/err.log"
|
|
54
|
+
cp "$W/rep.json" "$O/rep-$p-d$d.json"; summary "$W/rep.json" | tee -a "$O/r7.txt" || tail -3 "$W/err.log" | tee -a "$O/r7.txt"
|
|
55
|
+
MOSIO_CANVAS_HASH=1 MOSIO_CANVAS_DRAINS=$d "$MOSIO" render "$W/m-$p" -o "$W/$p-h$d.mp4" --workers 8 --no-cache --capture canvas > /dev/null 2>&1
|
|
56
|
+
done
|
|
57
|
+
echo "hashes $p drains3_vs_drains1: $(python3 -c 'import json,sys; a=json.load(open(sys.argv[1]))["frames"]; b=json.load(open(sys.argv[2]))["frames"]; print(sum(x!=y for x,y in zip(a,b)), "of", len(a), "differ", len(b))' "$W/$p-h3.frames.json" "$W/$p-h1.frames.json" 2>&1)" | tee -a "$O/r7.txt"
|
|
58
|
+
echo "quality $p d1 vs png $(score "$W/$p-d1.mp4" "$W/$p-png.mp4") $(minssim "$W/$p-d1.mp4" "$W/$p-png.mp4")" | tee -a "$O/r7.txt"
|
|
59
|
+
done
|
|
60
|
+
echo "== bitrate curve" | tee -a "$O/r7.txt"
|
|
61
|
+
for p in p2 stickman; do
|
|
62
|
+
src="$B/$p"; [ $p = stickman ] && src=/home/user/fp/_local/stickman
|
|
63
|
+
proj "$src" "$W/r-$p"; lossless "$W/r-$p"
|
|
64
|
+
"$MOSIO" render "$W/r-$p" -o "$W/$p-ref.mp4" --workers 8 --no-cache --preset lossless > /dev/null 2>&1
|
|
65
|
+
echo "curve $p png $(score "$W/$p-png.mp4" "$W/$p-ref.mp4") $(minssim "$W/$p-png.mp4" "$W/$p-ref.mp4")" | tee -a "$O/r7.txt"
|
|
66
|
+
for bpp in 0.05 0.1 0.2; do
|
|
67
|
+
t0=$(ms); MOSIO_CANVAS_BPP=$bpp "$MOSIO" render "$W/m-$p" -o "$W/$p-b$bpp.mp4" --workers 8 --no-cache --capture canvas > /dev/null 2>&1; t1=$(ms)
|
|
68
|
+
echo "curve $p bpp=$bpp wall_ms=$((t1 - t0)) $(score "$W/$p-b$bpp.mp4" "$W/$p-ref.mp4") $(minssim "$W/$p-b$bpp.mp4" "$W/$p-ref.mp4")" | tee -a "$O/r7.txt"
|
|
69
|
+
done
|
|
70
|
+
done
|
|
71
|
+
echo "== determinism diagnosis (stickman, P1)" | tee -a "$O/r7.txt"
|
|
72
|
+
for p in stickman p1; do
|
|
73
|
+
for v in "one 1 auto" "skip 8 auto" "always 8 always" "w1b 1 auto"; do
|
|
74
|
+
set -- $v
|
|
75
|
+
MOSIO_CANVAS_HASH=1 MOSIO_CANVAS_REPLAY=$3 "$MOSIO" render "$W/m-$p" -o "$W/$p-dd-$1.mp4" --workers $2 --no-cache --capture canvas > "$W/dd-$1.json" 2>/dev/null
|
|
76
|
+
python3 -c 'import json,sys; r=json.load(open(sys.argv[1])); print(sys.argv[2], [(s["from"],s["to"]) for s in r["execution"]["slices"]])' "$W/dd-$1.json" "$1" | tee -a "$O/r7.txt"
|
|
77
|
+
done
|
|
78
|
+
for v in skip always w1b; do
|
|
79
|
+
echo "det $p one_vs_$v: $(python3 -c 'import json,sys; a=json.load(open(sys.argv[1]))["frames"]; b=json.load(open(sys.argv[2]))["frames"]; d=[i for i,(x,y) in enumerate(zip(a,b)) if x!=y]; print(len(d), "differ at", d[:40])' "$W/$p-dd-one.frames.json" "$W/$p-dd-$v.frames.json")" | tee -a "$O/r7.txt"
|
|
80
|
+
done
|
|
81
|
+
done
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Round 8 (FP_SCRIPT=sandbox8.sh): canvas coverage over the platform recipes (_local/recipes from recipes.py, not in
|
|
3
|
+
# git). Every recipe (90 frames) renders with png and with --capture canvas; per recipe: exit code, how many frames took
|
|
4
|
+
# the canvas path, the scenes that fell back and why, SSIM canvas vs png, both wall times. Result: $O/recipes.jsonl
|
|
5
|
+
set -uo pipefail
|
|
6
|
+
O=/home/user/out; W=/home/user/work; mkdir -p "$O" "$W"
|
|
7
|
+
export MOSIO_HOME=/opt/mosio
|
|
8
|
+
MOSIO=/home/user/mosio-custom
|
|
9
|
+
ms() { python3 -c 'import time;print(int(time.time()*1000))'; }
|
|
10
|
+
"$MOSIO" --version 2>/dev/null | head -1
|
|
11
|
+
for d in /home/user/fp/_local/recipes/*/; do
|
|
12
|
+
n=$(basename "$d")
|
|
13
|
+
rm -rf "$W/p" "$W/c"; cp -r "$d" "$W/p"; cp -r "$d" "$W/c"
|
|
14
|
+
t0=$(ms); timeout 600 "$MOSIO" render "$W/p" -o "$W/p.mp4" --workers 8 --no-cache > "$W/p.json" 2> /dev/null; prc=$?; t1=$(ms)
|
|
15
|
+
timeout 600 "$MOSIO" render "$W/c" -o "$W/c.mp4" --workers 8 --no-cache --capture canvas > "$W/c.json" 2> /dev/null; crc=$?; t2=$(ms)
|
|
16
|
+
ss=""
|
|
17
|
+
if [ $prc = 0 ] && [ $crc = 0 ]; then
|
|
18
|
+
ss=$(ffmpeg -v info -i "$W/c.mp4" -i "$W/p.mp4" -lavfi "[0:v]scale=in_range=auto:in_color_matrix=auto,format=gbrp[a];[1:v]scale=in_range=auto:in_color_matrix=auto,format=gbrp[b];[a][b]ssim=stats_file=$W/s.txt" -f null - 2>&1 | grep -o 'All:[0-9.]*' | tail -1 | cut -d: -f2)
|
|
19
|
+
smin=$(python3 -c 'import sys; print(min(float(l.split("All:")[1].split()[0]) for l in open(sys.argv[1])))' "$W/s.txt" 2>/dev/null)
|
|
20
|
+
fi
|
|
21
|
+
python3 - "$n" "$prc" "$crc" "$((t1 - t0))" "$((t2 - t1))" "${ss:-}" "${smin:-}" "$W/c.json" "$W/p.json" >> "$O/recipes.jsonl" <<'PY'
|
|
22
|
+
import json, sys
|
|
23
|
+
n, prc, crc, pms, cms, ss, smin, cj, pj = sys.argv[1:10]
|
|
24
|
+
row = {"recipe": n, "png_rc": int(prc), "canvas_rc": int(crc), "png_ms": int(pms), "canvas_ms": int(cms),
|
|
25
|
+
"ssim": float(ss) if ss else None, "ssim_min": float(smin) if smin else None}
|
|
26
|
+
try:
|
|
27
|
+
r = json.load(open(cj))
|
|
28
|
+
if r.get("ok") is False:
|
|
29
|
+
row["canvas_error"] = (r.get("error") or "")[:300]
|
|
30
|
+
e = r.get("execution") or {}
|
|
31
|
+
c = e.get("capture") or {}
|
|
32
|
+
row.update({"canvas_frames": c.get("canvas_frames"), "screenshot_frames": c.get("screenshot_frames"),
|
|
33
|
+
"fallback_scenes": [(s["scene"], s["why"][:160]) for s in c.get("screenshot_scenes", [])],
|
|
34
|
+
"mode": (e.get("encode") or {}).get("mode"), "warnings": [w["code"] + ": " + w["message"][:200] for w in r.get("warnings", [])]})
|
|
35
|
+
except Exception as x:
|
|
36
|
+
row["canvas_report"] = str(x)[:200]
|
|
37
|
+
try:
|
|
38
|
+
p = json.load(open(pj))
|
|
39
|
+
if p.get("ok") is False:
|
|
40
|
+
row["png_error"] = (p.get("error") or "")[:300]
|
|
41
|
+
except Exception:
|
|
42
|
+
pass
|
|
43
|
+
print(json.dumps(row))
|
|
44
|
+
PY
|
|
45
|
+
tail -1 "$O/recipes.jsonl" | cut -c1-260
|
|
46
|
+
done
|
|
47
|
+
python3 - "$O/recipes.jsonl" <<'PY'
|
|
48
|
+
import json, sys
|
|
49
|
+
rows = [json.loads(l) for l in open(sys.argv[1])]
|
|
50
|
+
ok = [r for r in rows if r["png_rc"] == 0]
|
|
51
|
+
full = [r for r in ok if r["canvas_rc"] == 0 and r.get("screenshot_frames") == 0]
|
|
52
|
+
part = [r for r in ok if r["canvas_rc"] == 0 and (r.get("screenshot_frames") or 0) > 0]
|
|
53
|
+
whole_fb = [r for r in ok if r["canvas_rc"] == 0 and any("W_CAPTURE_CANVAS_FALLBACK" in w for w in r.get("warnings", []))]
|
|
54
|
+
bad = [r for r in ok if r["canvas_rc"] != 0]
|
|
55
|
+
lowss = [r for r in full if r["ssim"] is not None and r["ssim"] < 0.98]
|
|
56
|
+
print(f"recipes {len(rows)}; png ok {len(ok)}; all-canvas {len(full)}; mixed {len(part)}; whole fallback {len(whole_fb)}; canvas failed {len(bad)}; all-canvas with SSIM<0.98 vs png: {len(lowss)}")
|
|
57
|
+
sp = [r["png_ms"] / r["canvas_ms"] for r in full if r["canvas_ms"]]
|
|
58
|
+
if sp:
|
|
59
|
+
sp.sort(); print(f"speedup png/canvas (all-canvas recipes): median {sp[len(sp)//2]:.2f} min {sp[0]:.2f} max {sp[-1]:.2f}")
|
|
60
|
+
for r in lowss + bad:
|
|
61
|
+
print("check", r["recipe"], r.get("ssim"), r.get("canvas_error", ""), r.get("fallback_scenes", ""))
|
|
62
|
+
PY
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Round 9 (FP_SCRIPT=sandbox9.sh, MOSIO_BIN_FILE=<release build>): the per-worker sequential canvas scheduler.
|
|
3
|
+
# quality pack of the canvas path (direct output) against png and a lossless screenshot render:
|
|
4
|
+
# 1. features project, every scene on the canvas path (MOSIO_CANVAS_VIDEO=1 keeps the <video> scenes on it):
|
|
5
|
+
# per-scene SSIM, side-by-side frames, <video> frame accuracy, audio (PCM + click positions)
|
|
6
|
+
# 2. crossfade project: mixed output (bodies canvas, transition + <video> scene screenshots, concurrently)
|
|
7
|
+
# 3. VMAF of P1/P2 direct vs png against lossless
|
|
8
|
+
set -uo pipefail
|
|
9
|
+
cd /home/user/fp
|
|
10
|
+
B=/home/user/bench/engines/mosio; O=/home/user/out; W=/home/user/work; mkdir -p "$O" "$W"
|
|
11
|
+
export BENCH_DIR=/home/user/bench MOSIO_HOME=/opt/mosio
|
|
12
|
+
MOSIO=/home/user/mosio-custom
|
|
13
|
+
ms() { python3 -c 'import time;print(int(time.time()*1000))'; }
|
|
14
|
+
proj() { rm -rf "$2"; cp -r "$1" "$2"; mkdir -p "$2/assets"; cp -r /home/user/bench/assets/. "$2/assets/"; }
|
|
15
|
+
lossless() {
|
|
16
|
+
python3 - "$1/mosio.json" <<'PY'
|
|
17
|
+
import json, sys
|
|
18
|
+
m = json.load(open(sys.argv[1])); m.setdefault("output", {})["lossless"] = {"codec": "h264", "crf": 0, "preset": "ultrafast", "pix_fmt": "yuv420p", "gop_frames": 30}
|
|
19
|
+
json.dump(m, open(sys.argv[1], "w"))
|
|
20
|
+
PY
|
|
21
|
+
}
|
|
22
|
+
score() {
|
|
23
|
+
ffmpeg -v info -i "$1" -i "$2" -lavfi "[0:v]scale=in_range=auto:in_color_matrix=auto,format=gbrp[a];[1:v]scale=in_range=auto:in_color_matrix=auto,format=gbrp[b];[a]split[a1][a2];[b]split[b1][b2];[a1][b1]ssim;[a2][b2]psnr" -f null - > "$W/m.log" 2>&1
|
|
24
|
+
echo "ssim_$(grep -o 'All:[0-9.]*' "$W/m.log" | tail -1) psnr_$(grep -o 'average:[0-9.inf]*' "$W/m.log" | tail -1) bytes=$(stat -c %s "$1")"
|
|
25
|
+
}
|
|
26
|
+
summary() {
|
|
27
|
+
python3 - "$1" <<'PY' 2>/dev/null
|
|
28
|
+
import json, sys
|
|
29
|
+
r = json.load(open(sys.argv[1])); e = r["execution"]; sl = e["slices"]; n = sum(s["to"] - s["from"] for s in sl)
|
|
30
|
+
keys = sorted({k for s in sl for k in s["in_page_ms"] if k not in ("replayed",)})
|
|
31
|
+
st = {k: round(sum(s["in_page_ms"].get(k, 0) for s in sl) / n, 2) for k in keys}
|
|
32
|
+
print("slices", [(s["from"], s["to"]) for s in sl][:12], "replayed", [s["in_page_ms"].get("replayed") for s in sl][:12])
|
|
33
|
+
print(" per_frame", st)
|
|
34
|
+
print(" load_ms_max", max(round(s["load_ms"]) for s in sl), "replay_ms_max", round(max(s["in_page_ms"].get("replay", 0) for s in sl)),
|
|
35
|
+
"transcode_tail_ms_max", round(max(s["transcode_ms"] for s in sl)), "canvas_ms", e.get("canvas_ms"), "launch_ms", round(r["profile"]["browser_launch_ms"]),
|
|
36
|
+
"mux_ms", round(r["profile"]["concat_mux_ms"]), "warn", [w["code"] for w in r.get("warnings", [])])
|
|
37
|
+
PY
|
|
38
|
+
}
|
|
39
|
+
"$MOSIO" --version 2>/dev/null | head -1
|
|
40
|
+
mkdir -p "$O/frames"
|
|
41
|
+
(cd /home/user/fp/features && python3 gen.py)
|
|
42
|
+
proj /home/user/fp/features "$W/feat"; lossless "$W/feat"
|
|
43
|
+
"$MOSIO" render "$W/feat" -o "$W/feat-ref.mp4" --workers 8 --no-cache --preset lossless > /dev/null 2>&1; echo "feat ref rc=$?" | tee -a "$O/r9.txt"
|
|
44
|
+
proj /home/user/fp/features "$W/feat-png"
|
|
45
|
+
t0=$(ms); "$MOSIO" render "$W/feat-png" -o "$W/feat-png.mp4" --workers 8 --no-cache > /dev/null 2>&1; t1=$(ms); echo "feat png wall_ms=$((t1 - t0))" | tee -a "$O/r9.txt"
|
|
46
|
+
proj /home/user/fp/features "$W/feat-cv"
|
|
47
|
+
t0=$(ms); MOSIO_CANVAS_VIDEO=1 MOSIO_CANVAS_DRAINS=1 "$MOSIO" render "$W/feat-cv" -o "$W/feat-canvas.mp4" --workers 8 --no-cache --capture canvas > "$W/feat-canvas.json" 2> "$W/feat-canvas.err"; rc=$?; t1=$(ms)
|
|
48
|
+
cp "$W/feat-canvas.json" "$O/"
|
|
49
|
+
echo "feat canvas rc=$rc wall_ms=$((t1 - t0)) mode=$(python3 -c 'import json,sys; r=json.load(open(sys.argv[1])); print(r["execution"]["encode"]["mode"], r["execution"]["capture"]["canvas_frames"], r["execution"]["capture"]["screenshot_frames"])' "$W/feat-canvas.json" 2>&1 | tail -1)" | tee -a "$O/r9.txt"
|
|
50
|
+
for v in canvas png; do
|
|
51
|
+
ffmpeg -v info -i "$W/feat-$v.mp4" -i "$W/feat-ref.mp4" -lavfi "[0:v]scale=in_range=auto:in_color_matrix=auto,format=gbrp[a];[1:v]scale=in_range=auto:in_color_matrix=auto,format=gbrp[b];[a][b]ssim=stats_file=$W/feat-$v.ssim" -f null - > /dev/null 2>&1
|
|
52
|
+
done
|
|
53
|
+
python3 - "$W" "$W/feat/mosio.json" <<'PY' | tee -a "$O/r9.txt"
|
|
54
|
+
import json, sys
|
|
55
|
+
w, man = sys.argv[1:3]
|
|
56
|
+
def load(p):
|
|
57
|
+
v = {}
|
|
58
|
+
for line in open(p):
|
|
59
|
+
d = dict(kv.split(":", 1) for kv in line.split() if ":" in kv)
|
|
60
|
+
v[int(d["n"]) - 1] = float(d["All"])
|
|
61
|
+
return v
|
|
62
|
+
c, p = load(f"{w}/feat-canvas.ssim"), load(f"{w}/feat-png.ssim")
|
|
63
|
+
f = 0
|
|
64
|
+
print("scene canvas_vs_lossless(mean/min) png_vs_lossless(mean/min)")
|
|
65
|
+
for s in json.load(open(man))["scenes"]:
|
|
66
|
+
r = range(f, f + s["frames"])
|
|
67
|
+
a = [c[i] for i in r if i in c]; b = [p[i] for i in r if i in p]
|
|
68
|
+
print(f"{s['id']:10s} {sum(a)/len(a):.5f}/{min(a):.5f} {sum(b)/len(b):.5f}/{min(b):.5f}")
|
|
69
|
+
f += s["frames"]
|
|
70
|
+
PY
|
|
71
|
+
i=0
|
|
72
|
+
for s in text typo image video video2 svg filter blend backdrop gradient iframe canvas2d; do
|
|
73
|
+
f=$((i * 60 + 40))
|
|
74
|
+
ffmpeg -v error -y -i "$W/feat-canvas.mp4" -i "$W/feat-png.mp4" -filter_complex "[0:v]select=eq(n\,$f)[a];[1:v]select=eq(n\,$f)[b];[a][b]hstack" -frames:v 1 "$O/frames/fastpath-$s-canvas-vs-png.png"
|
|
75
|
+
i=$((i + 1))
|
|
76
|
+
done
|
|
77
|
+
# typography detail: 1:1 crop of the small text rows (canvas left, png right)
|
|
78
|
+
ffmpeg -v error -y -i "$W/feat-canvas.mp4" -i "$W/feat-png.mp4" -filter_complex "[0:v]select=eq(n\,100),crop=1080:200:0:900[a];[1:v]select=eq(n\,100),crop=1080:200:0:900[b];[a][b]vstack" -frames:v 1 "$O/frames/fastpath-typo-smalltext-crop.png"
|
|
79
|
+
# <video> frame accuracy: scene video2 (frames 240..299) is clip.mp4 full frame; frame k must be clip frame k
|
|
80
|
+
ffmpeg -v error -y -i /home/user/bench/assets/clip.mp4 -frames:v 62 -vf format=gbrp "$W/clip-%03d.png"
|
|
81
|
+
for v in canvas png; do
|
|
82
|
+
ffmpeg -v error -y -i "$W/feat-$v.mp4" -vf "select=between(n\,240\,299),scale=in_range=auto:in_color_matrix=auto,format=gbrp" -vsync 0 "$W/v2-$v-%03d.png"
|
|
83
|
+
python3 - "$W" "$v" <<'PY' | tee -a "$O/r9.txt"
|
|
84
|
+
import subprocess, sys, re
|
|
85
|
+
w, v = sys.argv[1], sys.argv[2]
|
|
86
|
+
def ssim(a, b):
|
|
87
|
+
out = subprocess.run(["ffmpeg", "-v", "info", "-i", a, "-i", b, "-lavfi", "ssim", "-f", "null", "-"], capture_output=True, text=True).stderr
|
|
88
|
+
m = re.findall(r"All:([0-9.]+)", out); return float(m[-1]) if m else 0.0
|
|
89
|
+
off = []
|
|
90
|
+
for k in range(0, 60, 6):
|
|
91
|
+
sc = {d: ssim(f"{w}/v2-{v}-{k + 1:03d}.png", f"{w}/clip-{k + 1 + d:03d}.png") for d in (-1, 0, 1) if 0 <= k + d < 62}
|
|
92
|
+
off.append(max(sc, key=sc.get))
|
|
93
|
+
print(f"video-accuracy {v}: best clip offset per sampled frame {off}")
|
|
94
|
+
PY
|
|
95
|
+
done
|
|
96
|
+
for v in canvas png; do ffmpeg -v error -y -i "$W/feat-$v.mp4" -map 0:a -f s16le -ac 1 -ar 48000 "$W/a-$v.pcm"; done
|
|
97
|
+
python3 - "$W" <<'PY' | tee -a "$O/r9.txt"
|
|
98
|
+
import sys, array, hashlib
|
|
99
|
+
w = sys.argv[1]; r = {}
|
|
100
|
+
for v in ("canvas", "png"):
|
|
101
|
+
a = array.array("h", open(f"{w}/a-{v}.pcm", "rb").read())
|
|
102
|
+
clicks, last = [], -10**9
|
|
103
|
+
for i in range(1, len(a)):
|
|
104
|
+
if abs(a[i] - a[i - 1]) > 9000 and i - last > 24000:
|
|
105
|
+
clicks.append(round(i / 48000, 4)); last = i
|
|
106
|
+
r[v] = (hashlib.sha256(a.tobytes()).hexdigest()[:16], round(len(a) / 48000, 3), clicks[:8])
|
|
107
|
+
print(f"audio {v}: pcm_sha={r[v][0]} seconds={r[v][1]} clicks_s={r[v][2]}")
|
|
108
|
+
print("audio identical:", r["canvas"][0] == r["png"][0])
|
|
109
|
+
PY
|
|
110
|
+
echo "== xfade (mixed)" | tee -a "$O/r9.txt"
|
|
111
|
+
proj /home/user/fp/features-xfade "$W/xf"; proj /home/user/fp/features-xfade "$W/xfp"
|
|
112
|
+
t0=$(ms); "$MOSIO" render "$W/xfp" -o "$W/xf-png.mp4" --workers 8 --no-cache > /dev/null 2>&1; t1=$(ms); echo "xfade png wall_ms=$((t1 - t0))" | tee -a "$O/r9.txt"
|
|
113
|
+
t0=$(ms); MOSIO_CANVAS_DRAINS=1 "$MOSIO" render "$W/xf" -o "$W/xf.mp4" --workers 8 --no-cache --capture canvas > "$W/xf.json" 2> "$W/xf.err"; rc=$?; t1=$(ms)
|
|
114
|
+
cp "$W/xf.json" "$O/"
|
|
115
|
+
echo "xfade canvas rc=$rc wall_ms=$((t1 - t0)) $(python3 -c 'import json,sys; r=json.load(open(sys.argv[1])); e=r["execution"]; print(e["encode"]["mode"], e["capture"]["canvas_frames"], e["capture"]["screenshot_frames"], "canvas_ms", e["canvas_ms"], "screenshot_ms", e["screenshot_ms"])' "$W/xf.json" 2>&1 | tail -1) $(score "$W/xf.mp4" "$W/xf-png.mp4")" | tee -a "$O/r9.txt"
|
|
116
|
+
for f in 40 52 60 70; do ffmpeg -v error -y -i "$W/xf.mp4" -i "$W/xf-png.mp4" -filter_complex "[0:v]select=eq(n\,$f)[a];[1:v]select=eq(n\,$f)[b];[a][b]hstack,scale=1080:-1" -frames:v 1 "$O/frames/fastpath-xfade-f$f-canvas-vs-png.png"; done
|
|
117
|
+
if ffmpeg -hide_banner -filters 2>/dev/null | grep -q libvmaf; then
|
|
118
|
+
for p in p1 p2; do
|
|
119
|
+
proj "$B/$p" "$W/r-$p"; lossless "$W/r-$p"; "$MOSIO" render "$W/r-$p" -o "$W/$p-ref.mp4" --workers 8 --no-cache --preset lossless > /dev/null 2>&1
|
|
120
|
+
proj "$B/$p" "$W/m-$p"
|
|
121
|
+
"$MOSIO" render "$W/m-$p" -o "$W/$p-png.mp4" --workers 8 --no-cache > /dev/null 2>&1
|
|
122
|
+
MOSIO_CANVAS_DRAINS=1 "$MOSIO" render "$W/m-$p" -o "$W/$p-canvas.mp4" --workers 8 --no-cache --capture canvas > /dev/null 2>&1
|
|
123
|
+
for v in canvas png; do
|
|
124
|
+
m=$(ffmpeg -v info -i "$W/$p-$v.mp4" -i "$W/$p-ref.mp4" -lavfi "[0:v]scale=in_range=auto:in_color_matrix=auto:out_range=tv,format=yuv420p[a];[1:v]format=yuv420p[b];[a][b]libvmaf=n_threads=8" -f null - 2>&1 | grep -o 'VMAF score: [0-9.]*')
|
|
125
|
+
echo "vmaf $p $v $m bytes=$(stat -c %s "$W/$p-$v.mp4")" | tee -a "$O/r9.txt"
|
|
126
|
+
done
|
|
127
|
+
done
|
|
128
|
+
else
|
|
129
|
+
echo "no libvmaf in this ffmpeg" | tee -a "$O/r9.txt"
|
|
130
|
+
fi
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import http from 'node:http'; import fs from 'node:fs'; import path from 'node:path'
|
|
2
|
+
// static server: routes map url prefix -> dir; POST /_sink/<name> collects raw bodies
|
|
3
|
+
export function serve(routes, onPost) {
|
|
4
|
+
const types = { '.html': 'text/html', '.js': 'text/javascript', '.mjs': 'text/javascript', '.ttf': 'font/ttf', '.png': 'image/png', '.jpg': 'image/jpeg', '.mp4': 'video/mp4', '.webm': 'video/webm', '.woff2': 'font/woff2' }
|
|
5
|
+
const s = http.createServer((q, r) => {
|
|
6
|
+
const u = decodeURIComponent(new URL(q.url, 'http://x').pathname)
|
|
7
|
+
if (q.method === 'POST') { const parts = []; q.on('data', d => parts.push(d)); q.on('end', async () => { await onPost?.(u, Buffer.concat(parts)); r.end('ok') }); return }
|
|
8
|
+
for (const [pre, dir] of routes) if (u.startsWith(pre)) {
|
|
9
|
+
const f = path.join(dir, u.slice(pre.length))
|
|
10
|
+
if (fs.existsSync(f) && fs.statSync(f).isFile()) { r.writeHead(200, { 'content-type': types[path.extname(f)] || 'application/octet-stream', 'cross-origin-opener-policy': 'same-origin', 'cross-origin-embedder-policy': 'require-corp', 'cross-origin-resource-policy': 'same-origin' }); return fs.createReadStream(f).pipe(r) }
|
|
11
|
+
}
|
|
12
|
+
r.writeHead(404); r.end()
|
|
13
|
+
})
|
|
14
|
+
return new Promise(res => s.listen(0, '127.0.0.1', () => res({ url: `http://127.0.0.1:${s.address().port}`, close: () => s.close() })))
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<canvas id=c content=drawable layoutsubtree width=400 height=300><div id=d drawable style="width:200px;height:100px;background:red">hi</div></canvas>
|
|
@@ -144,6 +144,7 @@ place nm-mixed assets/photo.jpg=photo.jpg assets/cam-a.mp4=cam-a.mp4 assets/badg
|
|
|
144
144
|
place nm-external assets/phone.mp4=phone.mp4 assets/cube=cube
|
|
145
145
|
place nm-audio assets/music.wav=music.wav assets/voiceover.wav=voiceover.wav assets/room.m4a=room.m4a assets/cam-a.mp4=cam-a.mp4 assets/photo.jpg=photo.jpg
|
|
146
146
|
place nm-sync assets/ntsc-2997.mp4=ntsc-2997.mp4
|
|
147
|
+
place direct-seek-media assets/dot.png=badge.png
|
|
147
148
|
place nm-speed assets/ntsc-2997.mp4=ntsc-2997.mp4
|
|
148
149
|
place nm-entropy assets/photo.jpg=photo.jpg
|
|
149
150
|
place nm-hybrid-demo assets/phone.mp4=phone.mp4 assets/cam-a.mp4=cam-a.mp4 assets/lowerthird.webm=lowerthird.webm \
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# WebGL present by readback (runtime.js presentGL): fixtures/gl-readback draws a plain WebGL canvas from onSeek, once
|
|
3
|
+
# shown through the readback mirror and once through the compositor. On the CPU baseline (SwiftShader) the compositor
|
|
4
|
+
# path is the reference, so both scenes must give the same bytes on every checked frame, and the frames must differ
|
|
5
|
+
# from each other (a mirror stuck on frame 0 was the Windows GPU symptom). Runs on Linux (ci-frames) and Windows (smoke).
|
|
6
|
+
#
|
|
7
|
+
# scripts/gl-readback-check.sh <mosio> <out-dir>
|
|
8
|
+
set -euo pipefail
|
|
9
|
+
MOSIO=$1
|
|
10
|
+
OUT=$2
|
|
11
|
+
REPO=$(cd "$(dirname "$0")/.." && pwd)
|
|
12
|
+
PY=$(command -v python3 || command -v python)
|
|
13
|
+
mkdir -p "$OUT"
|
|
14
|
+
for s in readback compositor; do
|
|
15
|
+
"$MOSIO" frames "$REPO/fixtures/gl-readback" --scene "$s" --frames 0,7,15,29 -o "$OUT/$s.json" > "$OUT/$s.log" 2>&1 || { cat "$OUT/$s.log" >&2; exit 1; }
|
|
16
|
+
done
|
|
17
|
+
"$MOSIO" oracle compare "$OUT/readback.json" "$OUT/compositor.json" > "$OUT/compare.json" || true
|
|
18
|
+
"$PY" - "$OUT" <<'PY'
|
|
19
|
+
import json, sys, os
|
|
20
|
+
out = sys.argv[1]
|
|
21
|
+
cmp = json.load(open(os.path.join(out, "compare.json")))
|
|
22
|
+
rb = json.load(open(os.path.join(out, "readback.json")))["frames"]
|
|
23
|
+
ok = cmp.get("equal") is True and len(rb) == 4 and len(set(rb)) == 4
|
|
24
|
+
print("[gl-readback] readback == compositor: %s; distinct frames: %d of %d" % (cmp.get("equal"), len(set(rb)), len(rb)))
|
|
25
|
+
sys.exit(0 if ok else 1)
|
|
26
|
+
PY
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Two extra benchmark projects for scripts/hpbench/render-cgroup.sh, generated (nothing binary is committed):
|
|
3
|
+
# OUT/hold-bench 1080x1920, 15 s, 3 scenes of text that appears step by step and is then held (education-style)
|
|
4
|
+
# OUT/three-bench 1280x720, 5 s, one Three.js scene (procedural torus knot, shadows, environment light), WebGL on SwiftShader
|
|
5
|
+
# Needs the repo's pinned fonts (system Inter) and fixtures/3d/t1-turntable for the Three.js scaffolding.
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
REPO="$(cd "$(dirname "$0")/../.." && pwd)"; OUT="${1:?out dir}"
|
|
8
|
+
rm -rf "$OUT/hold-bench" "$OUT/three-bench"; mkdir -p "$OUT"
|
|
9
|
+
H="$OUT/hold-bench"; mkdir -p "$H/scenes" "$H/assets/fonts" "$H/shared"
|
|
10
|
+
cp "$REPO"/deploy/cloudrun/bench-project/shared/* "$H/shared/"
|
|
11
|
+
for f in Inter-Regular Inter-Bold Inter-ExtraBold; do cp "/usr/share/fonts/opentype/inter/$f.otf" "$H/assets/fonts/"; done
|
|
12
|
+
python3 - "$H" <<'PY'
|
|
13
|
+
import json, sys
|
|
14
|
+
h = sys.argv[1]
|
|
15
|
+
scenes = []
|
|
16
|
+
titles = ["Why seasons change", "Earth is tilted", "Sun angle matters"]
|
|
17
|
+
for i, t in enumerate(titles):
|
|
18
|
+
sid = f"s{i+1}"
|
|
19
|
+
bullets = "".join(f'<li class="b" style="animation-delay:{1.0+1.5*k}s" data-mosio-id="{sid}/b{k}">{b}</li>' for k, b in enumerate(
|
|
20
|
+
["Axis tilt is about 23.5 degrees", "Hemisphere facing the sun gets summer", "Days are longer in summer"]))
|
|
21
|
+
open(f"{h}/scenes/{sid}.html", "w").write(f'''<!doctype html><html><head><meta charset="utf-8">
|
|
22
|
+
<link rel="stylesheet" href="/shared/tokens.css"><link rel="stylesheet" href="/shared/base.css">
|
|
23
|
+
<style>.wrap{{position:absolute;inset:120px 90px;display:flex;flex-direction:column;gap:60px;justify-content:center}}
|
|
24
|
+
h1{{font-size:110px;animation:in .5s ease-out both}}ul{{list-style:none;display:flex;flex-direction:column;gap:44px}}
|
|
25
|
+
.b{{font-size:58px;opacity:0;animation:in .5s ease-out both}}@keyframes in{{from{{opacity:0;transform:translateY(30px)}}to{{opacity:1;transform:none}}}}
|
|
26
|
+
</style></head><body><div class="scene" data-mosio-id="{sid}/scene"><div class="wrap"><h1 data-mosio-id="{sid}/h">{t}</h1><ul>{bullets}</ul></div></div></body></html>''')
|
|
27
|
+
scenes.append({"id": sid, "src": f"scenes/{sid}.html", "frames": 150})
|
|
28
|
+
j = {"mosio": 1, "name": "hold-bench", "width": 1080, "height": 1920, "fps": 30, "seed": 1, "background": "#0f172a", "libraries": [],
|
|
29
|
+
"shared": ["shared/tokens.css", "shared/base.css"],
|
|
30
|
+
"assets": [f"assets/fonts/Inter-{w}.otf" for w in ("Regular", "Bold", "ExtraBold")], "scenes": scenes, "audio": []}
|
|
31
|
+
json.dump(j, open(f"{h}/mosio.json", "w"), indent=1)
|
|
32
|
+
PY
|
|
33
|
+
T="$OUT/three-bench"; cp -r "$REPO/fixtures/3d/t1-turntable" "$T"
|
|
34
|
+
python3 - "$T" <<'PY'
|
|
35
|
+
import json, re, sys
|
|
36
|
+
t = sys.argv[1]; p = f"{t}/scenes/turntable.html"; s = open(p).read()
|
|
37
|
+
s = re.sub(r'const gltf = .*?ctx\.scene\.add\(gltf\.scene\);',
|
|
38
|
+
'const m = new THREE.Mesh(new THREE.TorusKnotGeometry(0.06, 0.02, 400, 64), new THREE.MeshStandardMaterial({ color: "#c0a060", roughness: 0.3, metalness: 0.8 }));\n'
|
|
39
|
+
' m.position.y = 0.08; m.castShadow = true; m.receiveShadow = true; ctx.model = ctx.id(m, "knot"); ctx.scene.add(m);', s, flags=re.S)
|
|
40
|
+
open(p, "w").write(s)
|
|
41
|
+
j = json.load(open(f"{t}/mosio.json")); j["assets"] = []; j["scenes"][0]["frames"] = 150; json.dump(j, open(f"{t}/mosio.json", "w"), indent=1)
|
|
42
|
+
PY
|
|
43
|
+
echo "wrote $H and $T"
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Render fixtures under a cgroup v2 CPU quota (like a Cloud Run instance) and print one JSON line per run: wall time,
|
|
3
|
+
# vCPU-seconds (cgroup cpu.stat), peak memory, the engine's own stage profile, and hashes of the video and frame manifest.
|
|
4
|
+
# Run as root in the sandbox after `cargo build --release --locked`; Chromium runs as the unprivileged `mosio` user.
|
|
5
|
+
# scripts/hpbench/render-cgroup.sh OUT_DIR "2 4" FIXTURE_DIR... [-- extra mosio render args]
|
|
6
|
+
# Every run uses --no-cache (a cold render); a run's frame manifest is kept as OUT_DIR/<name>-<cpus>cpu.frames.json.
|
|
7
|
+
set -uo pipefail
|
|
8
|
+
REPO="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
9
|
+
OUT="${1:?out dir}"; CPUS="${2:?cpu list, e.g. \"2 4\"}"; shift 2
|
|
10
|
+
FIX=(); while [ $# -gt 0 ] && [ "$1" != -- ]; do FIX+=("$1"); shift; done; [ "${1:-}" = -- ] && shift
|
|
11
|
+
EXTRA=("$@")
|
|
12
|
+
MEM="${MEM_LIMIT:-4G}"; REPS="${REPS:-1}"; CG=/sys/fs/cgroup
|
|
13
|
+
mkdir -p "$OUT"; OUT="$(cd "$OUT" && pwd)"
|
|
14
|
+
id mosio >/dev/null 2>&1 || useradd -m mosio
|
|
15
|
+
chmod o+rx "$REPO" "$(dirname "$REPO")" 2>/dev/null || true; chmod -R o+rX "$REPO" 2>/dev/null || true
|
|
16
|
+
echo "+cpu +memory" > $CG/cgroup.subtree_control 2>/dev/null || true
|
|
17
|
+
for fx in "${FIX[@]}"; do
|
|
18
|
+
name="$(basename "$fx")"; src="$(cd "$fx" && pwd)"
|
|
19
|
+
for c in $CPUS; do
|
|
20
|
+
for rep in $(seq 1 "$REPS"); do
|
|
21
|
+
w=/home/mosio/rb/$name-$c; rm -rf "$w" /tmp/rb-out; mkdir -p /home/mosio/rb /tmp/rb-out; cp -a "$src" "$w"
|
|
22
|
+
chown -R mosio:mosio /home/mosio/rb /tmp/rb-out
|
|
23
|
+
cg=$CG/rb-$name-$c; mkdir -p "$cg"; echo "$((c * 100000)) 100000" > "$cg/cpu.max"; echo "$MEM" > "$cg/memory.max"
|
|
24
|
+
sync; echo 3 > /proc/sys/vm/drop_caches 2>/dev/null
|
|
25
|
+
t0=$(date +%s.%N)
|
|
26
|
+
( echo $BASHPID > "$cg/cgroup.procs"
|
|
27
|
+
exec runuser -u mosio -- env HOME=/home/mosio MOSIO_HOME="${MOSIO_HOME:-$REPO/.mosio-home}" MOSIO_LOCK="$REPO/toolchain.lock.json" \
|
|
28
|
+
PATH="$REPO/target/release:/usr/local/bin:/usr/bin:/bin" \
|
|
29
|
+
mosio render "$w" -o /tmp/rb-out/out.mp4 --no-cache "${EXTRA[@]}" ) > "$OUT/$name-${c}cpu.report.json" 2> "$OUT/$name-${c}cpu.err"
|
|
30
|
+
rc=$?; t1=$(date +%s.%N)
|
|
31
|
+
cp /tmp/rb-out/out.frames.json "$OUT/$name-${c}cpu.frames.json" 2>/dev/null
|
|
32
|
+
python3 - "$OUT/$name-${c}cpu.report.json" "$cg" "$name" "$c" "$rc" "$t0" "$t1" /tmp/rb-out/out.mp4 "$REPO" <<'PY'
|
|
33
|
+
import json, sys, hashlib, os, subprocess
|
|
34
|
+
rep, cg, name, c, rc, t0, t1, mp4, repo = sys.argv[1:]
|
|
35
|
+
def stat(k):
|
|
36
|
+
for l in open(cg + "/cpu.stat"):
|
|
37
|
+
a = l.split()
|
|
38
|
+
if a[0] == k: return int(a[1])
|
|
39
|
+
try: r = json.load(open(rep))
|
|
40
|
+
except Exception: r = {}
|
|
41
|
+
p = r.get("profile", {}); s = p.get("stages", {})
|
|
42
|
+
peak = int(open(cg + "/memory.peak").read()) / 1048576 if os.path.exists(cg + "/memory.peak") else None
|
|
43
|
+
sha = hashlib.sha256(open(mp4, "rb").read()).hexdigest()[:16] if os.path.exists(mp4) else None
|
|
44
|
+
print(json.dumps({"fixture": name, "vcpu": int(c), "rc": int(rc), "wall_s": round(float(t1) - float(t0), 2),
|
|
45
|
+
"cpu_s": round(stat("usage_usec") / 1e6, 1), "throttled_s": round(stat("throttled_usec") / 1e6, 1), "cgroup_peak_mib": peak and round(peak),
|
|
46
|
+
"workers": r.get("workers"), "frames": r.get("total_frames"), "mp4_sha": sha,
|
|
47
|
+
"ms": {k: round(v) for k, v in {"plan": p.get("plan_ms", 0), "browser_launch": p.get("browser_launch_ms", 0), "page_load": s.get("page_load_ms", 0),
|
|
48
|
+
"seek": s.get("seek_barrier_ms", 0), "capture": s.get("capture_ms", 0), "png_decode": s.get("decode_ms", 0), "hash": p.get("hash_ms", 0),
|
|
49
|
+
"enc_write": p.get("encode_write_ms", 0), "enc_finish": p.get("encode_finish_ms", 0), "cache_store": p.get("cache_store_ms", 0),
|
|
50
|
+
"canary": p.get("canary_ms", 0), "blend": p.get("transition_blend_ms", 0), "audio": p.get("audio_mix_ms", 0), "mux": p.get("concat_mux_ms", 0)}.items()},
|
|
51
|
+
"captured": s.get("captured_frames"), "still": s.get("still_frames"), "shots": [s.get("shot_calls"), round(s.get("shot_ms",0))], "idle": [s.get("idle_calls"), round(s.get("idle_ms",0))], "replayed": s.get("replayed_frames")}))
|
|
52
|
+
PY
|
|
53
|
+
rmdir "$cg" 2>/dev/null; rm -rf "$w"
|
|
54
|
+
done
|
|
55
|
+
done
|
|
56
|
+
done
|
package/scripts/install.sh
CHANGED
|
@@ -222,7 +222,8 @@ main() {
|
|
|
222
222
|
ROOT="$REPO"
|
|
223
223
|
if [ "$SKIP_TOOLCHAIN" -eq 0 ]; then
|
|
224
224
|
log "toolchain: scripts/bootstrap.sh"
|
|
225
|
-
|
|
225
|
+
skip_apt=0; [ "${SKIP_APT:-0}" = 1 ] || [ "${MOSIO_APT_DONE:-0}" = 1 ] && skip_apt=1
|
|
226
|
+
MOSIO_APPARMOR_SKIP=1 SKIP_APT="$skip_apt" "$REPO/scripts/bootstrap.sh" </dev/null
|
|
226
227
|
fi
|
|
227
228
|
apparmor_step "$REPO"
|
|
228
229
|
# bootstrap installs rustup for this user (or finds a system one through CARGO_HOME)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Prove the npm packages work on a clean Windows machine: install the packed tarballs into a fresh npm prefix with a
|
|
3
|
+
# fresh %LOCALAPPDATA% (so no Mosio home, toolchain or cache exists yet), then run the first-run flow from PowerShell,
|
|
4
|
+
# the shell a Windows 11 user types into. The Windows counterpart of scripts/npm-clean-install-proof.sh.
|
|
5
|
+
#
|
|
6
|
+
# scripts/npm-clean-install-proof-win.sh <dir with usemosio-cli-*.tgz> [<evidence dir>]
|
|
7
|
+
#
|
|
8
|
+
# Runs in Git Bash on a Windows runner (windows-latest). Every step's output and exit code go to the evidence
|
|
9
|
+
# directory; the script's own exit code is non-zero when any step failed.
|
|
10
|
+
set -uo pipefail
|
|
11
|
+
SRC="$(cd "${1:?usage: $0 <tarball dir> [evidence dir]}" && pwd)"
|
|
12
|
+
EV="${2:-$RUNNER_TEMP/npm-proof}"
|
|
13
|
+
mkdir -p "$EV"
|
|
14
|
+
ROOT=$(mktemp -d)
|
|
15
|
+
mkdir -p "$ROOT/prefix" "$ROOT/cache" "$ROOT/localappdata" "$ROOT/work"
|
|
16
|
+
W() { cygpath -w "$1"; }
|
|
17
|
+
P=$(W "$SRC")
|
|
18
|
+
LAUNCHER=$(W "$(ls "$SRC"/usemosio-cli-[0-9]*.tgz)")
|
|
19
|
+
PLATFORM=$(W "$(ls "$SRC"/usemosio-cli-win32-x64-*.tgz)")
|
|
20
|
+
{
|
|
21
|
+
echo "windows: $(cmd //c ver | tr -d '\r' | grep -v '^$')"
|
|
22
|
+
echo "node $(node --version) npm $(npm --version)"
|
|
23
|
+
echo "ffmpeg on PATH: $(command -v ffmpeg || echo none)"
|
|
24
|
+
echo "fresh LOCALAPPDATA: $(W "$ROOT/localappdata")"
|
|
25
|
+
echo "tarballs: $P"
|
|
26
|
+
} | tee "$EV/00-machine.txt"
|
|
27
|
+
|
|
28
|
+
FAIL=0
|
|
29
|
+
# step <name> <expected exit code> <powershell command>: run in a fresh PowerShell with the fresh prefix first on PATH
|
|
30
|
+
step() {
|
|
31
|
+
local name="$1" want="$2" cmd="$3"
|
|
32
|
+
local t0; t0=$(date +%s%N)
|
|
33
|
+
env -u MOSIO_HOME -u MOSIO_LOCK -u MOSIO_KIT NPM_CONFIG_PREFIX="$(W "$ROOT/prefix")" NPM_CONFIG_CACHE="$(W "$ROOT/cache")" LOCALAPPDATA="$(W "$ROOT/localappdata")" \
|
|
34
|
+
NPM_CONFIG_UPDATE_NOTIFIER=false NPM_CONFIG_FUND=false NPM_CONFIG_AUDIT=false \
|
|
35
|
+
PATH="$ROOT/prefix:$PATH" \
|
|
36
|
+
pwsh -NoProfile -NonInteractive -Command "Set-Location '$(W "$ROOT/work")'; \$ErrorActionPreference='Continue'; $cmd; exit \$LASTEXITCODE" \
|
|
37
|
+
>"$EV/$name.out" 2>"$EV/$name.err"
|
|
38
|
+
local rc=$?
|
|
39
|
+
local ms=$(( ($(date +%s%N) - t0) / 1000000 )) dt; dt="$((ms / 1000)).$(( (ms % 1000) / 100 ))"
|
|
40
|
+
local verdict=PASS; [ "$rc" -eq "$want" ] || { verdict=FAIL; FAIL=1; }
|
|
41
|
+
printf '%-4s %-22s exit %-3s (want %s) %6ss > %s\n' "$verdict" "$name" "$rc" "$want" "$dt" "$cmd" | tee -a "$EV/summary.txt"
|
|
42
|
+
}
|
|
43
|
+
FFPROBE="\$env:LOCALAPPDATA\\mosio\\home\\ffmpeg\\bin\\ffprobe.exe"
|
|
44
|
+
|
|
45
|
+
step 01-npm-install-g 0 "npm i -g '$LAUNCHER' '$PLATFORM'"
|
|
46
|
+
step 02-which-version 0 "(Get-Command mosio).Source; mosio --version"
|
|
47
|
+
step 03-doctor-before 1 "mosio doctor"
|
|
48
|
+
step 05-init 0 "mosio init ./v"
|
|
49
|
+
step 06-check 0 "mosio check ./v"
|
|
50
|
+
step 07-render-first-run 0 "Measure-Command { mosio render ./v -o v.mp4 | Out-Host } | Select-Object TotalSeconds; if (-not (Test-Path v.mp4)) { exit 1 }"
|
|
51
|
+
step 08-ffprobe 0 "& \"$FFPROBE\" -v error -show_entries stream=codec_name,width,height,r_frame_rate,nb_frames:format=duration,size -of default=nw=1 v.mp4"
|
|
52
|
+
step 09-doctor-after 0 "mosio doctor"
|
|
53
|
+
step 10-setup-check-after 0 "mosio setup --check"
|
|
54
|
+
step 11-studio-help 0 "mosio studio --help"
|
|
55
|
+
step 11b-agent-help 0 "mosio-agent --help | Select-Object -First 3"
|
|
56
|
+
step 12-render-again 0 "Measure-Command { mosio render ./v -o v2.mp4 | Out-Host } | Select-Object TotalSeconds; if (-not (Test-Path v2.mp4)) { exit 1 }"
|
|
57
|
+
step 19-uninstall 0 "npm rm -g @usemosio/cli @usemosio/cli-win32-x64; if (Get-Command mosio -ErrorAction SilentlyContinue) { exit 1 }"
|
|
58
|
+
{
|
|
59
|
+
echo "--- sizes ---"; ls -l "$SRC"/*.tgz
|
|
60
|
+
echo "--- installed ---"
|
|
61
|
+
du -sh "$ROOT/localappdata/mosio/home" "$ROOT/localappdata/mosio/npm" "$ROOT/cache" 2>/dev/null
|
|
62
|
+
} | tee "$EV/99-sizes.txt"
|
|
63
|
+
echo; awk '{print $1}' "$EV/summary.txt" | sort | uniq -c
|
|
64
|
+
exit $FAIL
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Render the same projects on any platform and write the MP4s plus timings, for the cross-platform check
|
|
3
|
+
# (.github/workflows/macos.yml): Linux renders the reference, macOS renders again and compares (SSIM).
|
|
4
|
+
#
|
|
5
|
+
# scripts/platform-smoke.sh <mosio> <fonts-dir> <out-dir> [capture...]
|
|
6
|
+
#
|
|
7
|
+
# <fonts-dir> holds Inter-ExtraBold.otf and Inter-Medium.otf; both platforms use the same files, so a difference in
|
|
8
|
+
# the frames comes from the platform (rasteriser, encoder), not from the fonts. Projects: fixtures/w1-kinetic and the
|
|
9
|
+
# two speed projects tests/bench/p1 ("titles", 10 s) and tests/bench/p2 ("dense", 30 s), all 1080x1920 at 30 fps, and
|
|
10
|
+
# tests/platform/captions (SRT captions through libass with a declared font; no fc-scan or fontconfig needed).
|
|
11
|
+
# Each capture mode given (default: the screenshot path only; "canvas" adds `--capture canvas` when this build has it)
|
|
12
|
+
# renders every project once, with --no-cache. Writes <out>/<project>-<capture>.mp4 and <out>/timings.tsv.
|
|
13
|
+
set -euo pipefail
|
|
14
|
+
MOSIO=$(cd "$(dirname "$1")" && pwd)/$(basename "$1")
|
|
15
|
+
FONTS=$(cd "$2" && pwd)
|
|
16
|
+
OUT=$3
|
|
17
|
+
shift 3
|
|
18
|
+
if [ $# -gt 0 ]; then CAPTURES=("$@"); else CAPTURES=(screenshot); fi
|
|
19
|
+
REPO=$(cd "$(dirname "$0")/.." && pwd)
|
|
20
|
+
mkdir -p "$OUT"
|
|
21
|
+
OUT=$(cd "$OUT" && pwd)
|
|
22
|
+
WORK=$(mktemp -d)
|
|
23
|
+
# Windows runners (Git Bash) have `python`, not `python3`
|
|
24
|
+
PY=$(command -v python3 || command -v python)
|
|
25
|
+
trap 'rm -rf "$WORK"' EXIT
|
|
26
|
+
|
|
27
|
+
printf 'project\tcapture\tframes\tseconds\n' > "$OUT/timings.tsv"
|
|
28
|
+
for proj in fixtures/w1-kinetic tests/bench/p1 tests/bench/p2 tests/platform/captions; do
|
|
29
|
+
name=$(basename "$proj")
|
|
30
|
+
case $proj in tests/bench/*) name=bench-$name ;; tests/platform/*) name=platform-$name ;; esac
|
|
31
|
+
d="$WORK/$name"
|
|
32
|
+
cp -R "$REPO/$proj" "$d"
|
|
33
|
+
mkdir -p "$d/assets/fonts"
|
|
34
|
+
cp "$FONTS/Inter-ExtraBold.otf" "$FONTS/Inter-Medium.otf" "$d/assets/fonts/"
|
|
35
|
+
for cap in "${CAPTURES[@]}"; do
|
|
36
|
+
args=()
|
|
37
|
+
if [ "$cap" = canvas ]; then
|
|
38
|
+
if ! "$MOSIO" render --help 2>&1 | grep -q -- 'canvas'; then
|
|
39
|
+
echo "[smoke] this mosio has no --capture canvas; skipping $name/canvas" >&2
|
|
40
|
+
continue
|
|
41
|
+
fi
|
|
42
|
+
args=(--capture canvas)
|
|
43
|
+
fi
|
|
44
|
+
out="$OUT/$name-$cap.mp4"
|
|
45
|
+
t0=$("$PY" -c 'import time; print(time.time())')
|
|
46
|
+
if ! "$MOSIO" render "$d" -o "$out" --no-cache ${args[@]+"${args[@]}"} > "$WORK/$name-$cap.json"; then
|
|
47
|
+
echo "[smoke] $name/$cap failed:" >&2
|
|
48
|
+
cat "$WORK/$name-$cap.json" >&2
|
|
49
|
+
exit 1
|
|
50
|
+
fi
|
|
51
|
+
t1=$("$PY" -c 'import time; print(time.time())')
|
|
52
|
+
frames=$(ffprobe -v error -count_frames -select_streams v:0 -show_entries stream=nb_read_frames -of csv=p=0 "$out")
|
|
53
|
+
secs=$("$PY" -c "print(f'{$t1 - $t0:.2f}')")
|
|
54
|
+
printf '%s\t%s\t%s\t%s\n' "$name" "$cap" "$frames" "$secs" | tee -a "$OUT/timings.tsv"
|
|
55
|
+
done
|
|
56
|
+
done
|
|
57
|
+
|
|
58
|
+
# One composited frame of the captions project through `mosio media frame` (the command that stopped on Windows with
|
|
59
|
+
# "spawning fc-scan: program not found"): the caption must be drawn in its band.
|
|
60
|
+
d="$WORK/platform-captions"
|
|
61
|
+
"$MOSIO" media frame "$d" --frame 20 -o "$OUT/platform-captions-f20.png" > "$WORK/frame.json" || { cat "$WORK/frame.json" >&2; exit 1; }
|
|
62
|
+
# the background is a dark gradient (luma under 110); white caption text in the band above the bottom margin is not
|
|
63
|
+
ymax=$(ffmpeg -hide_banner -nostdin -i "$OUT/platform-captions-f20.png" -vf "crop=1080:400:0:1300,format=yuv444p,signalstats,metadata=print:key=lavfi.signalstats.YMAX" -f null - 2>&1 | grep -o 'YMAX=[0-9]*' | tail -1 | cut -d= -f2)
|
|
64
|
+
if [ "${ymax:-0}" -lt 200 ]; then
|
|
65
|
+
echo "[smoke] captions: media frame 20 has no caption in the caption band (max luma ${ymax:-none})" >&2
|
|
66
|
+
exit 1
|
|
67
|
+
fi
|
|
68
|
+
echo "[smoke] captions: media frame 20 draws the caption"
|
|
69
|
+
|
|
70
|
+
# The render daemon (MOSIO_DAEMON=1, opt-in): two renders of bench-p1 through it must give the same bytes as the
|
|
71
|
+
# in-process render above. The first starts the daemon, the second reuses its warm browser; it quits after 20 s idle.
|
|
72
|
+
d="$WORK/bench-p1"
|
|
73
|
+
for i in 1 2; do
|
|
74
|
+
MOSIO_DAEMON=1 MOSIO_DAEMON_IDLE_S=20 "$MOSIO" render "$d" -o "$OUT/daemon-$i.mp4" --no-cache > "$WORK/daemon-$i.json"
|
|
75
|
+
done
|
|
76
|
+
[ -f "$d/.mosio/daemon.json" ] || { echo "[smoke] daemon: no $d/.mosio/daemon.json, the renders did not go through a daemon" >&2; exit 1; }
|
|
77
|
+
for i in 1 2; do
|
|
78
|
+
cmp -s "$OUT/daemon-$i.mp4" "$OUT/bench-p1-${CAPTURES[0]}.mp4" || { echo "[smoke] daemon: render $i differs from the in-process render" >&2; exit 1; }
|
|
79
|
+
done
|
|
80
|
+
echo "[smoke] daemon: 2 renders through the daemon, byte-identical to the in-process render"
|