iamsly commited on
Commit
9bbd17b
·
verified ·
1 Parent(s): b515032

opensquilla: deepseek-V4-flash/prompt_09_the_last_clause chunk 8/20

Browse files
s_harness_data/opensquilla/deepseek-V4-flash/prompt_09_the_last_clause/build/qa/ep1_44s.png ADDED

Git LFS Details

  • SHA256: 04314660f3f95058cc1949ce5c13a6a3a0d4c6a948123368baf3b986b814e666
  • Pointer size: 132 Bytes
  • Size of remote file: 2.55 MB
s_harness_data/opensquilla/deepseek-V4-flash/prompt_09_the_last_clause/build/qa/ep1_44s2.png ADDED

Git LFS Details

  • SHA256: 04314660f3f95058cc1949ce5c13a6a3a0d4c6a948123368baf3b986b814e666
  • Pointer size: 132 Bytes
  • Size of remote file: 2.55 MB
s_harness_data/opensquilla/deepseek-V4-flash/prompt_09_the_last_clause/build/qa/ep1_80s.jpg ADDED

Git LFS Details

  • SHA256: 20a8a6e0587a55c8aae7c7681f4962c50e0fea8ddb9c4a629fbb0e84a3a2b011
  • Pointer size: 131 Bytes
  • Size of remote file: 181 kB
s_harness_data/opensquilla/deepseek-V4-flash/prompt_09_the_last_clause/build/qa/ep1_8s.jpg ADDED

Git LFS Details

  • SHA256: 2ab0d7d8963fd78da3759f6fb628a1683a8ffebc4b30b41b8e9fcbb9ae7f513b
  • Pointer size: 131 Bytes
  • Size of remote file: 138 kB
