@usemosio/cli-linux-x64 1.0.0-next.1 → 1.0.0-next.2
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-DsbQ04kb.js +34 -0
- package/apps/studio/dist/assets/{agent-panel-CqJuv5Sn.js → agent-panel-DUWPbpew.js} +5 -5
- package/apps/studio/dist/assets/{boundary-bK2S8z05.js → boundary-DuK3AiqM.js} +1 -1
- package/apps/studio/dist/assets/{feedback-BqzXUdVd.js → feedback-x6ZumR_x.js} +1 -1
- package/apps/studio/dist/assets/index-CjDBKmB_.css +2 -0
- package/apps/studio/dist/assets/index-DPLtb0kT.js +1905 -0
- package/apps/studio/dist/assets/inspector3d-B8pkZTye.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 +111 -7
- package/crates/mosio/src/adapters/room-env-pmrem.json +1 -0
- package/crates/mosio/src/runtime.js +126 -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/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/export.sh +5 -3
- 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 +8 -0
- package/scripts/check-file-size.sh +49 -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/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 +67 -0
- package/scripts/prim.mjs +31 -13
- package/skills/mosio-3d/SKILL.md +1 -1
- 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 +10 -3
- 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 +3 -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 +18 -0
- 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 +22 -4
- 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,151 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Round 3 (FP_SCRIPT=sandbox3.sh, MOSIO_BIN_FILE=<release build of this branch>):
|
|
3
|
+
# 1. bitrate sweep of the in-page encoder (prototype) on P2, scored in RGB against Mosio's lossless render
|
|
4
|
+
# 2. the Rust path end to end: `mosio render --capture canvas` timed on P1/P2, determinism (two runs, and 1 vs 8
|
|
5
|
+
# workers, by per-frame pixel hashes), quality and the timing of frames 0/75/150/299 against the reference
|
|
6
|
+
# 3. feature coverage: every scene of scripts/fastpath/features rendered with png and canvas, SSIM per scene
|
|
7
|
+
set -uo pipefail
|
|
8
|
+
cd /home/user/fp
|
|
9
|
+
B=/home/user/bench/engines/mosio; O=/home/user/out; W=/home/user/work; mkdir -p "$O/ssim" "$O/frames" "$W"
|
|
10
|
+
export BENCH_DIR=/home/user/bench MOSIO_HOME=/opt/mosio
|
|
11
|
+
CH=$(ls -d /opt/mosio/browsers/chrome-headless-shell-*/chrome-headless-shell-linux64/chrome-headless-shell | head -1)
|
|
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["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 <video> <ref> <tag>: RGB SSIM/PSNR, each side converted with its own range/matrix tags
|
|
23
|
+
score() {
|
|
24
|
+
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=stats_file=$O/ssim/$3.ssim;[a2][b2]psnr" -f null - > "$W/m.log" 2>&1
|
|
25
|
+
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")"
|
|
26
|
+
}
|
|
27
|
+
at() { for n in "$@"; do awk -v n="n:$((n + 1))" '$1==n {for(i=1;i<=NF;i++) if ($i ~ /^All:/) printf "f%d=%s ", n0, substr($i,5)}' n0="$n" "$SS"; done; }
|
|
28
|
+
"$MOSIO" --version 2>/dev/null | head -1
|
|
29
|
+
FRAMES=30 node fp.mjs "$CH" "$B/p1" "$W/warm.mp4" 1 canvas > /dev/null
|
|
30
|
+
for p in p1 p2; do
|
|
31
|
+
proj "$B/$p" "$W/r-$p"; lossless "$W/r-$p"
|
|
32
|
+
"$MOSIO" render "$W/r-$p" -o "$W/$p-ref.mp4" --workers 8 --no-cache --preset lossless > /dev/null 2>&1
|
|
33
|
+
proj "$B/$p" "$W/m-$p"
|
|
34
|
+
t0=$(ms); "$MOSIO" render "$W/m-$p" -o "$W/$p-mosio.mp4" --workers 8 --no-cache > /dev/null 2>&1; t1=$(ms)
|
|
35
|
+
echo "mosio-png $p w=8 wall_ms=$((t1 - t0)) $(score "$W/$p-mosio.mp4" "$W/$p-ref.mp4" "$p-mosio")" | tee -a "$O/r3.txt"
|
|
36
|
+
done
|
|
37
|
+
echo "== 1. bitrate sweep (prototype, P2, 4 pages)" | tee -a "$O/r3.txt"
|
|
38
|
+
for br in 4000000 8000000 12000000 20000000 30000000; do
|
|
39
|
+
BITRATE=$br node fp.mjs "$CH" "$B/p2" "$W/p2-br$br.mp4" 4 canvas > /dev/null
|
|
40
|
+
echo "bitrate $br $(score "$W/p2-br$br.mp4" "$W/p2-ref.mp4" "p2-br$br")" | tee -a "$O/r3.txt"
|
|
41
|
+
done
|
|
42
|
+
echo "== 2. mosio render --capture canvas" | tee -a "$O/r3.txt"
|
|
43
|
+
for p in p1 p2; do
|
|
44
|
+
for w in 4 8; do
|
|
45
|
+
for r in 1 2 3; do
|
|
46
|
+
t0=$(ms); "$MOSIO" render "$W/m-$p" -o "$W/$p-canvas-w$w.mp4" --workers "$w" --no-cache --capture canvas > "$W/rep.json" 2> "$W/err.log"; rc=$?; t1=$(ms)
|
|
47
|
+
echo "canvas $p w=$w run=$r rc=$rc wall_ms=$((t1 - t0)) $(python3 -c 'import json,sys; r=json.load(open(sys.argv[1])); print("workers", r.get("workers"), "launch_ms", round(r["profile"]["browser_launch_ms"]), "mux_ms", round(r["profile"]["concat_mux_ms"]), "warn", [w["code"] for w in r.get("warnings",[])])' "$W/rep.json" 2>/dev/null || tail -3 "$W/err.log")" | tee -a "$O/r3.txt"
|
|
48
|
+
done
|
|
49
|
+
done
|
|
50
|
+
SS="$O/ssim/$p-canvas.ssim"
|
|
51
|
+
echo "quality $p canvas-w8 $(score "$W/$p-canvas-w8.mp4" "$W/$p-ref.mp4" "$p-canvas") frames: $(at 0 75 150 299)" | tee -a "$O/r3.txt"
|
|
52
|
+
SS="$O/ssim/$p-mosio.ssim"; echo "quality $p mosio-png frames: $(at 0 75 150 299)" | tee -a "$O/r3.txt"
|
|
53
|
+
for f in 0 75 150 299; do
|
|
54
|
+
ffmpeg -v error -y -i "$W/$p-canvas-w8.mp4" -i "$W/$p-ref.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/$p-f$f-canvas-vs-ref.png"
|
|
55
|
+
done
|
|
56
|
+
# determinism: pixel hashes of two 8-worker runs and one 1-worker run
|
|
57
|
+
for tag in a b one; do
|
|
58
|
+
w=8; [ $tag = one ] && w=1
|
|
59
|
+
MOSIO_CANVAS_HASH=1 "$MOSIO" render "$W/m-$p" -o "$W/$p-det-$tag.mp4" --workers $w --no-cache --capture canvas > /dev/null 2>&1
|
|
60
|
+
done
|
|
61
|
+
ha=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["frames"].__len__())' "$W/$p-det-a.frames.json")
|
|
62
|
+
cmpab=$(cmp -s "$W/$p-det-a.frames.json" "$W/$p-det-b.frames.json" && echo same || echo DIFFER)
|
|
63
|
+
cmp1=$(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))' "$W/$p-det-a.frames.json" "$W/$p-det-one.frames.json")
|
|
64
|
+
mp4ab=$(cmp -s "$W/$p-det-a.mp4" "$W/$p-det-b.mp4" && echo same || echo DIFFER)
|
|
65
|
+
echo "det $p hashed_frames=$ha run_a_vs_b_hashes=$cmpab mp4_a_vs_b=$mp4ab w8_vs_w1_frames_differing=$cmp1" | tee -a "$O/r3.txt"
|
|
66
|
+
done
|
|
67
|
+
echo "== 3. features" | tee -a "$O/r3.txt"
|
|
68
|
+
(cd /home/user/fp/features && python3 gen.py)
|
|
69
|
+
proj /home/user/fp/features "$W/feat"; lossless "$W/feat"
|
|
70
|
+
"$MOSIO" render "$W/feat" -o "$W/feat-ref.mp4" --workers 8 --no-cache --preset lossless > "$W/feat-ref.json" 2> "$W/feat-ref.err"; echo "feat ref rc=$?" | tee -a "$O/r3.txt"
|
|
71
|
+
proj /home/user/fp/features "$W/feat-png"
|
|
72
|
+
"$MOSIO" render "$W/feat-png" -o "$W/feat-png.mp4" --workers 8 --no-cache > /dev/null 2> "$W/feat-png.err"; echo "feat png rc=$?" | tee -a "$O/r3.txt"
|
|
73
|
+
proj /home/user/fp/features "$W/feat2"
|
|
74
|
+
t0=$(ms); "$MOSIO" render "$W/feat2" -o "$W/feat-canvas.mp4" --workers 8 --no-cache --capture canvas > "$W/feat-canvas.json" 2> "$W/feat-canvas.err"; rc=$?; t1=$(ms)
|
|
75
|
+
echo "feat canvas rc=$rc wall_ms=$((t1 - t0)) warnings=$(python3 -c 'import json,sys; print([w["code"]+": "+w["message"][:300] for w in json.load(open(sys.argv[1])).get("warnings",[])])' "$W/feat-canvas.json" 2>/dev/null) err=$(tail -2 "$W/feat-canvas.err" | cut -c1-300)" | tee -a "$O/r3.txt"
|
|
76
|
+
cp "$W/feat-canvas.json" "$W/feat-canvas.err" "$O/" 2>/dev/null
|
|
77
|
+
per_scene() { # per_scene <ssim stats> <tag>
|
|
78
|
+
python3 - "$1" "$W/feat/mosio.json" "$2" <<'PY' | tee -a "$O/r3.txt"
|
|
79
|
+
import json, sys
|
|
80
|
+
vals = {}
|
|
81
|
+
for line in open(sys.argv[1]):
|
|
82
|
+
d = dict(kv.split(":", 1) for kv in line.split() if ":" in kv)
|
|
83
|
+
vals[int(d["n"]) - 1] = float(d["All"])
|
|
84
|
+
f = 0
|
|
85
|
+
for s in json.load(open(sys.argv[2]))["scenes"]:
|
|
86
|
+
v = [vals[i] for i in range(f, f + s["frames"]) if i in vals]
|
|
87
|
+
print(f"feature {sys.argv[3]:6s} {s['id']:9s} ssim_mean={sum(v)/len(v):.5f} ssim_min={min(v):.5f}")
|
|
88
|
+
f += s["frames"]
|
|
89
|
+
PY
|
|
90
|
+
}
|
|
91
|
+
if [ -f "$W/feat-canvas.mp4" ]; then
|
|
92
|
+
echo "feat canvas vs lossless $(score "$W/feat-canvas.mp4" "$W/feat-ref.mp4" feat-canvas)" | tee -a "$O/r3.txt"
|
|
93
|
+
echo "feat png vs lossless $(score "$W/feat-png.mp4" "$W/feat-ref.mp4" feat-png)" | tee -a "$O/r3.txt"
|
|
94
|
+
per_scene "$O/ssim/feat-canvas.ssim" canvas; per_scene "$O/ssim/feat-png.ssim" png
|
|
95
|
+
i=0
|
|
96
|
+
for s in text typo image video video2 svg filter blend backdrop gradient iframe canvas2d; do
|
|
97
|
+
f=$((i * 60 + 40))
|
|
98
|
+
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/feat-$s-canvas-vs-png.png"
|
|
99
|
+
i=$((i + 1))
|
|
100
|
+
done
|
|
101
|
+
# (2) video frame accuracy: scene video2 (frames 240..299) shows clip.mp4 full frame; frame k must be clip frame k
|
|
102
|
+
ffmpeg -v error -y -i /home/user/bench/assets/clip.mp4 -frames:v 62 -vf format=gbrp "$W/clip-%03d.png"
|
|
103
|
+
for v in canvas png; do
|
|
104
|
+
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"
|
|
105
|
+
python3 - "$W" "$v" <<'PY' | tee -a "$O/r3.txt"
|
|
106
|
+
import subprocess, sys, re
|
|
107
|
+
w, v = sys.argv[1], sys.argv[2]
|
|
108
|
+
def ssim(a, b):
|
|
109
|
+
out = subprocess.run(["ffmpeg", "-v", "info", "-i", a, "-i", b, "-lavfi", "ssim", "-f", "null", "-"], capture_output=True, text=True).stderr
|
|
110
|
+
m = re.findall(r"All:([0-9.]+)", out); return float(m[-1]) if m else 0.0
|
|
111
|
+
best = {}
|
|
112
|
+
for k in range(0, 60, 6):
|
|
113
|
+
r = f"{w}/v2-{v}-{k + 1:03d}.png"
|
|
114
|
+
sc = {d: ssim(r, f"{w}/clip-{k + 1 + d:03d}.png") for d in (-1, 0, 1) if 0 <= k + d < 62}
|
|
115
|
+
best[k] = max(sc, key=sc.get), sc
|
|
116
|
+
off = [b[0] for b in best.values()]
|
|
117
|
+
print(f"video-accuracy {v}: best clip offset per sampled frame {off}; ssim at offset 0: " + " ".join(f"{k}={b[1][0]:.4f}" for k, b in best.items()))
|
|
118
|
+
PY
|
|
119
|
+
done
|
|
120
|
+
# (3) audio: the mix is the same file in both; compare decoded PCM and the click positions
|
|
121
|
+
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
|
|
122
|
+
python3 - "$W" <<'PY' | tee -a "$O/r3.txt"
|
|
123
|
+
import sys, array, hashlib, subprocess, json
|
|
124
|
+
w = sys.argv[1]
|
|
125
|
+
r = {}
|
|
126
|
+
for v in ("canvas", "png"):
|
|
127
|
+
a = array.array("h", open(f"{w}/a-{v}.pcm", "rb").read())
|
|
128
|
+
clicks, last = [], -10**9
|
|
129
|
+
for i in range(1, len(a)):
|
|
130
|
+
if abs(a[i] - a[i - 1]) > 9000 and i - last > 24000:
|
|
131
|
+
clicks.append(round(i / 48000, 4)); last = i
|
|
132
|
+
r[v] = (hashlib.sha256(a.tobytes()).hexdigest()[:16], len(a) / 48000, clicks[:6])
|
|
133
|
+
st = subprocess.run(["ffprobe", "-v", "error", "-show_entries", "stream=codec_type,start_time,duration", "-of", "json", f"{w}/feat-{v}.mp4"], capture_output=True, text=True).stdout
|
|
134
|
+
r[v] += (json.loads(st)["streams"],)
|
|
135
|
+
for v, x in r.items():
|
|
136
|
+
print(f"audio {v}: pcm_sha={x[0]} seconds={x[1]:.3f} first_clicks_s={x[2]} streams={[(s['codec_type'], s.get('start_time'), s.get('duration')) for s in x[3]]}")
|
|
137
|
+
print("audio identical:", r["canvas"][0] == r["png"][0])
|
|
138
|
+
PY
|
|
139
|
+
fi
|
|
140
|
+
# crossfade: the canvas path must fall back to screenshots (W_CAPTURE_CANVAS_FALLBACK) and still render
|
|
141
|
+
proj /home/user/fp/features-xfade "$W/xf"
|
|
142
|
+
"$MOSIO" render "$W/xf" -o "$W/xf.mp4" --workers 8 --no-cache --capture canvas > "$W/xf.json" 2> "$W/xf.err"; rc=$?
|
|
143
|
+
echo "xfade canvas rc=$rc frames=$(ffprobe -v error -count_frames -show_entries stream=nb_read_frames -of csv=p=0 "$W/xf.mp4" 2>/dev/null) warnings=$(python3 -c 'import json,sys; print([w["code"] for w in json.load(open(sys.argv[1])).get("warnings",[])])' "$W/xf.json" 2>/dev/null) err=$(tail -1 "$W/xf.err" | cut -c1-200)" | tee -a "$O/r3.txt"
|
|
144
|
+
if ffmpeg -hide_banner -filters 2>/dev/null | grep -q libvmaf; then
|
|
145
|
+
for p in p1 p2; do for v in canvas-w8 mosio; do
|
|
146
|
+
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.]*')
|
|
147
|
+
echo "vmaf $p $v $m" | tee -a "$O/r3.txt"
|
|
148
|
+
done; done
|
|
149
|
+
fi
|
|
150
|
+
cp "$W"/p1-canvas-w8.mp4 "$O/" 2>/dev/null
|
|
151
|
+
echo done
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Round 4 (FP_SCRIPT=sandbox4.sh; round 3 plus: timer A/B, per-stage times, x264 re-encode, mixed capture)
|
|
3
|
+
# Round 3 (FP_SCRIPT=sandbox3.sh, MOSIO_BIN_FILE=<release build of this branch>):
|
|
4
|
+
# 1. bitrate sweep of the in-page encoder (prototype) on P2, scored in RGB against Mosio's lossless render
|
|
5
|
+
# 2. the Rust path end to end: `mosio render --capture canvas` timed on P1/P2, determinism (two runs, and 1 vs 8
|
|
6
|
+
# workers, by per-frame pixel hashes), quality and the timing of frames 0/75/150/299 against the reference
|
|
7
|
+
# 3. feature coverage: every scene of scripts/fastpath/features rendered with png and canvas, SSIM per scene
|
|
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/ssim" "$O/frames" "$W"
|
|
11
|
+
export BENCH_DIR=/home/user/bench MOSIO_HOME=/opt/mosio
|
|
12
|
+
CH=$(ls -d /opt/mosio/browsers/chrome-headless-shell-*/chrome-headless-shell-linux64/chrome-headless-shell | head -1)
|
|
13
|
+
MOSIO=/home/user/mosio-custom
|
|
14
|
+
ms() { python3 -c 'import time;print(int(time.time()*1000))'; }
|
|
15
|
+
proj() { rm -rf "$2"; cp -r "$1" "$2"; mkdir -p "$2/assets"; cp -r /home/user/bench/assets/. "$2/assets/"; }
|
|
16
|
+
lossless() {
|
|
17
|
+
python3 - "$1/mosio.json" <<'PY'
|
|
18
|
+
import json, sys
|
|
19
|
+
m = json.load(open(sys.argv[1])); m["output"]["lossless"] = {"codec": "h264", "crf": 0, "preset": "ultrafast", "pix_fmt": "yuv420p", "gop_frames": 30}
|
|
20
|
+
json.dump(m, open(sys.argv[1], "w"))
|
|
21
|
+
PY
|
|
22
|
+
}
|
|
23
|
+
# score <video> <ref> <tag>: RGB SSIM/PSNR, each side converted with its own range/matrix tags
|
|
24
|
+
score() {
|
|
25
|
+
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=stats_file=$O/ssim/$3.ssim;[a2][b2]psnr" -f null - > "$W/m.log" 2>&1
|
|
26
|
+
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")"
|
|
27
|
+
}
|
|
28
|
+
at() { for n in "$@"; do awk -v n="n:$((n + 1))" '$1==n {for(i=1;i<=NF;i++) if ($i ~ /^All:/) printf "f%d=%s ", n0, substr($i,5)}' n0="$n" "$SS"; done; }
|
|
29
|
+
"$MOSIO" --version 2>/dev/null | head -1
|
|
30
|
+
FRAMES=30 node fp.mjs "$CH" "$B/p1" "$W/warm.mp4" 1 canvas > /dev/null
|
|
31
|
+
for p in p1 p2; do
|
|
32
|
+
proj "$B/$p" "$W/r-$p"; lossless "$W/r-$p"
|
|
33
|
+
"$MOSIO" render "$W/r-$p" -o "$W/$p-ref.mp4" --workers 8 --no-cache --preset lossless > /dev/null 2>&1
|
|
34
|
+
proj "$B/$p" "$W/m-$p"
|
|
35
|
+
t0=$(ms); "$MOSIO" render "$W/m-$p" -o "$W/$p-mosio.mp4" --workers 8 --no-cache > /dev/null 2>&1; t1=$(ms)
|
|
36
|
+
echo "mosio-png $p w=8 wall_ms=$((t1 - t0)) $(score "$W/$p-mosio.mp4" "$W/$p-ref.mp4" "$p-mosio")" | tee -a "$O/r3.txt"
|
|
37
|
+
done
|
|
38
|
+
echo "== 2. mosio render --capture canvas" | tee -a "$O/r3.txt"
|
|
39
|
+
for p in p1 p2; do
|
|
40
|
+
for w in 4 8; do
|
|
41
|
+
for timers in fast clamped; do
|
|
42
|
+
for r in 1 2; do
|
|
43
|
+
ct=0; [ $timers = clamped ] && ct=1
|
|
44
|
+
t0=$(ms); MOSIO_CANVAS_CLAMPED_TIMERS=$ct "$MOSIO" render "$W/m-$p" -o "$W/$p-canvas-w$w.mp4" --workers "$w" --no-cache --capture canvas > "$W/rep.json" 2> "$W/err.log"; rc=$?; t1=$(ms)
|
|
45
|
+
cp "$W/rep.json" "$O/rep-$p-w$w-$timers-$r.json"
|
|
46
|
+
echo "canvas $p w=$w timers=$timers run=$r rc=$rc wall_ms=$((t1 - t0)) $(python3 -c '
|
|
47
|
+
import json,sys; r=json.load(open(sys.argv[1])); e=r["execution"]; sl=e["slices"]; n=sum(s["to"]-s["from"] for s in sl)
|
|
48
|
+
st={k: round(sum(s["in_page_ms"].get(k,0) for s in sl)/n,2) for k in ("seek","paint","frame","encode")}
|
|
49
|
+
print("workers", r.get("workers"), "canvas_ms", e.get("canvas_ms"), "launch_ms", round(r["profile"]["browser_launch_ms"]), "mux_ms", round(r["profile"]["concat_mux_ms"]),
|
|
50
|
+
"per_frame", st, "load_ms_avg", round(sum(s["load_ms"] for s in sl)/len(sl)), "transcode_ms_avg", round(sum(s["transcode_ms"] for s in sl)/len(sl)), "warn", [w["code"] for w in r.get("warnings",[])])' "$W/rep.json" 2>/dev/null || tail -3 "$W/err.log")" | tee -a "$O/r3.txt"
|
|
51
|
+
done
|
|
52
|
+
done
|
|
53
|
+
done
|
|
54
|
+
SS="$O/ssim/$p-canvas.ssim"
|
|
55
|
+
echo "quality $p canvas-w8 $(score "$W/$p-canvas-w8.mp4" "$W/$p-ref.mp4" "$p-canvas") frames: $(at 0 75 150 299)" | tee -a "$O/r3.txt"
|
|
56
|
+
SS="$O/ssim/$p-mosio.ssim"; echo "quality $p mosio-png frames: $(at 0 75 150 299)" | tee -a "$O/r3.txt"
|
|
57
|
+
for f in 0 75 150 299; do
|
|
58
|
+
ffmpeg -v error -y -i "$W/$p-canvas-w8.mp4" -i "$W/$p-ref.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/$p-f$f-canvas-vs-ref.png"
|
|
59
|
+
done
|
|
60
|
+
# determinism: pixel hashes of two 8-worker runs and one 1-worker run
|
|
61
|
+
for tag in a b one; do
|
|
62
|
+
w=8; [ $tag = one ] && w=1
|
|
63
|
+
MOSIO_CANVAS_HASH=1 "$MOSIO" render "$W/m-$p" -o "$W/$p-det-$tag.mp4" --workers $w --no-cache --capture canvas > /dev/null 2>&1
|
|
64
|
+
done
|
|
65
|
+
ha=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["frames"].__len__())' "$W/$p-det-a.frames.json")
|
|
66
|
+
cmpab=$(cmp -s "$W/$p-det-a.frames.json" "$W/$p-det-b.frames.json" && echo same || echo DIFFER)
|
|
67
|
+
cmp1=$(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))' "$W/$p-det-a.frames.json" "$W/$p-det-one.frames.json")
|
|
68
|
+
mp4ab=$(cmp -s "$W/$p-det-a.mp4" "$W/$p-det-b.mp4" && echo same || echo DIFFER)
|
|
69
|
+
echo "det $p hashed_frames=$ha run_a_vs_b_hashes=$cmpab mp4_a_vs_b=$mp4ab w8_vs_w1_frames_differing=$cmp1" | tee -a "$O/r3.txt"
|
|
70
|
+
done
|
|
71
|
+
echo "== 3. features" | tee -a "$O/r3.txt"
|
|
72
|
+
(cd /home/user/fp/features && python3 gen.py)
|
|
73
|
+
proj /home/user/fp/features "$W/feat"; lossless "$W/feat"
|
|
74
|
+
"$MOSIO" render "$W/feat" -o "$W/feat-ref.mp4" --workers 8 --no-cache --preset lossless > "$W/feat-ref.json" 2> "$W/feat-ref.err"; echo "feat ref rc=$?" | tee -a "$O/r3.txt"
|
|
75
|
+
proj /home/user/fp/features "$W/feat-png"
|
|
76
|
+
"$MOSIO" render "$W/feat-png" -o "$W/feat-png.mp4" --workers 8 --no-cache > /dev/null 2> "$W/feat-png.err"; echo "feat png rc=$?" | tee -a "$O/r3.txt"
|
|
77
|
+
proj /home/user/fp/features "$W/feat2"
|
|
78
|
+
t0=$(ms); "$MOSIO" render "$W/feat2" -o "$W/feat-canvas.mp4" --workers 8 --no-cache --capture canvas > "$W/feat-canvas.json" 2> "$W/feat-canvas.err"; rc=$?; t1=$(ms)
|
|
79
|
+
echo "feat canvas rc=$rc wall_ms=$((t1 - t0)) warnings=$(python3 -c 'import json,sys; print([w["code"]+": "+w["message"][:300] for w in json.load(open(sys.argv[1])).get("warnings",[])])' "$W/feat-canvas.json" 2>/dev/null) err=$(tail -2 "$W/feat-canvas.err" | cut -c1-300)" | tee -a "$O/r3.txt"
|
|
80
|
+
cp "$W/feat-canvas.json" "$W/feat-canvas.err" "$O/" 2>/dev/null
|
|
81
|
+
per_scene() { # per_scene <ssim stats> <tag>
|
|
82
|
+
python3 - "$1" "$W/feat/mosio.json" "$2" <<'PY' | tee -a "$O/r3.txt"
|
|
83
|
+
import json, sys
|
|
84
|
+
vals = {}
|
|
85
|
+
for line in open(sys.argv[1]):
|
|
86
|
+
d = dict(kv.split(":", 1) for kv in line.split() if ":" in kv)
|
|
87
|
+
vals[int(d["n"]) - 1] = float(d["All"])
|
|
88
|
+
f = 0
|
|
89
|
+
for s in json.load(open(sys.argv[2]))["scenes"]:
|
|
90
|
+
v = [vals[i] for i in range(f, f + s["frames"]) if i in vals]
|
|
91
|
+
print(f"feature {sys.argv[3]:6s} {s['id']:9s} ssim_mean={sum(v)/len(v):.5f} ssim_min={min(v):.5f}")
|
|
92
|
+
f += s["frames"]
|
|
93
|
+
PY
|
|
94
|
+
}
|
|
95
|
+
if [ -f "$W/feat-canvas.mp4" ]; then
|
|
96
|
+
echo "feat canvas vs lossless $(score "$W/feat-canvas.mp4" "$W/feat-ref.mp4" feat-canvas)" | tee -a "$O/r3.txt"
|
|
97
|
+
echo "feat png vs lossless $(score "$W/feat-png.mp4" "$W/feat-ref.mp4" feat-png)" | tee -a "$O/r3.txt"
|
|
98
|
+
per_scene "$O/ssim/feat-canvas.ssim" canvas; per_scene "$O/ssim/feat-png.ssim" png
|
|
99
|
+
i=0
|
|
100
|
+
for s in text typo image video video2 svg filter blend backdrop gradient iframe canvas2d; do
|
|
101
|
+
f=$((i * 60 + 40))
|
|
102
|
+
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/feat-$s-canvas-vs-png.png"
|
|
103
|
+
i=$((i + 1))
|
|
104
|
+
done
|
|
105
|
+
# (2) video frame accuracy: scene video2 (frames 240..299) shows clip.mp4 full frame; frame k must be clip frame k
|
|
106
|
+
ffmpeg -v error -y -i /home/user/bench/assets/clip.mp4 -frames:v 62 -vf format=gbrp "$W/clip-%03d.png"
|
|
107
|
+
for v in canvas png; do
|
|
108
|
+
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"
|
|
109
|
+
python3 - "$W" "$v" <<'PY' | tee -a "$O/r3.txt"
|
|
110
|
+
import subprocess, sys, re
|
|
111
|
+
w, v = sys.argv[1], sys.argv[2]
|
|
112
|
+
def ssim(a, b):
|
|
113
|
+
out = subprocess.run(["ffmpeg", "-v", "info", "-i", a, "-i", b, "-lavfi", "ssim", "-f", "null", "-"], capture_output=True, text=True).stderr
|
|
114
|
+
m = re.findall(r"All:([0-9.]+)", out); return float(m[-1]) if m else 0.0
|
|
115
|
+
best = {}
|
|
116
|
+
for k in range(0, 60, 6):
|
|
117
|
+
r = f"{w}/v2-{v}-{k + 1:03d}.png"
|
|
118
|
+
sc = {d: ssim(r, f"{w}/clip-{k + 1 + d:03d}.png") for d in (-1, 0, 1) if 0 <= k + d < 62}
|
|
119
|
+
best[k] = max(sc, key=sc.get), sc
|
|
120
|
+
off = [b[0] for b in best.values()]
|
|
121
|
+
print(f"video-accuracy {v}: best clip offset per sampled frame {off}; ssim at offset 0: " + " ".join(f"{k}={b[1][0]:.4f}" for k, b in best.items()))
|
|
122
|
+
PY
|
|
123
|
+
done
|
|
124
|
+
# (3) audio: the mix is the same file in both; compare decoded PCM and the click positions
|
|
125
|
+
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
|
|
126
|
+
python3 - "$W" <<'PY' | tee -a "$O/r3.txt"
|
|
127
|
+
import sys, array, hashlib, subprocess, json
|
|
128
|
+
w = sys.argv[1]
|
|
129
|
+
r = {}
|
|
130
|
+
for v in ("canvas", "png"):
|
|
131
|
+
a = array.array("h", open(f"{w}/a-{v}.pcm", "rb").read())
|
|
132
|
+
clicks, last = [], -10**9
|
|
133
|
+
for i in range(1, len(a)):
|
|
134
|
+
if abs(a[i] - a[i - 1]) > 9000 and i - last > 24000:
|
|
135
|
+
clicks.append(round(i / 48000, 4)); last = i
|
|
136
|
+
r[v] = (hashlib.sha256(a.tobytes()).hexdigest()[:16], len(a) / 48000, clicks[:6])
|
|
137
|
+
st = subprocess.run(["ffprobe", "-v", "error", "-show_entries", "stream=codec_type,start_time,duration", "-of", "json", f"{w}/feat-{v}.mp4"], capture_output=True, text=True).stdout
|
|
138
|
+
r[v] += (json.loads(st)["streams"],)
|
|
139
|
+
for v, x in r.items():
|
|
140
|
+
print(f"audio {v}: pcm_sha={x[0]} seconds={x[1]:.3f} first_clicks_s={x[2]} streams={[(s['codec_type'], s.get('start_time'), s.get('duration')) for s in x[3]]}")
|
|
141
|
+
print("audio identical:", r["canvas"][0] == r["png"][0])
|
|
142
|
+
PY
|
|
143
|
+
fi
|
|
144
|
+
# crossfade: per-scene mix (scene bodies on canvas, the transition by screenshots) in one output
|
|
145
|
+
proj /home/user/fp/features-xfade "$W/xf"
|
|
146
|
+
"$MOSIO" render "$W/xf" -o "$W/xf.mp4" --workers 8 --no-cache --capture canvas > "$W/xf.json" 2> "$W/xf.err"; rc=$?
|
|
147
|
+
proj /home/user/fp/features-xfade "$W/xfp"
|
|
148
|
+
"$MOSIO" render "$W/xfp" -o "$W/xf-png.mp4" --workers 8 --no-cache > /dev/null 2>&1
|
|
149
|
+
cp "$W/xf.json" "$O/xf.json" 2>/dev/null
|
|
150
|
+
echo "xfade canvas rc=$rc frames=$(ffprobe -v error -count_frames -show_entries stream=nb_read_frames -of csv=p=0 "$W/xf.mp4" 2>/dev/null) capture=$(python3 -c 'import json,sys; c=json.load(open(sys.argv[1]))["execution"]["capture"]; print(c["canvas_frames"], c["screenshot_frames"])' "$W/xf.json" 2>/dev/null) warnings=$(python3 -c 'import json,sys; print([w["code"] for w in json.load(open(sys.argv[1])).get("warnings",[])])' "$W/xf.json" 2>/dev/null) err=$(tail -1 "$W/xf.err" | cut -c1-200)" | tee -a "$O/r3.txt"
|
|
151
|
+
[ -f "$W/xf.mp4" ] && echo "xfade canvas-mix vs png $(score "$W/xf.mp4" "$W/xf-png.mp4" xf)" | tee -a "$O/r3.txt"
|
|
152
|
+
[ -f "$W/xf.mp4" ] && 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/xfade-f$f-canvas-vs-png.png"; done
|
|
153
|
+
[ -f "$O/ssim/xf.ssim" ] && echo "xfade per-frame ssim 40..75: $(awk '{for(i=1;i<=NF;i++) if ($i ~ /^All:/) printf "%s ", substr($i,5,6)}' "$O/ssim/xf.ssim" | cut -d' ' -f41-76)" | tee -a "$O/r3.txt"
|
|
154
|
+
if ffmpeg -hide_banner -filters 2>/dev/null | grep -q libvmaf; then
|
|
155
|
+
for p in p1 p2; do for v in canvas-w8 mosio; do
|
|
156
|
+
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.]*')
|
|
157
|
+
echo "vmaf $p $v $m" | tee -a "$O/r3.txt"
|
|
158
|
+
done; done
|
|
159
|
+
fi
|
|
160
|
+
cp "$W"/p1-canvas-w8.mp4 "$O/" 2>/dev/null
|
|
161
|
+
echo done
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Round 5 (FP_SCRIPT=sandbox5.sh, MOSIO_BIN_FILE=<release build>): the per-worker sequential canvas scheduler.
|
|
3
|
+
# 1. png vs canvas wall time on P1, P2 and a stickman recipe (SVG, 450 frames; _local/stickman, not in git), 2 runs
|
|
4
|
+
# each, with the in-page profile (seek split into GSAP / style / getAnimations / ...)
|
|
5
|
+
# 2. replay skipped for stateless scenes vs MOSIO_CANVAS_REPLAY=always
|
|
6
|
+
# 3. determinism: pixel hashes of 8 workers (replay skipped) vs 1 worker (sequential from frame 0)
|
|
7
|
+
# 4. quality vs a lossless screenshot render (RGB SSIM/PSNR) and output size vs png
|
|
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
|
+
nproc
|
|
41
|
+
for p in p1 p2 stickman; do
|
|
42
|
+
src="$B/$p"; [ $p = stickman ] && src=/home/user/fp/_local/stickman
|
|
43
|
+
proj "$src" "$W/r-$p"; lossless "$W/r-$p"
|
|
44
|
+
"$MOSIO" render "$W/r-$p" -o "$W/$p-ref.mp4" --workers 8 --no-cache --preset lossless > /dev/null 2> "$W/ref.err" || tail -2 "$W/ref.err"
|
|
45
|
+
proj "$src" "$W/m-$p"
|
|
46
|
+
for r in 1 2; do
|
|
47
|
+
t0=$(ms); "$MOSIO" render "$W/m-$p" -o "$W/$p-png.mp4" --workers 8 --no-cache > /dev/null 2>&1; t1=$(ms)
|
|
48
|
+
echo "png $p run=$r wall_ms=$((t1 - t0))" | tee -a "$O/r5.txt"
|
|
49
|
+
done
|
|
50
|
+
echo "quality $p png $(score "$W/$p-png.mp4" "$W/$p-ref.mp4")" | tee -a "$O/r5.txt"
|
|
51
|
+
for mode in skip always; do
|
|
52
|
+
for r in 1 2; do
|
|
53
|
+
rp=auto; [ $mode = always ] && rp=always
|
|
54
|
+
t0=$(ms); MOSIO_CANVAS_PROFILE=1 MOSIO_CANVAS_REPLAY=$rp "$MOSIO" render "$W/m-$p" -o "$W/$p-canvas.mp4" --workers 8 --no-cache --capture canvas > "$W/rep.json" 2> "$W/err.log"; rc=$?; t1=$(ms)
|
|
55
|
+
cp "$W/rep.json" "$O/rep-$p-$mode-$r.json"
|
|
56
|
+
echo "canvas $p replay=$mode run=$r rc=$rc wall_ms=$((t1 - t0))" | tee -a "$O/r5.txt"
|
|
57
|
+
summary "$W/rep.json" | tee -a "$O/r5.txt" || tail -3 "$W/err.log" | tee -a "$O/r5.txt"
|
|
58
|
+
done
|
|
59
|
+
done
|
|
60
|
+
# without the profile wrappers (they cost a little)
|
|
61
|
+
t0=$(ms); "$MOSIO" render "$W/m-$p" -o "$W/$p-canvas.mp4" --workers 8 --no-cache --capture canvas > /dev/null 2>&1; t1=$(ms)
|
|
62
|
+
echo "canvas $p noprofile wall_ms=$((t1 - t0))" | tee -a "$O/r5.txt"
|
|
63
|
+
echo "quality $p canvas $(score "$W/$p-canvas.mp4" "$W/$p-ref.mp4")" | tee -a "$O/r5.txt"
|
|
64
|
+
for tag in a one; do
|
|
65
|
+
w=8; [ $tag = one ] && w=1
|
|
66
|
+
MOSIO_CANVAS_HASH=1 "$MOSIO" render "$W/m-$p" -o "$W/$p-det-$tag.mp4" --workers $w --no-cache --capture canvas > /dev/null 2>&1
|
|
67
|
+
done
|
|
68
|
+
echo "det $p w8_skip_vs_w1: $(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), "in w1")' "$W/$p-det-a.frames.json" "$W/$p-det-one.frames.json" 2>&1)" | tee -a "$O/r5.txt"
|
|
69
|
+
done
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Round 6 (FP_SCRIPT=sandbox6.sh, MOSIO_BIN_FILE=<release build>): the per-worker sequential canvas scheduler.
|
|
3
|
+
# 1. P1, P2, a stickman recipe (_local/stickman, not in git): png vs canvas with direct output (in-page OpenH264 is
|
|
4
|
+
# the file) vs canvas re-encoded with the preset (MOSIO_CANVAS_OUTPUT=x264); 2 runs each; in-page profile
|
|
5
|
+
# 2. quality vs a lossless screenshot render (RGB SSIM/PSNR, min over frames) and size
|
|
6
|
+
# 3. determinism: pixel hashes of 8 workers vs 1 worker
|
|
7
|
+
# 4. features project (12 scenes incl. <video>: falls back per scene) and the crossfade project (mixed output)
|
|
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
|
+
nproc
|
|
41
|
+
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 '
|
|
42
|
+
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"; }
|
|
43
|
+
for p in p1 p2 stickman; do
|
|
44
|
+
src="$B/$p"; [ $p = stickman ] && src=/home/user/fp/_local/stickman
|
|
45
|
+
proj "$src" "$W/r-$p"; lossless "$W/r-$p"
|
|
46
|
+
"$MOSIO" render "$W/r-$p" -o "$W/$p-ref.mp4" --workers 8 --no-cache --preset lossless > /dev/null 2> "$W/ref.err" || tail -2 "$W/ref.err"
|
|
47
|
+
proj "$src" "$W/m-$p"
|
|
48
|
+
for r in 1 2; do
|
|
49
|
+
t0=$(ms); "$MOSIO" render "$W/m-$p" -o "$W/$p-png.mp4" --workers 8 --no-cache > /dev/null 2>&1; t1=$(ms)
|
|
50
|
+
echo "png $p run=$r wall_ms=$((t1 - t0))" | tee -a "$O/r6.txt"
|
|
51
|
+
done
|
|
52
|
+
echo "quality $p png $(score "$W/$p-png.mp4" "$W/$p-ref.mp4") $(minssim "$W/$p-png.mp4" "$W/$p-ref.mp4")" | tee -a "$O/r6.txt"
|
|
53
|
+
for out in direct x264; do
|
|
54
|
+
for r in 1 2 3; do
|
|
55
|
+
prof=0; [ $r = 3 ] && prof=1
|
|
56
|
+
t0=$(ms); MOSIO_CANVAS_PROFILE=$prof MOSIO_CANVAS_OUTPUT=$out "$MOSIO" render "$W/m-$p" -o "$W/$p-canvas-$out.mp4" --workers 8 --no-cache --capture canvas > "$W/rep.json" 2> "$W/err.log"; rc=$?; t1=$(ms)
|
|
57
|
+
cp "$W/rep.json" "$O/rep-$p-$out-$r.json"
|
|
58
|
+
echo "canvas $p out=$out run=$r profile=$prof rc=$rc wall_ms=$((t1 - t0))" | tee -a "$O/r6.txt"
|
|
59
|
+
[ $r = 3 ] && { summary "$W/rep.json" | tee -a "$O/r6.txt" || tail -3 "$W/err.log" | tee -a "$O/r6.txt"; }
|
|
60
|
+
done
|
|
61
|
+
echo "quality $p canvas-$out $(score "$W/$p-canvas-$out.mp4" "$W/$p-ref.mp4") $(minssim "$W/$p-canvas-$out.mp4" "$W/$p-ref.mp4")" | tee -a "$O/r6.txt"
|
|
62
|
+
ffprobe -v error -show_entries stream=pix_fmt,color_range,color_transfer,nb_frames -of compact "$W/$p-canvas-$out.mp4" | head -1 | tee -a "$O/r6.txt"
|
|
63
|
+
done
|
|
64
|
+
for tag in a one; do
|
|
65
|
+
w=8; [ $tag = one ] && w=1
|
|
66
|
+
MOSIO_CANVAS_HASH=1 "$MOSIO" render "$W/m-$p" -o "$W/$p-det-$tag.mp4" --workers $w --no-cache --capture canvas > /dev/null 2>&1
|
|
67
|
+
done
|
|
68
|
+
echo "det $p w8_vs_w1: $(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), "in w1")' "$W/$p-det-a.frames.json" "$W/$p-det-one.frames.json" 2>&1) mp4_identical=$(cmp -s "$W/$p-det-a.mp4" "$W/$p-det-one.mp4" && echo yes || echo no)" | tee -a "$O/r6.txt"
|
|
69
|
+
for f in 0 75 150 299; do
|
|
70
|
+
ffmpeg -v error -y -i "$W/$p-canvas-direct.mp4" -i "$W/$p-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/$p-f$f-direct-vs-png.png" 2>/dev/null
|
|
71
|
+
done
|
|
72
|
+
done
|
|
73
|
+
echo "== features / xfade" | tee -a "$O/r6.txt"
|
|
74
|
+
(cd /home/user/fp/features && python3 gen.py)
|
|
75
|
+
for fx in features features-xfade; do
|
|
76
|
+
proj /home/user/fp/$fx "$W/$fx-png"; proj /home/user/fp/$fx "$W/$fx-cv"
|
|
77
|
+
t0=$(ms); "$MOSIO" render "$W/$fx-png" -o "$W/$fx-png.mp4" --workers 8 --no-cache > /dev/null 2>&1; t1=$(ms)
|
|
78
|
+
echo "png $fx wall_ms=$((t1 - t0))" | tee -a "$O/r6.txt"
|
|
79
|
+
t0=$(ms); "$MOSIO" render "$W/$fx-cv" -o "$W/$fx-cv.mp4" --workers 8 --no-cache --capture canvas > "$W/$fx.json" 2> "$W/$fx.err"; rc=$?; t1=$(ms)
|
|
80
|
+
cp "$W/$fx.json" "$O/rep-$fx.json"
|
|
81
|
+
echo "canvas $fx rc=$rc wall_ms=$((t1 - t0)) $(python3 -c '
|
|
82
|
+
import json,sys; r=json.load(open(sys.argv[1])); e=r["execution"]; c=e["capture"]
|
|
83
|
+
print("encoder", r.get("encoder"), "mode", e["encode"]["mode"], "canvas_frames", c["canvas_frames"], "screenshot_frames", c["screenshot_frames"], "png_scenes", [(s["scene"], s["why"][:80]) for s in c["screenshot_scenes"]], "canvas_ms", e["canvas_ms"], "screenshot_ms", e["screenshot_ms"])' "$W/$fx.json" 2>&1 | tail -1) $(tail -1 "$W/$fx.err" | cut -c1-200)" | tee -a "$O/r6.txt"
|
|
84
|
+
echo "quality $fx canvas vs png $(score "$W/$fx-cv.mp4" "$W/$fx-png.mp4") $(minssim "$W/$fx-cv.mp4" "$W/$fx-png.mp4")" | tee -a "$O/r6.txt"
|
|
85
|
+
done
|
|
@@ -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
|