@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.
Files changed (163) hide show
  1. package/THIRD_PARTY_NOTICES.md +22 -0
  2. package/apps/studio/dist/assets/Workspace-DsbQ04kb.js +34 -0
  3. package/apps/studio/dist/assets/{agent-panel-CqJuv5Sn.js → agent-panel-DUWPbpew.js} +5 -5
  4. package/apps/studio/dist/assets/{boundary-bK2S8z05.js → boundary-DuK3AiqM.js} +1 -1
  5. package/apps/studio/dist/assets/{feedback-BqzXUdVd.js → feedback-x6ZumR_x.js} +1 -1
  6. package/apps/studio/dist/assets/index-CjDBKmB_.css +2 -0
  7. package/apps/studio/dist/assets/index-DPLtb0kT.js +1905 -0
  8. package/apps/studio/dist/assets/inspector3d-B8pkZTye.js +1 -0
  9. package/apps/studio/dist/index.html +4 -3
  10. package/apps/studio/dist-host/studio-host.mjs +262 -3
  11. package/bin/mosio +0 -0
  12. package/bin/mosio-agent +0 -0
  13. package/crates/mosio/src/adapters/mosio-three.js +111 -7
  14. package/crates/mosio/src/adapters/room-env-pmrem.json +1 -0
  15. package/crates/mosio/src/runtime.js +126 -6
  16. package/fixtures/camera-inspect/mosio.json +56 -0
  17. package/fixtures/camera-inspect/scenes/behind.html +22 -0
  18. package/fixtures/camera-inspect/scenes/cut.html +18 -0
  19. package/fixtures/camera-inspect/scenes/edges.html +18 -0
  20. package/fixtures/camera-inspect/scenes/good.html +23 -0
  21. package/fixtures/camera-inspect/scenes/read.html +22 -0
  22. package/fixtures/camera-inspect/scenes/shake.html +23 -0
  23. package/fixtures/camera-inspect/scenes/speed.html +18 -0
  24. package/fixtures/camera-inspect-vertical/mosio.json +31 -0
  25. package/fixtures/camera-inspect-vertical/scenes/good.html +20 -0
  26. package/fixtures/camera-inspect-vertical/scenes/safe.html +18 -0
  27. package/fixtures/inspect-physics/expect.json +18 -0
  28. package/fixtures/inspect-physics/mosio.json +29 -0
  29. package/fixtures/inspect-physics/scenes/calm.html +46 -0
  30. package/fixtures/inspect-physics/scenes/physics.html +47 -0
  31. package/package.json +1 -1
  32. package/primitives/README.md +23 -2
  33. package/primitives/example/shared/mosio-prims.js +349 -1
  34. package/primitives/impact-burst/golden/f030.png +0 -0
  35. package/primitives/impact-burst/golden/f032.png +0 -0
  36. package/primitives/impact-burst/golden/f036.png +0 -0
  37. package/primitives/impact-burst/impact-burst.js +51 -0
  38. package/primitives/impact-burst/primitive.json +130 -0
  39. package/primitives/impact-burst/scene.html +24 -0
  40. package/primitives/stick-figure/golden/f030.png +0 -0
  41. package/primitives/stick-figure/golden/f092.png +0 -0
  42. package/primitives/stick-figure/golden/f140.png +0 -0
  43. package/primitives/stick-figure/primitive.json +179 -0
  44. package/primitives/stick-figure/scene.html +40 -0
  45. package/primitives/stick-figure/stick-figure.js +297 -0
  46. package/primitives/zoom-through/primitive.json +7 -2
  47. package/primitives/zoom-through/zoom-through.js +6 -5
  48. package/scripts/3d-acceptance.sh +8 -1
  49. package/scripts/3d-attach-bench.mjs +119 -0
  50. package/scripts/3d-bake-room-env.mjs +74 -0
  51. package/scripts/3d-e2b-job.sh +1 -0
  52. package/scripts/3d-gen-heavy-fixture.py +65 -0
  53. package/scripts/3d-trace-summary.py +14 -0
  54. package/scripts/acceptance/camera-inspect.sh +49 -0
  55. package/scripts/acceptance/export.sh +5 -3
  56. package/scripts/acceptance/hardening.sh +37 -6
  57. package/scripts/acceptance/hub.sh +208 -0
  58. package/scripts/acceptance/inspect.sh +21 -2
  59. package/scripts/acceptance/revisions-git.sh +137 -0
  60. package/scripts/acceptance/revisions-sync.sh +323 -0
  61. package/scripts/acceptance/revisions.sh +118 -4
  62. package/scripts/acceptance/segcache.sh +100 -0
  63. package/scripts/acceptance/split.sh +78 -0
  64. package/scripts/bootstrap.sh +20 -1
  65. package/scripts/check-error-codes.py +8 -0
  66. package/scripts/check-file-size.sh +49 -0
  67. package/scripts/ci.sh +4 -4
  68. package/scripts/dedupe-report.sh +47 -0
  69. package/scripts/e2b/template/provision.sh +1 -1
  70. package/scripts/fastpath/cdp.mjs +25 -0
  71. package/scripts/fastpath/dbg.mjs +11 -0
  72. package/scripts/fastpath/e2b.mjs +40 -0
  73. package/scripts/fastpath/features/gen.py +109 -0
  74. package/scripts/fastpath/features/mosio.json +100 -0
  75. package/scripts/fastpath/features/scenes/backdrop.html +11 -0
  76. package/scripts/fastpath/features/scenes/blend.html +11 -0
  77. package/scripts/fastpath/features/scenes/canvas2d.html +11 -0
  78. package/scripts/fastpath/features/scenes/filter.html +11 -0
  79. package/scripts/fastpath/features/scenes/gradient.html +11 -0
  80. package/scripts/fastpath/features/scenes/iframe.html +11 -0
  81. package/scripts/fastpath/features/scenes/image.html +11 -0
  82. package/scripts/fastpath/features/scenes/svg.html +11 -0
  83. package/scripts/fastpath/features/scenes/text.html +11 -0
  84. package/scripts/fastpath/features/scenes/typo.html +11 -0
  85. package/scripts/fastpath/features/scenes/video.html +11 -0
  86. package/scripts/fastpath/features/scenes/video2.html +11 -0
  87. package/scripts/fastpath/features-xfade/mosio.json +49 -0
  88. package/scripts/fastpath/features-xfade/scenes/image.html +11 -0
  89. package/scripts/fastpath/features-xfade/scenes/video.html +11 -0
  90. package/scripts/fastpath/fixtures/gen_layout.py +80 -0
  91. package/scripts/fastpath/fixtures/l12-no-reset/assets/img/photo-1015.jpg +0 -0
  92. package/scripts/fastpath/fixtures/l12-no-reset/mosio.json +34 -0
  93. package/scripts/fastpath/fixtures/l12-no-reset/scenes/main.html +20 -0
  94. package/scripts/fastpath/fp.mjs +91 -0
  95. package/scripts/fastpath/inpage.js +68 -0
  96. package/scripts/fastpath/recipes.py +49 -0
  97. package/scripts/fastpath/sandbox.sh +68 -0
  98. package/scripts/fastpath/sandbox10.sh +57 -0
  99. package/scripts/fastpath/sandbox11.sh +18 -0
  100. package/scripts/fastpath/sandbox12.sh +30 -0
  101. package/scripts/fastpath/sandbox13.sh +16 -0
  102. package/scripts/fastpath/sandbox14.sh +28 -0
  103. package/scripts/fastpath/sandbox15.sh +36 -0
  104. package/scripts/fastpath/sandbox16.sh +60 -0
  105. package/scripts/fastpath/sandbox17.sh +34 -0
  106. package/scripts/fastpath/sandbox18.sh +59 -0
  107. package/scripts/fastpath/sandbox19.sh +67 -0
  108. package/scripts/fastpath/sandbox2.sh +41 -0
  109. package/scripts/fastpath/sandbox20.sh +34 -0
  110. package/scripts/fastpath/sandbox21.sh +22 -0
  111. package/scripts/fastpath/sandbox22.sh +22 -0
  112. package/scripts/fastpath/sandbox23.sh +21 -0
  113. package/scripts/fastpath/sandbox3.sh +151 -0
  114. package/scripts/fastpath/sandbox4.sh +161 -0
  115. package/scripts/fastpath/sandbox5.sh +69 -0
  116. package/scripts/fastpath/sandbox6.sh +85 -0
  117. package/scripts/fastpath/sandbox7.sh +81 -0
  118. package/scripts/fastpath/sandbox8.sh +62 -0
  119. package/scripts/fastpath/sandbox9.sh +130 -0
  120. package/scripts/fastpath/srv.mjs +15 -0
  121. package/scripts/fastpath/www/probe.html +1 -0
  122. package/scripts/hpbench/make-bench-fixtures.sh +43 -0
  123. package/scripts/hpbench/render-cgroup.sh +56 -0
  124. package/scripts/install.sh +2 -1
  125. package/scripts/npm-clean-install-proof-win.sh +64 -0
  126. package/scripts/platform-smoke.sh +67 -0
  127. package/scripts/prim.mjs +31 -13
  128. package/skills/mosio-3d/SKILL.md +1 -1
  129. package/skills/mosio-brief/SKILL.md +80 -0
  130. package/skills/mosio-brief/references/brief.md +141 -0
  131. package/skills/mosio-brief/references/copy.md +99 -0
  132. package/skills/mosio-brief/references/narration.md +61 -0
  133. package/skills/mosio-brief/references/storyboard.md +98 -0
  134. package/skills/mosio-collab/SKILL.md +104 -0
  135. package/skills/mosio-collab/references/hub.md +62 -0
  136. package/skills/mosio-engine/SKILL.md +44 -13
  137. package/skills/mosio-engine/references/camera.md +12 -2
  138. package/skills/mosio-engine/references/character.md +88 -0
  139. package/skills/mosio-engine/references/checks.md +10 -3
  140. package/skills/mosio-engine/references/delivery.md +29 -2
  141. package/skills/mosio-engine/references/kit-primitives.md +8 -4
  142. package/skills/mosio-engine/references/layout.md +8 -0
  143. package/skills/mosio-engine/references/plan.md +3 -1
  144. package/skills/mosio-engine/references/project.md +3 -3
  145. package/skills/mosio-engine/references/publish.md +79 -0
  146. package/skills/mosio-engine/references/registry.md +27 -15
  147. package/skills/mosio-engine/references/timeline.md +18 -0
  148. package/skills/mosio-engine/references/timing.md +2 -1
  149. package/skills/mosio-import/SKILL.md +1 -1
  150. package/skills/mosio-import/references/from-hyperframes.md +1 -1
  151. package/skills/mosio-import/references/from-remotion.md +1 -1
  152. package/skills/mosio-media/SKILL.md +16 -4
  153. package/skills/mosio-media/references/audio.md +29 -11
  154. package/skills/mosio-media/references/captions.md +22 -4
  155. package/skills/mosio-media/references/editing.md +70 -0
  156. package/skills/mosio-media/references/footage.md +40 -8
  157. package/skills/mosio-media/references/voice.md +52 -7
  158. package/skills/mosio-replicate/references/mosio.md +1 -1
  159. package/toolchain.lock.json +151 -4
  160. package/apps/studio/dist/assets/Workspace-KSOFeEgc.js +0 -32
  161. package/apps/studio/dist/assets/index-B-uuTqe9.js +0 -1785
  162. package/apps/studio/dist/assets/index-CajSh04l.css +0 -2
  163. package/apps/studio/dist/assets/inspector3d-vDz97X99.js +0 -1
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env bash
2
+ # Round 10 (FP_SCRIPT=sandbox10.sh, MOSIO_BIN_FILE=<release build>): the per-worker sequential canvas scheduler.
3
+ # validation of the light-barrier defaults (no task drains, VideoFrame straight from the canvas): wall time vs png,
4
+ # pixel hashes vs the old settings (3 drains, ImageBitmap), and 8 workers vs 1 (replay skipped vs always)
5
+ set -uo pipefail
6
+ cd /home/user/fp
7
+ B=/home/user/bench/engines/mosio; O=/home/user/out; W=/home/user/work; mkdir -p "$O" "$W"
8
+ export BENCH_DIR=/home/user/bench MOSIO_HOME=/opt/mosio
9
+ MOSIO=/home/user/mosio-custom
10
+ ms() { python3 -c 'import time;print(int(time.time()*1000))'; }
11
+ proj() { rm -rf "$2"; cp -r "$1" "$2"; mkdir -p "$2/assets"; cp -r /home/user/bench/assets/. "$2/assets/"; }
12
+ lossless() {
13
+ python3 - "$1/mosio.json" <<'PY'
14
+ import json, sys
15
+ m = json.load(open(sys.argv[1])); m.setdefault("output", {})["lossless"] = {"codec": "h264", "crf": 0, "preset": "ultrafast", "pix_fmt": "yuv420p", "gop_frames": 30}
16
+ json.dump(m, open(sys.argv[1], "w"))
17
+ PY
18
+ }
19
+ score() {
20
+ 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
21
+ 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")"
22
+ }
23
+ summary() {
24
+ python3 - "$1" <<'PY' 2>/dev/null
25
+ import json, sys
26
+ r = json.load(open(sys.argv[1])); e = r["execution"]; sl = e["slices"]; n = sum(s["to"] - s["from"] for s in sl)
27
+ keys = sorted({k for s in sl for k in s["in_page_ms"] if k not in ("replayed",)})
28
+ st = {k: round(sum(s["in_page_ms"].get(k, 0) for s in sl) / n, 2) for k in keys}
29
+ print("slices", [(s["from"], s["to"]) for s in sl][:12], "replayed", [s["in_page_ms"].get("replayed") for s in sl][:12])
30
+ print(" per_frame", st)
31
+ 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)),
32
+ "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"]),
33
+ "mux_ms", round(r["profile"]["concat_mux_ms"]), "warn", [w["code"] for w in r.get("warnings", [])])
34
+ PY
35
+ }
36
+ "$MOSIO" --version 2>/dev/null | head -1
37
+ cmph() { 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), "of", len(a), "differ", ("at " + str(d[:30])) if d else "")' "$1" "$2"; }
38
+ for p in p1 stickman p2; do
39
+ src="$B/$p"; [ $p = stickman ] && src=/home/user/fp/_local/stickman
40
+ proj "$src" "$W/m-$p"
41
+ t0=$(ms); timeout 600 "$MOSIO" render "$W/m-$p" -o "$W/$p-png.mp4" --workers 8 --no-cache > /dev/null 2>&1; t1=$(ms)
42
+ echo "png $p wall_ms=$((t1 - t0))" | tee -a "$O/r10.txt"
43
+ for r in 1 2 3; do
44
+ t0=$(ms); timeout 600 "$MOSIO" render "$W/m-$p" -o "$W/$p-cv.mp4" --workers 8 --no-cache --capture canvas > "$W/rep.json" 2> "$W/err.log"; rc=$?; t1=$(ms)
45
+ echo "canvas $p default run=$r rc=$rc wall_ms=$((t1 - t0)) bytes=$(stat -c %s "$W/$p-cv.mp4" 2>/dev/null)" | tee -a "$O/r10.txt"
46
+ done
47
+ MOSIO_CANVAS_PROFILE=1 timeout 600 "$MOSIO" render "$W/m-$p" -o "$W/$p-cv.mp4" --workers 8 --no-cache --capture canvas > "$W/rep.json" 2>/dev/null
48
+ cp "$W/rep.json" "$O/rep-$p.json"; summary "$W/rep.json" | tee -a "$O/r10.txt"
49
+ echo "quality $p canvas vs png $(score "$W/$p-cv.mp4" "$W/$p-png.mp4")" | tee -a "$O/r10.txt"
50
+ MOSIO_CANVAS_HASH=1 timeout 600 "$MOSIO" render "$W/m-$p" -o "$W/$p-h-new.mp4" --workers 8 --no-cache --capture canvas > /dev/null 2>&1
51
+ MOSIO_CANVAS_HASH=1 MOSIO_CANVAS_DRAINS=3 MOSIO_CANVAS_FRAME_SRC=bitmap timeout 600 "$MOSIO" render "$W/m-$p" -o "$W/$p-h-old.mp4" --workers 8 --no-cache --capture canvas > /dev/null 2>&1
52
+ MOSIO_CANVAS_HASH=1 timeout 600 "$MOSIO" render "$W/m-$p" -o "$W/$p-h-w1.mp4" --workers 1 --no-cache --capture canvas > /dev/null 2>&1
53
+ MOSIO_CANVAS_HASH=1 MOSIO_CANVAS_REPLAY=always timeout 600 "$MOSIO" render "$W/m-$p" -o "$W/$p-h-always.mp4" --workers 8 --no-cache --capture canvas > /dev/null 2>&1
54
+ echo "hash $p new_vs_old(drains3+bitmap): $(cmph "$W/$p-h-old.frames.json" "$W/$p-h-new.frames.json")" | tee -a "$O/r10.txt"
55
+ echo "hash $p w1_vs_w8skip: $(cmph "$W/$p-h-w1.frames.json" "$W/$p-h-new.frames.json")" | tee -a "$O/r10.txt"
56
+ echo "hash $p w1_vs_w8always: $(cmph "$W/$p-h-w1.frames.json" "$W/$p-h-always.frames.json")" | tee -a "$O/r10.txt"
57
+ done
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env bash
2
+ # Round 11b (FP_SCRIPT=sandbox11.sh): color tags of the direct canvas output vs the screenshot output, and whether the
3
+ # pixels match their tags (each side decoded with its own range/matrix, compared to the lossless png render).
4
+ set -uo pipefail
5
+ B=/home/user/bench/engines/mosio; O=/home/user/out; W=/home/user/work; mkdir -p "$O" "$W"
6
+ export MOSIO_HOME=/opt/mosio
7
+ MOSIO=/home/user/mosio-custom
8
+ rm -rf "$W/p"; cp -r "$B/p1" "$W/p"; mkdir -p "$W/p/assets"; cp -r /home/user/bench/assets/. "$W/p/assets/"
9
+ "$MOSIO" render "$W/p" -o "$W/png.mp4" --workers 8 --no-cache > /dev/null 2>&1
10
+ "$MOSIO" render "$W/p" -o "$W/cv.mp4" --workers 8 --no-cache --capture canvas > "$O/rep.json" 2>&1
11
+ for f in png cv; do
12
+ echo "$f $(ffprobe -v error -select_streams v -show_entries stream=pix_fmt,color_range,color_space,color_transfer,color_primaries -of compact=p=0 "$W/$f.mp4")" | tee -a "$O/color.txt"
13
+ done
14
+ # mean luma of a frame decoded honouring tags vs ignoring the range flag (what a player that ignores it would show)
15
+ for m in auto tv; do
16
+ echo "cv in_range=$m $(ffmpeg -v info -i "$W/cv.mp4" -i "$W/png.mp4" -lavfi "[0:v]scale=in_range=$m:in_color_matrix=auto,format=gbrp[a];[1:v]scale=in_range=auto:in_color_matrix=auto,format=gbrp[b];[a][b]psnr" -f null - 2>&1 | grep -o 'average:[0-9.inf]*')" | tee -a "$O/color.txt"
17
+ done
18
+ python3 -c 'import json;print(json.dumps(json.load(open("/home/user/out/rep.json"))["execution"]["encode"]))' | tee -a "$O/color.txt"
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env bash
2
+ # Round 12 (FP_SCRIPT=sandbox12.sh): --capture auto (canary, layer D) and canvas:match. P1: wall time of canvas vs
3
+ # auto without cache, auto with a cold and a warm cache; recipes whose canvas output differed most from png in round 8:
4
+ # what the canary decides, and the output's SSIM vs png.
5
+ set -uo pipefail
6
+ B=/home/user/bench/engines/mosio; 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
+ rep() { python3 -c 'import json,sys; r=json.load(open(sys.argv[1])); e=r.get("execution",{}); c=e.get("capture",{}); print(json.dumps({"ok":r.get("ok"),"err":(r.get("error") or "")[:200],"requested":c.get("requested"),"canary":c.get("canary"),"png_scenes":[(s["scene"],s["why"][:120]) for s in c.get("screenshot_scenes",[])],"encode":(e.get("encode") or {}).get("mode"),"warn":[w["code"]+": "+w["message"][:300] for w in r.get("warnings",[])]}))' "$1"; }
11
+ ssim() { 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" -f null - 2>&1 | grep -o 'All:[0-9.]*' | tail -1; }
12
+ rm -rf "$W/p1"; cp -r "$B/p1" "$W/p1"; mkdir -p "$W/p1/assets"; cp -r /home/user/bench/assets/. "$W/p1/assets/"
13
+ # warm the sandbox (first Chromium launch, page cache) so the first measured render is not a cold one
14
+ timeout 600 "$MOSIO" render "$W/p1" -o "$W/p1-warm.mp4" --workers 8 --no-cache > /dev/null 2>&1
15
+ for m in canvas canvas auto canvas:match; do
16
+ t0=$(ms); timeout 600 "$MOSIO" render "$W/p1" -o "$W/p1-$m.mp4" --workers 8 --no-cache --capture "$m" > "$W/r.json" 2>/dev/null; t1=$(ms)
17
+ echo "p1 $m no-cache wall_ms=$((t1 - t0)) $(rep "$W/r.json")" | tee -a "$O/r12.txt"
18
+ done
19
+ rm -rf "$W/cache"
20
+ for run in cold warm; do
21
+ t0=$(ms); timeout 600 "$MOSIO" render "$W/p1" -o "$W/p1-auto-c.mp4" --workers 8 --cache-dir "$W/cache" --capture auto > "$W/r.json" 2>/dev/null; t1=$(ms)
22
+ echo "p1 auto cache=$run wall_ms=$((t1 - t0)) $(rep "$W/r.json")" | tee -a "$O/r12.txt"
23
+ done
24
+ for n in city-symphony archive-lighttable brick-toy clay-serif anatomi-iso; do
25
+ d=/home/user/fp/_local/recipes/$n; [ -d "$d" ] || continue
26
+ rm -rf "$W/r"; cp -r "$d" "$W/r"
27
+ timeout 600 "$MOSIO" render "$W/r" -o "$W/r-png.mp4" --workers 8 --no-cache > /dev/null 2>&1
28
+ t0=$(ms); timeout 600 "$MOSIO" render "$W/r" -o "$W/r-auto.mp4" --workers 8 --no-cache --capture auto > "$W/r.json" 2>/dev/null; t1=$(ms)
29
+ echo "recipe $n auto wall_ms=$((t1 - t0)) out_vs_png=$(ssim "$W/r-auto.mp4" "$W/r-png.mp4") $(rep "$W/r.json")" | tee -a "$O/r12.txt"
30
+ done
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env bash
2
+ # Round 13 (FP_SCRIPT=sandbox13.sh): canary diagnosis. P1 and clay-serif with --capture auto, both sides of every
3
+ # sample kept (MOSIO_CANVAS_CANARY_DUMP), with the canvas barrier at 0 and at 3 drains.
4
+ set -uo pipefail
5
+ B=/home/user/bench/engines/mosio; O=/home/user/out; W=/home/user/work; mkdir -p "$O" "$W"
6
+ export MOSIO_HOME=/opt/mosio
7
+ MOSIO=/home/user/mosio-custom
8
+ rm -rf "$W/p1"; cp -r "$B/p1" "$W/p1"; mkdir -p "$W/p1/assets"; cp -r /home/user/bench/assets/. "$W/p1/assets/"
9
+ rm -rf "$W/cs"; cp -r /home/user/fp/_local/recipes/clay-serif "$W/cs"
10
+ for d in 0 3; do
11
+ for p in p1 cs; do
12
+ mkdir -p "$O/dump-$p-d$d"
13
+ MOSIO_CANVAS_DRAINS=$d MOSIO_CANVAS_CANARY_DUMP="$O/dump-$p-d$d" timeout 600 "$MOSIO" render "$W/$p" -o "$W/$p.mp4" --workers 8 --no-cache --capture auto > "$W/r.json" 2>/dev/null
14
+ echo "$p drains=$d $(python3 -c 'import json,sys; r=json.load(open(sys.argv[1])); print([w["message"][:200] for w in r.get("warnings",[])], (r.get("execution") or {}).get("capture",{}).get("canary"))' "$W/r.json")" | tee -a "$O/r13.txt"
15
+ done
16
+ done
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env bash
2
+ # Round 14 (FP_SCRIPT=sandbox14.sh): hold-skip and encoder queue. Per project: wall time (2 runs) and held frames with
3
+ # hold on (default) / off, queue 2 / 6, and pixel hashes hold on vs off (must be identical).
4
+ set -uo pipefail
5
+ B=/home/user/bench/engines/mosio; O=/home/user/out; mkdir -p "$O" /home/user/work
6
+ export MOSIO_HOME=/opt/mosio
7
+ MOSIO=/home/user/mosio-custom
8
+ ms() { python3 -c 'import time;print(int(time.time()*1000))'; }
9
+ held() { python3 -c 'import json,sys; r=json.load(open(sys.argv[1])); sl=r["execution"]["slices"]; n=sum(s["to"]-s["from"] for s in sl); g=lambda k: round(sum(s["in_page_ms"].get(k,0) for s in sl)/n,2); print("held", int(sum(s["in_page_ms"].get("held",0) for s in sl)), "of", n, "seek", g("seek"), "paint", g("paint"), "frame", g("frame"), "encode", g("encode"))' "$1" 2>/dev/null; }
10
+ cmph() { 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), "of", len(a), "differ", d[:20])' "$1" "$2"; }
11
+ timeout 600 "$MOSIO" render "$B/p1" -o /home/user/work/warm.mp4 --workers 8 --no-cache > /dev/null 2>&1
12
+ for p in p1 p2 stickman clay-serif briefing-board anatomi-iso; do
13
+ d=/home/user/work/proj-$p
14
+ rm -rf "/home/user/work/proj-$p"
15
+ if [ -d "$B/$p" ]; then cp -r "$B/$p" "$d"; mkdir -p "$d/assets"; cp -r /home/user/bench/assets/. "$d/assets/"
16
+ elif [ $p = stickman ]; then cp -r /home/user/fp/_local/stickman "$d"
17
+ else cp -r "/home/user/fp/_local/recipes/$p" "$d"; fi
18
+ for v in "HOLD=1 QUEUE=2" "HOLD=0 QUEUE=2" "HOLD=1 QUEUE=6"; do
19
+ h=${v%% *}; q=${v##* }
20
+ for r in 1 2; do
21
+ t0=$(ms); env "MOSIO_CANVAS_${h}" "MOSIO_CANVAS_${q}" MOSIO_CANVAS_PROFILE=1 timeout 600 "$MOSIO" render "$d" -o /home/user/work/o.mp4 --workers 8 --no-cache --capture canvas > /home/user/work/r.json 2>/dev/null; t1=$(ms)
22
+ echo "$p $v run=$r wall_ms=$((t1 - t0)) $(held /home/user/work/r.json)" | tee -a "$O/r14.txt"
23
+ done
24
+ done
25
+ MOSIO_CANVAS_HASH=1 timeout 600 "$MOSIO" render "$d" -o /home/user/work/h1.mp4 --workers 8 --no-cache --capture canvas > /dev/null 2>&1
26
+ MOSIO_CANVAS_HASH=1 MOSIO_CANVAS_HOLD=0 timeout 600 "$MOSIO" render "$d" -o /home/user/work/h0.mp4 --workers 8 --no-cache --capture canvas > /dev/null 2>&1
27
+ echo "$p hash hold_on_vs_off: $(cmph /home/user/work/h0.frames.json /home/user/work/h1.frames.json)" | tee -a "$O/r14.txt"
28
+ done
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env bash
2
+ # Round 15 (FP_SCRIPT=sandbox15.sh): per-frame cost experiments on the canvas pages, each against the default:
3
+ # wrf a CPU-backed 2D canvas (willReadFrequently) instead of one on the SwiftShader GPU process
4
+ # raster the png path's raster determinism flags dropped (--num-raster-threads=1, --disable-partial-raster)
5
+ # wrf+q6 wrf and an encoder queue of 6
6
+ # Per variant: wall time, per-frame profile, pixel hashes vs the default. Plus: frames identical to the previous one
7
+ # (from the default's hashes) against the frames hold-skip held.
8
+ set -uo pipefail
9
+ B=/home/user/bench/engines/mosio; O=/home/user/out; mkdir -p "$O" /home/user/work
10
+ export MOSIO_HOME=/opt/mosio
11
+ MOSIO=/home/user/mosio-custom
12
+ ms() { python3 -c 'import time;print(int(time.time()*1000))'; }
13
+ prof() { python3 -c 'import json,sys; r=json.load(open(sys.argv[1])); sl=r["execution"]["slices"]; n=sum(s["to"]-s["from"] for s in sl); g=lambda k: round(sum(s["in_page_ms"].get(k,0) for s in sl)/n,2); print("held", int(sum(s["in_page_ms"].get("held",0) for s in sl)), "of", n, "seek", g("seek"), "paint", g("paint"), "frame", g("frame"), "encode", g("encode"))' "$1" 2>/dev/null; }
14
+ cmph() { 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), "of", len(a), "differ", d[:10])' "$1" "$2"; }
15
+ still() { python3 -c 'import json,sys; a=json.load(open(sys.argv[1]))["frames"]; print(sum(1 for i in range(1,len(a)) if a[i]==a[i-1]), "of", len(a), "identical to the previous frame")' "$1"; }
16
+ timeout 600 "$MOSIO" render "$B/p1" -o /home/user/work/warm.mp4 --workers 8 --no-cache > /dev/null 2>&1
17
+ for p in p1 p2 stickman briefing-board anatomi-iso; do
18
+ d=/home/user/work/proj-$p
19
+ rm -rf "/home/user/work/proj-$p"
20
+ if [ -d "$B/$p" ]; then cp -r "$B/$p" "$d"; mkdir -p "$d/assets"; cp -r /home/user/bench/assets/. "$d/assets/"
21
+ elif [ $p = stickman ]; then cp -r /home/user/fp/_local/stickman "$d"
22
+ else cp -r "/home/user/fp/_local/recipes/$p" "$d"; fi
23
+ for v in base wrf raster wrf+q6; do
24
+ case $v in
25
+ base) e=();;
26
+ wrf) e=(MOSIO_CANVAS_WRF=1);;
27
+ raster) e=(MOSIO_CANVAS_FLAGS_DROP=--num-raster-threads,--disable-partial-raster);;
28
+ wrf+q6) e=(MOSIO_CANVAS_WRF=1 MOSIO_CANVAS_QUEUE=6);;
29
+ esac
30
+ t0=$(ms); env "${e[@]}" MOSIO_CANVAS_PROFILE=1 timeout 600 "$MOSIO" render "$d" -o /home/user/work/o.mp4 --workers 8 --no-cache --capture canvas > /home/user/work/r.json 2>/dev/null; t1=$(ms)
31
+ t2=$(ms); env "${e[@]}" timeout 600 "$MOSIO" render "$d" -o /home/user/work/o2.mp4 --workers 8 --no-cache --capture canvas > /dev/null 2>&1; t3=$(ms)
32
+ env "${e[@]}" MOSIO_CANVAS_HASH=1 timeout 600 "$MOSIO" render "$d" -o "/home/user/work/h-$v.mp4" --workers 8 --no-cache --capture canvas > /dev/null 2>&1
33
+ echo "$p $v wall_ms=$((t3 - t2)) (profiled $((t1 - t0))) $(prof /home/user/work/r.json) hash_vs_base: $(cmph /home/user/work/h-base.frames.json "/home/user/work/h-$v.frames.json")" | tee -a "$O/r15.txt"
34
+ done
35
+ echo "$p still: $(still /home/user/work/h-base.frames.json)" | tee -a "$O/r15.txt"
36
+ done
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env bash
2
+ # Round 16 (FP_SCRIPT=sandbox16.sh): the raw output path (MOSIO_CANVAS_OUTPUT=raw: RGBA posted to the asset origin,
3
+ # encoded once with the output preset) against png and the direct in-page stream. Per project and variant: wall time
4
+ # (2 runs), file size, VMAF / PSNR-Y / SSIM-Y against a lossless screenshot render (crf 0, as render-bench's
5
+ # quality.sh scores), colour tags. Raw variants: getImageData or VideoFrame.copyTo, the default preset (medium crf 18,
6
+ # the png path's) and quicker x264 presets.
7
+ set -uo pipefail
8
+ B=/home/user/bench/engines/mosio; O=/home/user/out; W=/home/user/work; mkdir -p "$O" "$W"
9
+ export MOSIO_HOME=/opt/mosio
10
+ MOSIO=/home/user/mosio-custom
11
+ ms() { python3 -c 'import time;print(int(time.time()*1000))'; }
12
+ MFF=ffmpeg
13
+ if ! ffmpeg -hide_banner -filters 2>/dev/null | grep -q libvmaf; then
14
+ mkdir -p /home/user/work/mff && curl -fsSL https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n8.1-latest-linux64-gpl-8.1.tar.xz | tar xJ -C /home/user/work/mff --strip-components=1
15
+ MFF=/home/user/work/mff/bin/ffmpeg
16
+ fi
17
+ norm="scale=out_range=tv:flags=bicubic+accurate_rnd+full_chroma_int,format=yuv420p,setpts=PTS-STARTPTS"
18
+ score() { # enc ref -> "vmaf=.. vmaf_min=.. psnr_y=.. ssim_y=.."
19
+ "$MFF" -v error -i "$1" -i "$2" -lavfi "[0:v]$norm[a];[1:v]$norm[b];[a]split=3[a1][a2][a3];[b]split=3[b1][b2][b3];[a1][b1]libvmaf=n_threads=8:log_fmt=json:log_path=$W/v.json;[a2][b2]psnr=stats_file=$W/p.log;[a3][b3]ssim=stats_file=$W/s.log" -f null - 2>/dev/null
20
+ python3 - "$W" <<'PY'
21
+ import json, sys, re
22
+ w = sys.argv[1]
23
+ v = [f["metrics"]["vmaf"] for f in json.load(open(f"{w}/v.json"))["frames"]]
24
+ p = [float(re.search(r"psnr_y:([0-9.]+|inf)", l).group(1).replace("inf", "100")) for l in open(f"{w}/p.log")]
25
+ s = [float(re.search(r"Y:([0-9.]+)", l).group(1)) for l in open(f"{w}/s.log")]
26
+ print(f"vmaf={sum(v)/len(v):.2f} vmaf_min={min(v):.2f} psnr_y={sum(p)/len(p):.2f} ssim_y={sum(s)/len(s):.5f}")
27
+ PY
28
+ }
29
+ info() { ffprobe -v error -select_streams v:0 -show_entries stream=color_range,color_transfer,color_space,bit_rate -of csv=p=0 "$1" | tr ',' ' '; }
30
+ rep() { python3 -c 'import json,sys; r=json.load(open(sys.argv[1])); e=r.get("execution",{}); c=e.get("capture",{}); sl=e.get("slices",[]); n=sum(s["to"]-s["from"] for s in sl) or 1; g=lambda k: round(sum(s["in_page_ms"].get(k,0) for s in sl)/n,2); print(json.dumps({"ok":r.get("ok"),"err":(r.get("error") or "")[:300],"enc":(e.get("encode") or {}).get("mode"),"png_scenes":[s["why"][:160] for s in c.get("screenshot_scenes",[])],"seek":g("seek"),"paint":g("paint"),"frame":g("frame"),"post":g("encode"),"held":int(sum(s["in_page_ms"].get("held",0) for s in sl)),"wait_ms":round(sum(s.get("transcode_ms",0) for s in sl))}))' "$1" 2>/dev/null; }
31
+ timeout 600 "$MOSIO" render "$B/p1" -o "$W/warm.mp4" --workers 8 --no-cache > /dev/null 2>&1
32
+ for p in p1 p2; do
33
+ d=/home/user/work/proj-$p
34
+ rm -rf "/home/user/work/proj-$p"; cp -r "$B/$p" "$d"; mkdir -p "$d/assets"; cp -r /home/user/bench/assets/. "$d/assets/"
35
+ python3 - "$d/mosio.json" <<'PY'
36
+ import json, sys
37
+ m = json.load(open(sys.argv[1])); o = m.setdefault("output", {})
38
+ o["lossless"] = {"codec": "h264", "crf": 0, "preset": "ultrafast", "pix_fmt": "yuv420p", "gop_frames": 60}
39
+ for pre, crf in [("veryfast", 18), ("veryfast", 20), ("faster", 18), ("faster", 20)]:
40
+ o[f"{pre}{crf}"] = {"codec": "h264", "crf": crf, "preset": pre, "pix_fmt": "yuv420p"}
41
+ json.dump(m, open(sys.argv[1], "w"), indent=2)
42
+ PY
43
+ timeout 900 "$MOSIO" render "$d" -o "/home/user/work/$p-ref.mp4" --workers 8 --no-cache --preset lossless > /dev/null 2>&1
44
+ for v in png direct raw raw-frame raw-veryfast18 raw-veryfast20 raw-faster18 raw-faster20; do
45
+ case $v in
46
+ png) e=(); a=();;
47
+ direct) e=(); a=(--capture canvas);;
48
+ raw) e=(MOSIO_CANVAS_OUTPUT=raw); a=(--capture canvas);;
49
+ raw-frame) e=(MOSIO_CANVAS_OUTPUT=raw MOSIO_CANVAS_RAW_SRC=frame); a=(--capture canvas);;
50
+ raw-*) e=(MOSIO_CANVAS_OUTPUT=raw); a=(--capture canvas --preset "${v#raw-}");;
51
+ esac
52
+ o="/home/user/work/$p-$v.mp4"
53
+ walls=""
54
+ for r in 1 2; do
55
+ t0=$(ms); env "${e[@]}" MOSIO_CANVAS_PROFILE=1 timeout 600 "$MOSIO" render "$d" -o "$o" --workers 8 --no-cache "${a[@]}" > "$W/r.json" 2>/dev/null; t1=$(ms)
56
+ walls="$walls $((t1 - t0))"
57
+ done
58
+ echo "$p $v wall_ms=[$walls ] size=$(stat -c %s "$o" 2>/dev/null) tags=[$(info "$o")] $(score "$o" "/home/user/work/$p-ref.mp4") $(rep "$W/r.json")" | tee -a "$O/r16.txt"
59
+ done
60
+ done
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env bash
2
+ # Round 17 (FP_SCRIPT=sandbox17.sh): where the raw output's time goes (server side: reading posted bodies, posts
3
+ # waiting for the encoder, writing into the encoder; MOSIO_CANVAS_RAW_DRY=1 posts pixels for the first frame of each
4
+ # GOP only), and the memory of canvas workers (peak RSS of the process tree) at 1080x1920 and 4K for the worker cap.
5
+ set -uo pipefail
6
+ B=/home/user/bench/engines/mosio; 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
+ rep() { python3 -c 'import json,sys; r=json.load(open(sys.argv[1])); e=r.get("execution",{}); sl=e.get("slices",[]); n=sum(s["to"]-s["from"] for s in sl) or 1; g=lambda k: round(sum(s["in_page_ms"].get(k,0) for s in sl)/n,2); print(json.dumps({"ok":r.get("ok"),"err":(r.get("error") or "")[:300],"enc":(e.get("encode") or {}).get("mode"),"workers":e.get("workers"),"peak_rss_mb":e.get("peak_rss_mb"),"warn":[w["code"] for w in r.get("warnings",[])],"seek":g("seek"),"paint":g("paint"),"frame":g("frame"),"post":g("encode"),"raw_read":g("raw_read"),"raw_queue":g("raw_queue"),"raw_write":g("raw_write"),"wait_ms":round(sum(s.get("transcode_ms",0) for s in sl))}))' "$1" 2>/dev/null; }
11
+ free -m | tee -a "$O/r17.txt"
12
+ timeout 600 "$MOSIO" render "$B/p1" -o "$W/warm.mp4" --workers 8 --no-cache > /dev/null 2>&1
13
+ prep() { rm -rf "/home/user/work/proj-$1"; cp -r "$B/$1" "/home/user/work/proj-$1"; mkdir -p "/home/user/work/proj-$1/assets"; cp -r /home/user/bench/assets/. "/home/user/work/proj-$1/assets/"; }
14
+ run() { # label project workers env...
15
+ local l=$1 p=$2 w=$3; shift 3
16
+ local wa=(); [ "$w" != auto ] && wa=(--workers "$w")
17
+ t0=$(ms); env "$@" MOSIO_CANVAS_PROFILE=1 timeout 900 "$MOSIO" render "/home/user/work/proj-$p" -o "$W/o.mp4" "${wa[@]}" --no-cache --capture canvas > "$W/r.json" 2>/dev/null; t1=$(ms)
18
+ echo "$p $l w=$w wall_ms=$((t1 - t0)) size=$(stat -c %s "$W/o.mp4" 2>/dev/null) $(rep "$W/r.json")" | tee -a "$O/r17.txt"
19
+ }
20
+ prep p1
21
+ run raw p1 8 MOSIO_CANVAS_OUTPUT=raw
22
+ run raw-dry p1 8 MOSIO_CANVAS_OUTPUT=raw MOSIO_CANVAS_RAW_DRY=1
23
+ run raw p1 4 MOSIO_CANVAS_OUTPUT=raw
24
+ run raw p1 1 MOSIO_CANVAS_OUTPUT=raw
25
+ run direct p1 8
26
+ run direct p1 1
27
+ run direct p1 auto
28
+ prep p2k4
29
+ run direct p2k4 1
30
+ run direct p2k4 2
31
+ run direct p2k4 auto
32
+ run direct p2k4 8
33
+ run raw p2k4 1 MOSIO_CANVAS_OUTPUT=raw
34
+ run raw p2k4 auto MOSIO_CANVAS_OUTPUT=raw
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env bash
2
+ # Round 18 (FP_SCRIPT=sandbox18.sh): OpenH264 rate control on the direct path. Does the size follow the bitrate
3
+ # with bitrateMode variable / constant, or the quantizer with bitrateMode quantizer, and what VMAF does each give?
4
+ # (round 16 context: the raw output path (MOSIO_CANVAS_OUTPUT=raw: RGBA posted to the asset origin,
5
+ # encoded once with the output preset) against png and the direct in-page stream. Per project and variant: wall time
6
+ # (2 runs), file size, VMAF / PSNR-Y / SSIM-Y against a lossless screenshot render (crf 0, as render-bench's
7
+ # quality.sh scores), colour tags. Raw variants: getImageData or VideoFrame.copyTo, the default preset (medium crf 18,
8
+ # the png path's) and quicker x264 presets.
9
+ set -uo pipefail
10
+ B=/home/user/bench/engines/mosio; O=/home/user/out; W=/home/user/work; mkdir -p "$O" "$W"
11
+ export MOSIO_HOME=/opt/mosio
12
+ MOSIO=/home/user/mosio-custom
13
+ ms() { python3 -c 'import time;print(int(time.time()*1000))'; }
14
+ MFF=ffmpeg
15
+ if ! ffmpeg -hide_banner -filters 2>/dev/null | grep -q libvmaf; then
16
+ mkdir -p /home/user/work/mff && curl -fsSL https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n8.1-latest-linux64-gpl-8.1.tar.xz | tar xJ -C /home/user/work/mff --strip-components=1
17
+ MFF=/home/user/work/mff/bin/ffmpeg
18
+ fi
19
+ norm="scale=out_range=tv:flags=bicubic+accurate_rnd+full_chroma_int,format=yuv420p,setpts=PTS-STARTPTS"
20
+ score() { # enc ref -> "vmaf=.. vmaf_min=.. psnr_y=.. ssim_y=.."
21
+ "$MFF" -v error -i "$1" -i "$2" -lavfi "[0:v]$norm[a];[1:v]$norm[b];[a]split=3[a1][a2][a3];[b]split=3[b1][b2][b3];[a1][b1]libvmaf=n_threads=8:log_fmt=json:log_path=$W/v.json;[a2][b2]psnr=stats_file=$W/p.log;[a3][b3]ssim=stats_file=$W/s.log" -f null - 2>/dev/null
22
+ python3 - "$W" <<'PY'
23
+ import json, sys, re
24
+ w = sys.argv[1]
25
+ v = [f["metrics"]["vmaf"] for f in json.load(open(f"{w}/v.json"))["frames"]]
26
+ p = [float(re.search(r"psnr_y:([0-9.]+|inf)", l).group(1).replace("inf", "100")) for l in open(f"{w}/p.log")]
27
+ s = [float(re.search(r"Y:([0-9.]+)", l).group(1)) for l in open(f"{w}/s.log")]
28
+ print(f"vmaf={sum(v)/len(v):.2f} vmaf_min={min(v):.2f} psnr_y={sum(p)/len(p):.2f} ssim_y={sum(s)/len(s):.5f}")
29
+ PY
30
+ }
31
+ info() { ffprobe -v error -select_streams v:0 -show_entries stream=color_range,color_transfer,color_space,bit_rate -of csv=p=0 "$1" | tr ',' ' '; }
32
+ rep() { python3 -c 'import json,sys; r=json.load(open(sys.argv[1])); e=r.get("execution",{}); c=e.get("capture",{}); sl=e.get("slices",[]); n=sum(s["to"]-s["from"] for s in sl) or 1; g=lambda k: round(sum(s["in_page_ms"].get(k,0) for s in sl)/n,2); print(json.dumps({"ok":r.get("ok"),"err":(r.get("error") or "")[:300],"enc":(e.get("encode") or {}).get("mode"),"png_scenes":[s["why"][:160] for s in c.get("screenshot_scenes",[])],"seek":g("seek"),"paint":g("paint"),"frame":g("frame"),"post":g("encode"),"held":int(sum(s["in_page_ms"].get("held",0) for s in sl)),"wait_ms":round(sum(s.get("transcode_ms",0) for s in sl))}))' "$1" 2>/dev/null; }
33
+ timeout 600 "$MOSIO" render "$B/p1" -o "$W/warm.mp4" --workers 8 --no-cache > /dev/null 2>&1
34
+ for p in p1 p2; do
35
+ d=/home/user/work/proj-$p
36
+ rm -rf "/home/user/work/proj-$p"; cp -r "$B/$p" "$d"; mkdir -p "$d/assets"; cp -r /home/user/bench/assets/. "$d/assets/"
37
+ python3 - "$d/mosio.json" <<'PY'
38
+ import json, sys
39
+ m = json.load(open(sys.argv[1])); m.setdefault("output", {})["lossless"] = {"codec": "h264", "crf": 0, "preset": "ultrafast", "pix_fmt": "yuv420p", "gop_frames": 60}
40
+ json.dump(m, open(sys.argv[1], "w"), indent=2)
41
+ PY
42
+ timeout 900 "$MOSIO" render "$d" -o "/home/user/work/$p-ref.mp4" --workers 8 --no-cache --preset lossless > /dev/null 2>&1
43
+ vs="default var2M var4M var8M const2M const4M const8M qp20 qp24 qp28 qp32 hint-detail-4M realtime-4M"
44
+ [ $p = p2 ] && vs="default var4M const4M qp24 qp28"
45
+ for v in $vs; do
46
+ case $v in
47
+ default) e=();;
48
+ var*) e=(MOSIO_CANVAS_BITRATE_MODE=variable "MOSIO_CANVAS_BITRATE=${v#var}");;
49
+ const*) e=(MOSIO_CANVAS_BITRATE_MODE=constant "MOSIO_CANVAS_BITRATE=${v#const}");;
50
+ qp*) e=(MOSIO_CANVAS_BITRATE_MODE=quantizer "MOSIO_CANVAS_QP=${v#qp}");;
51
+ hint-detail-4M) e=(MOSIO_CANVAS_CONTENT_HINT=detail MOSIO_CANVAS_BITRATE=4M);;
52
+ realtime-4M) e=(MOSIO_CANVAS_LATENCY=realtime MOSIO_CANVAS_BITRATE=4M);;
53
+ esac
54
+ [ ${#e[@]} -gt 0 ] && e=("${e[@]/%M/000000}") # 4M -> 4000000
55
+ o="/home/user/work/$p-$v.mp4"
56
+ t0=$(ms); env "${e[@]}" timeout 600 "$MOSIO" render "$d" -o "$o" --workers 8 --no-cache --capture canvas > "$W/r.json" 2>/dev/null; t1=$(ms)
57
+ echo "$p $v [${e[*]}] wall_ms=$((t1 - t0)) size=$(stat -c %s "$o" 2>/dev/null) tags=[$(info "$o")] $(score "$o" "/home/user/work/$p-ref.mp4") $(rep "$W/r.json")" | tee -a "$O/r18.txt"
58
+ done
59
+ done
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env bash
2
+ # Round 19 (FP_SCRIPT=sandbox19.sh): the raw output over one WebSocket per slice (round 16-17: one POST per frame
3
+ # cost 180-800 ms a frame inside Chromium). Wall time, size, VMAF, memory, worker sweep; direct worker sweep.
4
+ # (round 16: the raw output path (MOSIO_CANVAS_OUTPUT=raw: RGBA posted to the asset origin,
5
+ # encoded once with the output preset) against png and the direct in-page stream. Per project and variant: wall time
6
+ # (2 runs), file size, VMAF / PSNR-Y / SSIM-Y against a lossless screenshot render (crf 0, as render-bench's
7
+ # quality.sh scores), colour tags. Raw variants: getImageData or VideoFrame.copyTo, the default preset (medium crf 18,
8
+ # the png path's) and quicker x264 presets.
9
+ set -uo pipefail
10
+ B=/home/user/bench/engines/mosio; O=/home/user/out; W=/home/user/work; mkdir -p "$O" "$W"
11
+ export MOSIO_HOME=/opt/mosio
12
+ MOSIO=/home/user/mosio-custom
13
+ ms() { python3 -c 'import time;print(int(time.time()*1000))'; }
14
+ MFF=ffmpeg
15
+ if ! ffmpeg -hide_banner -filters 2>/dev/null | grep -q libvmaf; then
16
+ mkdir -p /home/user/work/mff && curl -fsSL https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n8.1-latest-linux64-gpl-8.1.tar.xz | tar xJ -C /home/user/work/mff --strip-components=1
17
+ MFF=/home/user/work/mff/bin/ffmpeg
18
+ fi
19
+ norm="scale=out_range=tv:flags=bicubic+accurate_rnd+full_chroma_int,format=yuv420p,setpts=PTS-STARTPTS"
20
+ score() { # enc ref -> "vmaf=.. vmaf_min=.. psnr_y=.. ssim_y=.."
21
+ "$MFF" -v error -i "$1" -i "$2" -lavfi "[0:v]$norm[a];[1:v]$norm[b];[a]split=3[a1][a2][a3];[b]split=3[b1][b2][b3];[a1][b1]libvmaf=n_threads=8:log_fmt=json:log_path=$W/v.json;[a2][b2]psnr=stats_file=$W/p.log;[a3][b3]ssim=stats_file=$W/s.log" -f null - 2>/dev/null
22
+ python3 - "$W" <<'PY'
23
+ import json, sys, re
24
+ w = sys.argv[1]
25
+ v = [f["metrics"]["vmaf"] for f in json.load(open(f"{w}/v.json"))["frames"]]
26
+ p = [float(re.search(r"psnr_y:([0-9.]+|inf)", l).group(1).replace("inf", "100")) for l in open(f"{w}/p.log")]
27
+ s = [float(re.search(r"Y:([0-9.]+)", l).group(1)) for l in open(f"{w}/s.log")]
28
+ print(f"vmaf={sum(v)/len(v):.2f} vmaf_min={min(v):.2f} psnr_y={sum(p)/len(p):.2f} ssim_y={sum(s)/len(s):.5f}")
29
+ PY
30
+ }
31
+ info() { ffprobe -v error -select_streams v:0 -show_entries stream=color_range,color_transfer,color_space,bit_rate -of csv=p=0 "$1" | tr ',' ' '; }
32
+ rep() { python3 -c 'import json,sys; r=json.load(open(sys.argv[1])); e=r.get("execution",{}); sl=e.get("slices",[]); n=sum(s["to"]-s["from"] for s in sl) or 1; g=lambda k: round(sum(s["in_page_ms"].get(k,0) for s in sl)/n,2); w=e.get("workers") or {}; print(json.dumps({"ok":r.get("ok"),"err":(r.get("error") or "")[:300],"enc":(e.get("encode") or {}).get("mode"),"n":w.get("n"),"capped":w.get("capped"),"rss":e.get("peak_rss_mb"),"fallback":[s["why"][:120] for s in (e.get("capture") or {}).get("screenshot_scenes",[])],"seek":g("seek"),"paint":g("paint"),"frame":g("frame"),"send":g("encode"),"read":g("raw_read"),"queue":g("raw_queue"),"write":g("raw_write"),"wait_ms":round(sum(s.get("transcode_ms",0) for s in sl))}))' "$1" 2>/dev/null; }
33
+ timeout 600 "$MOSIO" render "$B/p1" -o "$W/warm.mp4" --workers 8 --no-cache > /dev/null 2>&1
34
+ prep() {
35
+ rm -rf "/home/user/work/proj-$1"; cp -r "$B/$1" "/home/user/work/proj-$1"; mkdir -p "/home/user/work/proj-$1/assets"; cp -r /home/user/bench/assets/. "/home/user/work/proj-$1/assets/"
36
+ python3 - "/home/user/work/proj-$1/mosio.json" <<'PY'
37
+ import json, sys
38
+ m = json.load(open(sys.argv[1])); o = m.setdefault("output", {})
39
+ o["lossless"] = {"codec": "h264", "crf": 0, "preset": "ultrafast", "pix_fmt": "yuv420p", "gop_frames": 60}
40
+ o["veryfast18"] = {"codec": "h264", "crf": 18, "preset": "veryfast", "pix_fmt": "yuv420p"}
41
+ json.dump(m, open(sys.argv[1], "w"), indent=2)
42
+ PY
43
+ }
44
+ run() { # label project workers q(0|1: score) env... [-- extra args]
45
+ local l=$1 p=$2 w=$3 q=$4; shift 4
46
+ local ev=() ex=(); while [ $# -gt 0 ]; do [ "$1" = -- ] && { shift; ex=("$@"); break; }; ev+=("$1"); shift; done
47
+ local wa=(); [ "$w" != auto ] && wa=(--workers "$w")
48
+ local o="$W/$p-$l-$w.mp4"
49
+ t0=$(ms); env "${ev[@]}" MOSIO_CANVAS_PROFILE=1 timeout 900 "$MOSIO" render "/home/user/work/proj-$p" -o "$o" "${wa[@]}" --no-cache "${ex[@]}" > "$W/r.json" 2>/dev/null; t1=$(ms)
50
+ local sc=""; [ "$q" = 1 ] && sc=$(score "$o" "/home/user/work/$p-ref.mp4")
51
+ echo "$p $l w=$w wall_ms=$((t1 - t0)) size=$(stat -c %s "$o" 2>/dev/null) tags=[$(info "$o")] $sc $(rep "$W/r.json")" | tee -a "$O/r19.txt"
52
+ }
53
+ for p in p1 p2; do
54
+ prep $p
55
+ timeout 900 "$MOSIO" render "/home/user/work/proj-$p" -o "/home/user/work/$p-ref.mp4" --workers 8 --no-cache --preset lossless > /dev/null 2>&1
56
+ run png $p auto 1
57
+ run raw $p auto 1 MOSIO_CANVAS_OUTPUT=raw -- --capture canvas
58
+ run raw $p auto 0 MOSIO_CANVAS_OUTPUT=raw -- --capture canvas
59
+ run raw-vf18 $p auto 1 MOSIO_CANVAS_OUTPUT=raw -- --capture canvas --preset veryfast18
60
+ run raw-dry $p auto 0 MOSIO_CANVAS_OUTPUT=raw MOSIO_CANVAS_RAW_DRY=1 -- --capture canvas
61
+ run raw-in4 $p auto 0 MOSIO_CANVAS_OUTPUT=raw MOSIO_CANVAS_RAW_INFLIGHT=4 -- --capture canvas
62
+ for w in 1 2 4; do run raw $p $w 0 MOSIO_CANVAS_OUTPUT=raw -- --capture canvas; done
63
+ for w in 1 2 3 4 6 8; do run direct $p $w 0 -- --capture canvas; done
64
+ done
65
+ prep p2k4
66
+ run raw p2k4 auto 0 MOSIO_CANVAS_OUTPUT=raw -- --capture canvas
67
+ run raw p2k4 8 0 MOSIO_CANVAS_OUTPUT=raw -- --capture canvas
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env bash
2
+ # Round 2 (see e2b.mjs: FP_SCRIPT=sandbox2.sh): the x264 variant (canvas pixels -> x264 CRF 18 medium, the final
3
+ # preset) and picture quality measured in RGB, so the full-range WebCodecs stream and the limited-range x264 stream
4
+ # are compared after each is converted with its own range tag.
5
+ set -uo pipefail
6
+ cd /home/user/fp
7
+ B=/home/user/bench/engines/mosio; O=/home/user/out; W=/home/user/work; mkdir -p "$O" "$W" "$O/ssim"
8
+ export BENCH_DIR=/home/user/bench MOSIO_HOME=/opt/mosio
9
+ CH=$(ls -d /opt/mosio/browsers/chrome-headless-shell-*/chrome-headless-shell-linux64/chrome-headless-shell | head -1)
10
+ MOSIO=/usr/local/bin/mosio; [ -x /home/user/mosio-custom ] && MOSIO=/home/user/mosio-custom
11
+ ms() { python3 -c 'import time;print(int(time.time()*1000))'; }
12
+ FRAMES=30 node fp.mjs "$CH" "$B/p1" "$W/warm.mp4" 1 canvas > /dev/null
13
+ for p in p1 p2; do
14
+ for w in 4 8; do
15
+ for mode in canvas x264; do
16
+ t0=$(ms); j=$(node fp.mjs "$CH" "$B/$p" "$W/$p-$mode-w$w.mp4" "$w" "$mode"); t1=$(ms)
17
+ echo "$mode $p w=$w wall_ms=$((t1 - t0)) $j" | cut -c1-600 | tee -a "$O/r2.txt"
18
+ done
19
+ done
20
+ t0=$(ms); j=$(X264_PRESET=veryfast node fp.mjs "$CH" "$B/$p" "$W/$p-x264vf-w8.mp4" 8 x264); t1=$(ms)
21
+ echo "x264-veryfast $p w=8 wall_ms=$((t1 - t0)) $j" | cut -c1-600 | tee -a "$O/r2.txt"
22
+ d="$W/q-$p"; rm -rf "$d"; cp -r "$B/$p" "$d"; mkdir -p "$d/assets"; cp -r /home/user/bench/assets/. "$d/assets/"
23
+ python3 - "$d/mosio.json" <<'PY'
24
+ import json, sys
25
+ m = json.load(open(sys.argv[1])); m["output"]["lossless"] = {"codec": "h264", "crf": 0, "preset": "ultrafast", "pix_fmt": "yuv420p", "gop_frames": 60}
26
+ json.dump(m, open(sys.argv[1], "w"))
27
+ PY
28
+ "$MOSIO" render "$d" -o "$W/$p-ref.mp4" --workers 8 --no-cache --preset lossless > /dev/null 2>&1
29
+ cp -r "$B/$p" "$W/m-$p"; mkdir -p "$W/m-$p/assets"; cp -r /home/user/bench/assets/. "$W/m-$p/assets/"
30
+ "$MOSIO" render "$W/m-$p" -o "$W/$p-mosio.mp4" --workers 8 --no-cache > /dev/null 2>&1
31
+ for v in canvas-w8 x264-w8 x264vf-w8 mosio; do
32
+ [ -f "$W/$p-$v.mp4" ] || continue
33
+ # each side converted to RGB with its own range/matrix tags, then scored
34
+ ffmpeg -v info -i "$W/$p-$v.mp4" -i "$W/$p-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]split[a1][a2];[b]split[b1][b2];[a1][b1]ssim=stats_file=$O/ssim/$p-$v.ssim;[a2][b2]psnr" -f null - > "$W/m.log" 2>&1
35
+ s=$(grep -o 'All:[0-9.]*' "$W/m.log" | tail -1); q=$(grep -o 'average:[0-9.inf]*' "$W/m.log" | tail -1)
36
+ per=$(for n in 1 76 151 300; do awk -v n="n:$n" '$1==n {for(i=1;i<=NF;i++) if ($i ~ /^All:/) print n"="substr($i,5)}' "$O/ssim/$p-$v.ssim"; done | tr '\n' ' ')
37
+ rng=$(ffprobe -v error -show_entries stream=pix_fmt,color_range -of csv=p=0 "$W/$p-$v.mp4" | head -1)
38
+ echo "quality-rgb $p $v ssim_$s psnr_$q bytes=$(stat -c %s "$W/$p-$v.mp4") fmt=$rng frames[$per]" | tee -a "$O/r2.txt"
39
+ done
40
+ done
41
+ echo done
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env bash
2
+ # Round 20 (FP_SCRIPT=sandbox20.sh): page layout regression (compositions without a CSS reset: default body margin,
3
+ # root background, body box; fixtures/gen_layout.py) png vs canvas direct vs canvas raw, SSIM and a frame of each;
4
+ # then the built-in draft (scale 0.5) on the canvas path.
5
+ set -uo pipefail
6
+ B=/home/user/bench/engines/mosio; O=/home/user/out; W=/home/user/work; mkdir -p "$O/frames" "$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
+ ssim() { 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" -f null - 2>&1 | grep -o 'All:[0-9.]*' | tail -1; }
11
+ rep() { python3 -c 'import json,sys; r=json.load(open(sys.argv[1])); e=r.get("execution",{}); w=e.get("workers") or {}; print(json.dumps({"ok":r.get("ok"),"err":(r.get("error") or "")[:300],"enc":(e.get("encode") or {}).get("mode"),"n":w.get("n"),"rss":e.get("peak_rss_mb"),"fallback":[s["why"][:120] for s in (e.get("capture") or {}).get("screenshot_scenes",[])]}))' "$1" 2>/dev/null; }
12
+ timeout 600 "$MOSIO" render "$B/p1" -o "$W/warm.mp4" --workers 8 --no-cache > /dev/null 2>&1
13
+ python3 /home/user/fp/fixtures/gen_layout.py "$W/fx"
14
+ for d in "$W"/fx/*/; do
15
+ n=$(basename "$d")
16
+ timeout 600 "$MOSIO" render "$d" -o "$W/$n-png.mp4" --no-cache > /dev/null 2>&1
17
+ for v in direct raw; do
18
+ e=(); [ $v = raw ] && e=(MOSIO_CANVAS_OUTPUT=raw)
19
+ env "${e[@]}" timeout 600 "$MOSIO" render "$d" -o "$W/$n-$v.mp4" --no-cache --capture canvas > "$W/r.json" 2>/dev/null
20
+ echo "layout $n $v ssim_vs_png=$(ssim "$W/$n-$v.mp4" "$W/$n-png.mp4") $(rep "$W/r.json")" | tee -a "$O/r20.txt"
21
+ done
22
+ for v in png direct raw; do ffmpeg -v error -y -i "$W/$n-$v.mp4" -vf "select=eq(n\,60),scale=540:-1" -frames:v 1 "$O/frames/$n-$v.png"; done
23
+ done
24
+ # draft (built-in preset: scale 0.5) on the canvas path: it must draw (canvas_frames > 0) and match the png draft
25
+ for d in "$W"/fx/l10a-noreset-nobg/ "$W"/fx/l10d-html-and-body-bg/ "$B/p1/"; do
26
+ n=$(basename "$d"); src="$d"
27
+ if [ "$n" = p1 ]; then rm -rf "$W/p1"; cp -r "$B/p1" "$W/p1"; mkdir -p "$W/p1/assets"; cp -r /home/user/bench/assets/. "$W/p1/assets/"; src="$W/p1"; fi
28
+ t0=$(ms); timeout 600 "$MOSIO" render "$src" -o "$W/$n-dpng.mp4" --no-cache --preset draft > /dev/null 2>&1; t1=$(ms)
29
+ t2=$(ms); timeout 600 "$MOSIO" render "$src" -o "$W/$n-dcanvas.mp4" --no-cache --preset draft --capture canvas > "$W/r.json" 2>/dev/null; t3=$(ms)
30
+ cf=$(python3 -c 'import json,sys; c=json.load(open(sys.argv[1]))["execution"]["capture"]; print(c.get("canvas_frames"), c.get("screenshot_frames"))' "$W/r.json" 2>/dev/null)
31
+ echo "draft $n png_ms=$((t1 - t0)) canvas_ms=$((t3 - t2)) canvas/screenshot frames=[$cf] size=$(ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0 "$W/$n-dcanvas.mp4") ssim_vs_png=$(ssim "$W/$n-dcanvas.mp4" "$W/$n-dpng.mp4") $(rep "$W/r.json")" | tee -a "$O/r20.txt"
32
+ ffmpeg -v error -y -i "$W/$n-dcanvas.mp4" -vf "select=eq(n\,60)" -frames:v 1 "$O/frames/draft-$n-canvas.png"
33
+ ffmpeg -v error -y -i "$W/$n-dpng.mp4" -vf "select=eq(n\,60)" -frames:v 1 "$O/frames/draft-$n-png.png"
34
+ done
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env bash
2
+ # Round 21 (FP_SCRIPT=sandbox21.sh): the final binary's gates besides layout (round 20): pixel hashes 1 page vs 8 pages
3
+ # (replay skipped where the runtime allows) on stickman, P1, P2, and every 1-page render finishing (no hang).
4
+ set -uo pipefail
5
+ B=/home/user/bench/engines/mosio; O=/home/user/out; W=/home/user/work; mkdir -p "$O" "$W"
6
+ export MOSIO_HOME=/opt/mosio
7
+ MOSIO=/home/user/mosio-custom
8
+ ms() { python3 -c 'import time;print(int(time.time()*1000))'; }
9
+ cmph() { 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(f"{len(d)} of {len(a)} differ (lengths {len(a)}/{len(b)})", d[:10])' "$1" "$2"; }
10
+ timeout 600 "$MOSIO" render "$B/p1" -o "$W/warm.mp4" --workers 8 --no-cache > /dev/null 2>&1
11
+ for p in ${FP_PROJECTS:-stickman p1 p2}; do
12
+ d=$W/proj-$p
13
+ rm -rf "/home/user/work/proj-$p"
14
+ # stickman: the 450-frame recipe of rounds 6-11 (render-bench's own stickman is a 270-frame variant)
15
+ if [ "$p" = stickman ]; then cp -r /home/user/fp/_local/stickman "$d"
16
+ else cp -r "$B/$p" "$d"; mkdir -p "$d/assets"; cp -r /home/user/bench/assets/. "$d/assets/"; fi
17
+ for w in 1 8; do
18
+ t0=$(ms); MOSIO_CANVAS_HASH=1 timeout 900 "$MOSIO" render "$d" -o "$W/$p-w$w.mp4" --workers $w --no-cache --capture canvas > "$W/r.json" 2>/dev/null; rc=$?; t1=$(ms)
19
+ echo "$p w=$w exit=$rc wall_ms=$((t1 - t0)) $(python3 -c 'import json,sys; r=json.load(open(sys.argv[1])); c=r["execution"]["capture"]; print("ok", r.get("ok"), "canvas_frames", c.get("canvas_frames"), "fallback", [s["why"][:80] for s in c.get("screenshot_scenes",[])])' "$W/r.json" 2>/dev/null)" | tee -a "$O/r21.txt"
20
+ done
21
+ echo "$p hashes w1 vs w8: $(cmph "$W/$p-w1.frames.json" "$W/$p-w8.frames.json")" | tee -a "$O/r21.txt"
22
+ done
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env bash
2
+ # Round 22 (FP_SCRIPT=sandbox22.sh): the draft (scale 0.5) on the canvas path drew the page ~0.7% short vertically
3
+ # (round 20, SSIM 0.94 on the layout fixtures). Three ways to draw it scaled (MOSIO_CANVAS_SCALED_DRAW), SSIM against
4
+ # the png draft, a frame of each, and the page's own sizes (devicePixelRatio, innerHeight, wrapper and canvas height).
5
+ set -uo pipefail
6
+ B=/home/user/bench/engines/mosio; O=/home/user/out; W=/home/user/work; mkdir -p "$O/frames" "$W"
7
+ export MOSIO_HOME=/opt/mosio
8
+ MOSIO=/home/user/mosio-custom
9
+ ssim() { 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" -f null - 2>&1 | grep -o 'All:[0-9.]*' | tail -1; }
10
+ dims() { python3 -c 'import json,sys; s=json.load(open(sys.argv[1]))["execution"]["slices"][0]["in_page_ms"]; print({k:s.get(k) for k in ("dpr","innerH","wrapH","canvasCssH")})' "$1" 2>/dev/null; }
11
+ python3 /home/user/fp/fixtures/gen_layout.py "$W/fx"
12
+ rm -rf "$W/p1"; cp -r "$B/p1" "$W/p1"; mkdir -p "$W/p1/assets"; cp -r /home/user/bench/assets/. "$W/p1/assets/"
13
+ for d in "$W"/fx/l10a-noreset-nobg "$W"/fx/l10d-html-and-body-bg "$W"/fx/l10c-body-flex "$W/p1"; do
14
+ n=$(basename "$d")
15
+ timeout 600 "$MOSIO" render "$d" -o "$W/$n-dpng.mp4" --no-cache --preset draft > /dev/null 2>&1
16
+ ffmpeg -v error -y -i "$W/$n-dpng.mp4" -vf "select=eq(n\,60)" -frames:v 1 "$O/frames/$n-png.png"
17
+ for m in dest plain transform; do
18
+ MOSIO_CANVAS_SCALED_DRAW=$m timeout 600 "$MOSIO" render "$d" -o "$W/$n-$m.mp4" --no-cache --preset draft --capture canvas > "$W/r.json" 2>/dev/null
19
+ echo "$n $m ssim_vs_png=$(ssim "$W/$n-$m.mp4" "$W/$n-dpng.mp4") $(dims "$W/r.json")" | tee -a "$O/r22.txt"
20
+ ffmpeg -v error -y -i "$W/$n-$m.mp4" -vf "select=eq(n\,60)" -frames:v 1 "$O/frames/$n-$m.png"
21
+ done
22
+ done
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env bash
2
+ # Round 23 (FP_SCRIPT=sandbox23.sh): the virtual body (html box + body box, root background propagation) on the layout
3
+ # fixtures l10a-f and render-bench's l12-no-reset: png vs canvas (default output: raw -> x264) SSIM (gate >= 0.99), and l12 under
4
+ # --capture auto (layer D canary: per-scene SSIM before the render).
5
+ set -uo pipefail
6
+ O=/home/user/out; W=/home/user/work; mkdir -p "$O/frames" "$W"
7
+ export MOSIO_HOME=/opt/mosio
8
+ MOSIO=/home/user/mosio-custom
9
+ ssim() { 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" -f null - 2>&1 | grep -o 'All:[0-9.]*' | tail -1; }
10
+ python3 /home/user/fp/fixtures/gen_layout.py "$W/fx"
11
+ cp -r /home/user/fp/fixtures/l12-no-reset "$W/fx/l12-no-reset"
12
+ timeout 600 "$MOSIO" render "$W/fx/l10a-noreset-nobg" -o "$W/warm.mp4" --no-cache > /dev/null 2>&1
13
+ for d in "$W"/fx/*/; do
14
+ n=$(basename "$d")
15
+ timeout 600 "$MOSIO" render "$d" -o "$W/$n-png.mp4" --no-cache > /dev/null 2>&1
16
+ timeout 600 "$MOSIO" render "$d" -o "$W/$n-canvas.mp4" --no-cache --capture canvas > "$W/r.json" 2>/dev/null
17
+ echo "layout $n ssim_vs_png=$(ssim "$W/$n-canvas.mp4" "$W/$n-png.mp4") canvas_frames=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["execution"]["capture"].get("canvas_frames"))' "$W/r.json" 2>/dev/null)" | tee -a "$O/r23.txt"
18
+ for v in png canvas; do ffmpeg -v error -y -i "$W/$n-$v.mp4" -vf "select=eq(n\,60),scale=540:-1" -frames:v 1 "$O/frames/$n-$v.png"; done
19
+ done
20
+ timeout 600 "$MOSIO" render "$W/fx/l12-no-reset" -o "$W/l12-auto.mp4" --no-cache --capture auto > "$W/r.json" 2>/dev/null
21
+ echo "l12 auto canary=$(python3 -c 'import json,sys; c=json.load(open(sys.argv[1]))["execution"]["capture"]; print(json.dumps({"canary":c.get("canary"),"canvas_frames":c.get("canvas_frames"),"fallback":[s["why"][:100] for s in c.get("screenshot_scenes",[])]}))' "$W/r.json" 2>&1)" | tee -a "$O/r23.txt"