s_harness_data/opensquilla/deepseek-V4-flash/prompt_09_the_last_clause/build/render.py ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Render THE NINTH CLAUSE episodes: plates + Ken Burns + audio bed +
3
+ burned subtitles + clue/caption overlays -> 1080x1920 vertical MP4 (5:00).
4
+ """
5
+ import os, subprocess, sys, wave
6
+ import numpy as np
7
+ import audio_engine as AE
8
+ import content as C
9
+
10
+ W, H = 1080, 1920
11
+ FPS = 30
12
+ EP_DUR = 300.0
13
+ BUILD = os.path.dirname(os.path.abspath(__file__))
14
+ WORKSPACE = os.path.dirname(BUILD)
15
+ PLATES = {k: os.path.join(WORKSPACE, v) for k, v in C.PLATES.items()}
16
+ PLATE_TYPE = {"estate": "lake", "boathouse": "lake", "greenhouse": "sprinkler",
17
+ "archive": "strings", "office": "strings", "hearing": "strings",
18
+ "dining": "strings", "clues": "strings"}
19
+ FONT = "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf"
20
+ FONT_REG = "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"
21
+
22
+ SR = AE.SR
23
+
24
+
25
+ def sh(cmd):
26
+ r = subprocess.run(cmd, capture_output=True, text=True)
27
+ if r.returncode != 0:
28
+ sys.stderr.write("CMD FAILED: " + " ".join(cmd) + "\n" + r.stderr[-2000:] + "\n")
29
+ raise RuntimeError("ffmpeg failed")
30
+ return r
31
+
32
+
33
+ def shot_audio_type(plate):
34
+ return PLATE_TYPE.get(plate, "strings")
35
+
36
+
37
+ def build_audio_bed(ep):
38
+ """Return full 300s mono WAV path for an episode, from per-shot cues placed at absolute times."""
39
+ segments = []
40
+ t = 0.0
41
+ # gentle continuous low strings underlay
42
+ segments.append((AE.low_string_chord([82.4, 110, 146.8], EP_DUR, amp=0.045, decay=0.25), 0.0))
43
+ for idx, s in enumerate(ep["shots"]):
44
+ dur = float(s["dur"])
45
+ ptype = shot_audio_type(s["plate"])
46
+ segs = s["sound"] or []
47
+ # base ambience for location-type
48
+ if ptype == "lake":
49
+ segments.append((AE.lake_ambience(dur) * 0.9, t))
50
+ elif ptype == "sprinkler":
51
+ segments.append((AE.sprinklers(dur) * 0.8, t))
52
+ # events
53
+ for c in segs:
54
+ if c == "pen":
55
+ segments.append((AE.pen_scratch(), t + 0.4))
56
+ segments.append((AE.pen_scratch(), t + min(dur - 0.2, 1.4)))
57
+ elif c == "box":
58
+ segments.append((AE.box_thump(), t + 0.3))
59
+ elif c == "mother":
60
+ segments.append((AE.three_note_motif(min(3.4, dur)), t + 0.3))
61
+ elif c == "string_soft":
62
+ segments.append((AE.low_string_chord([110, 164.8, 220], dur, amp=0.10, decay=0.5), t))
63
+ elif c == "string_tense":
64
+ segments.append((AE.low_string_chord([92.5, 110, 138.6, 185], dur, amp=0.13, decay=0.4), t))
65
+ t += dur
66
+ path = os.path.join(BUILD, "audio", f"ep{ep['num']:02d}_bed.wav")
67
+ os.makedirs(os.path.dirname(path), exist_ok=True)
68
+ AE.mix_to_wav(segments, path)
69
+ return path
70
+
71
+
72
+ def build_srt(ep):
73
+ """Full episode SRT with absolute timings; word budgets per line."""
74
+ lines = []
75
+ idx = 1
76
+ t = 0.0
77
+ for s in ep["shots"]:
78
+ dur = float(s["dur"])
79
+ sub = s.get("sub")
80
+ if sub:
81
+ speaker, line = sub
82
+ # display label for known speakers
83
+ label = {"AVA": "AVA", "HELENA": "HELENA", "MARCUS": "MARCUS",
84
+ "LILY": "LILY", "SAMUEL": "SAMUEL", "EVAN": "EVAN",
85
+ "ROSA": "ROSA", "ROSA N": "ROSA", "NARR": "NARRATOR",
86
+ "THOMASV": "THOMAS (RECORDED)"}.get(speaker, speaker)
87
+ start = t + 0.5
88
+ dur_s = min(dur - 0.6, max(2.2, 0.5 + len(line) * 0.055))
89
+ end = min(t + dur_s + 0.55, t + dur - 0.1)
90
+ if label in ("NARRATOR", "THOMAS (RECORDED)"):
91
+ text = f"{label}\n{line}"
92
+ else:
93
+ text = f"{label}: {line}"
94
+ lines.append(f"{idx}\n{fmt_ts(start)} --> {fmt_ts(end)}\n{text}\n")
95
+ idx += 1
96
+ t += dur
97
+ path = os.path.join(BUILD, "audio", f"ep{ep['num']:02d}.srt")
98
+ os.makedirs(os.path.dirname(path), exist_ok=True)
99
+ with open(path, "w") as f:
100
+ f.write("\n".join(lines))
101
+ return path
102
+
103
+
104
+ def fmt_ts(sec):
105
+ h = int(sec // 3600); m = int((sec % 3600) // 60); s = int(sec % 60); ms = int((sec - int(sec)) * 1000)
106
+ return f"{h:02d}:{m:02d}:{s:02d},{ms:03d}"
107
+
108
+
109
+ def render_shot(shot, t_start, outpath):
110
+ """Render one shot to an intermediate clip (video only, no subs yet)."""
111
+ dur = float(shot["dur"])
112
+ plate = PLATES[shot["plate"]]
113
+ motion = shot.get("motion", "in")
114
+ # zoompan: 'in' zoom in, 'out' zoom out, directional pans
115
+ if motion in ("in",):
116
+ zexpr = "min(zoom+0.0006,1.18)"
117
+ x = "iw/2-(iw/zoom/2)"; y = "ih/2-(ih/zoom/2)"
118
+ elif motion == "out":
119
+ zexpr = "if(eq(on,1),1.18,max(zoom-0.0006,1.0))"
120
+ x = "iw/2-(iw/zoom/2)"; y = "ih/2-(ih/zoom/2)"
121
+ elif motion in ("left","right"):
122
+ zexpr = "1.14"
123
+ x = "if(lte(on,1),iw/2-(iw/zoom/2)-{dx},{px}+{dz})".format(dx=60, px="iw/2-(iw/zoom/2)-", dz="60/30") if motion=="right" else "if(lte(on,1),iw/2-(iw/zoom/2)+{dx},{px}-{dz})".format(dx=60, px="iw/2-(iw/zoom/2)+", dz="60/30")
124
+ y = "ih/2-(ih/zoom/2)"
125
+ elif motion in ("up","down"):
126
+ zexpr = "1.14"
127
+ x = "iw/2-(iw/zoom/2)"
128
+ y = "if(eq(on,1),ih/2-(ih/zoom/2)-{dy},{py}+{dz})".format(dy=90, py="ih/2-(ih/zoom/2)-", dz="90/30") if motion=="down" else "if(eq(on,1),ih/2-(ih/zoom/2)+{dy},{py}-{dz})".format(dy=90, py="ih/2-(ih/zoom/2)+", dz="90/30")
129
+ else:
130
+ zexpr = "1.0"; x = "iw/2-(iw/zoom/2)"; y = "ih/2-(ih/zoom/2)"
131
+ frames = int(round(dur * FPS))
132
+ vf = f"scale=2700:4800,zoompan=z='{zexpr}':x='{x}':y='{y}':d={frames}:s={W}x{H}:fps={FPS}"
133
+ caps = []
134
+ if shot.get("caption"):
135
+ cap = str(shot["caption"])
136
+ caps.append(f"drawtext=fontfile={FONT}:text='{esc(cap)}':fontcolor=white:fontsize=44:"
137
+ f"x=(w-text_w)/2:y=h-260:shadowcolor=black@0.9:shadowx=3:shadowy=3:"
138
+ f"box=1:boxcolor=black@0.45:boxborderw=14")
139
+ if shot.get("clue"):
140
+ cl = shot["clue"]; title = str(cl["title"]); body = str(cl["body"])
141
+ # overlay panel near top
142
+ caps.append(_clue_overlay(title, body))
143
+ if caps:
144
+ vf += "," + ",".join(caps)
145
+ cmd = ["ffmpeg", "-y", "-loglevel", "error", "-i", plate, "-vf", vf,
146
+ "-frames:v", str(frames), "-r", str(FPS), "-c:v", "libx264",
147
+ "-preset", "veryfast", "-crf", "27", "-an", outpath]
148
+ sh(cmd)
149
+
150
+
151
+ def _clue_overlay(title, body):
152
+ """Return a drawtext filter (or two) rendering a document-style caption panel."""
153
+ body_esc = esc(body)
154
+ # Multi-line via drawtext not trivial; use a single drawtext with escaped newline \n
155
+ title_esc = esc(title)
156
+ filters = []
157
+ # title bar
158
+ filters.append(f"drawtext=fontfile={FONT}:text='{title_esc}':fontcolor=0xFFD98C:fontsize=40:"
159
+ f"x=(w-text_w)/2:y=150:box=1:boxcolor=black@0.6:boxborderw=16:shadowcolor=black@0.8:shadowx=2:shadowy=2")
160
+ # body — split into up to 3 lines manually
161
+ parts = body.split("\n")
162
+ line_h = 54
163
+ for i, ln in enumerate(parts[:4]):
164
+ filters.append(f"drawtext=fontfile={FONT_REG}:text='{esc(ln)}':fontcolor=white:fontsize=34:"
165
+ f"x=(w-text_w)/2:y={205 + i * line_h}:box=1:boxcolor=black@0.55:boxborderw=14"
166
+ f":shadowcolor=black@0.8:shadowx=2:shadowy=2")
167
+ return ",".join(filters)
168
+
169
+
170
+ def esc(t):
171
+ return t.replace("\\", "\\\\").replace("'", "\u2019").replace("\u2018", "\u2019").replace(":", "\\:").replace("%", "\\%")
172
+
173
+
174
+ def build_episode(n):
175
+ ep = C.EPISODES[n - 1]
176
+ # Normalize shot durations so the episode is exactly EP_DUR seconds,
177
+ # preserving the relative beat structure.
178
+ cur = sum(float(s["dur"]) for s in ep["shots"])
179
+ scale = EP_DUR / cur
180
+ for s in ep["shots"]:
181
+ s["dur"] = float(s["dur"]) * scale
182
+ outdir = os.path.join(WORKSPACE, "episodes")
183
+ os.makedirs(outdir, exist_ok=True)
184
+ # validate total duration
185
+ tot = sum(float(s["dur"]) for s in ep["shots"])
186
+ print(f"EP{n} shot-total={tot:.2f}s", flush=True)
187
+ if abs(tot - EP_DUR) > 0.6:
188
+ raise RuntimeError(f"EP{n} duration {tot} != {EP_DUR}")
189
+ wordcount = sum(len(s["sub"][1].split()) for s in ep["shots"] if s.get("sub"))
190
+ print(f" words={wordcount}", flush=True)
191
+
192
+ # 1) audio bed + srt
193
+ bed = build_audio_bed(ep)
194
+ srt = build_srt(ep)
195
+
196
+ # 2) render each shot clip
197
+ clipdir = os.path.join(BUILD, "render", f"ep{n:02d}")
198
+ os.makedirs(clipdir, exist_ok=True)
199
+ clips = []
200
+ t = 0.0
201
+ for i, s in enumerate(ep["shots"]):
202
+ cp = os.path.join(clipdir, f"shot{i:02d}.mp4")
203
+ render_shot(s, t, cp)
204
+ clips.append(cp)
205
+ t += float(s["dur"])
206
+
207
+ # 3) concat video (no audio yet)
208
+ lst = os.path.join(clipdir, "list.txt")
209
+ with open(lst, "w") as f:
210
+ for cp in clips:
211
+ f.write(f"file '{cp}'\n")
212
+ vid = os.path.join(clipdir, "video_silent.mp4")
213
+ sh(["ffmpeg", "-y", "-loglevel", "error", "-f", "concat", "-safe", "0", "-i", lst,
214
+ "-c", "copy", vid])
215
+
216
+ # 4) final mux: burn subs + add audio
217
+ final = os.path.join(outdir, f"THE_NINTH_CLAUSE_E{ep['num']:02d}.mp4")
218
+ srt_ff = srt.replace(":", "\\:")
219
+ vf = f"subtitles={srt_ff}:force_style='FontName=DejaVu Sans,FontSize=30,PrimaryColour=&H00FFFFFF,Outline=2,Shadow=1,MarginV=170'"
220
+ sh(["ffmpeg", "-y", "-loglevel", "error", "-i", vid, "-i", bed,
221
+ "-vf", vf, "-c:v", "libx264", "-preset", "veryfast", "-crf", "26",
222
+ "-c:a", "aac", "-b:a", "160k", "-shortest", final])
223
+ return final
224
+
225
+
226
+ if __name__ == "__main__":
227
+ which = sys.argv[1] if len(sys.argv) > 1 else "1"
228
+ if which == "all":
229
+ files = [build_episode(n) for n in range(1, 7)]
230
+ for f in files:
231
+ print("DONE", f)
232
+ else:
233
+ f = build_episode(int(which))
234
+ print("DONE", f)
s_harness_data/opensquilla/deepseek-V4-flash/prompt_09_the_last_clause/build/render/ep01/list.txt ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot00.mp4'
2
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot01.mp4'
3
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot02.mp4'
4
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot03.mp4'
5
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot04.mp4'
6
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot05.mp4'
7
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot06.mp4'
8
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot07.mp4'
9
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot08.mp4'
10
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot09.mp4'
11
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot10.mp4'
12
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot11.mp4'
13
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot12.mp4'
14
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot13.mp4'
15
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot14.mp4'
16
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot15.mp4'
17
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot16.mp4'
18
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot17.mp4'
19
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot18.mp4'
20
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot19.mp4'
21
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot20.mp4'
22
+ file '/data2/handoff_runs/hd_sys01_open_deepseekv4flash073_08241758/scratch/osq_sample_ylbk0f0o/workspace/build/render/ep01/shot21.mp4'
s_harness_data/opensquilla/deepseek-V4-flash/prompt_09_the_last_clause/build/render/ep01/shot00.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0c35cae628c34f3711690ceb15dd91aa03b1813537dd83c6a3c7931055022573
3
+ size 671077
s_harness_data/opensquilla/deepseek-V4-flash/prompt_09_the_last_clause/build/render/ep01/shot01.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8e03ef3b61e07b00c5463f8abf64c06445287161119eb53a35ee9652dd05ec66
3
+ size 1082900
s_harness_data/opensquilla/deepseek-V4-flash/prompt_09_the_last_clause/build/render/ep01/shot02.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0e3eb15207514ffe63a5f0d59f70d2c7f027dc2bda8889563033a8fc8d745f34
3
+ size 387004
s_harness_data/opensquilla/deepseek-V4-flash/prompt_09_the_last_clause/build/render/ep01/shot03.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8b274011ba369a10de1a98852b20e41af95db149f601f97f2b7fb28e6c3b8913
3
+ size 380675
s_harness_data/opensquilla/deepseek-V4-flash/prompt_09_the_last_clause/build/render/ep01/shot04.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b7744167b90073a6f178280383b118ef853273b72794d9d0bf53f56ac807b7bc
3
+ size 599656
s_harness_data/opensquilla/deepseek-V4-flash/prompt_09_the_last_clause/build/render/ep01/shot05.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c5de1c2b4534136d5c5693267b911f08fe85579070cfaa97bd621b225926a338
3
+ size 651424