Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 4eab95ea80fb18bc9e47115fb164ca2c76f75e63
parent 9ae432d440e35a18fdef9b70fb4172fd481c8e93
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu,  5 Nov 2026 12:07:43 -0500

umtool: a picture-only post keeps its picture as context, and a picture-only video speaks through its beat

Carried as context -- the post the item before ended on (a carried parent, drawn as that item drew it) or one the
run keeps on top (a scene tile: sceneRefOf carries pictureOnly and its media) -- a picture-only post keeps its
picture in its card as a text post keeps its words, shrunk and dimmed with it, its own attachment censored by its
channel's markup; never in the slot, no beat again. The join's page draws the item before with its picture too.

A picture-only VIDEO WITH ITS SOUND speaks through its beat (plan.pics `sound`): its sound mixed after the read's
mix (never ducked), unlevelled and faded as an attachment's; its picture in step; Play unmutes the card's video on
its clock through the beat. Its beat is its whole length up to render.posts.pictureReply.maxSound (8 s); a GIF or a
silent video keeps 1.5-4 s. `umtool posts picture-reply <p> [on= image= min= max= maxSound=] [--in-take <t>]` sets
the cut's rule (updatePostPictureReplyRender). A GIF's or a video's still is its span's middle frame (a clip's first
is often empty); POST_PICTURE_DRAW_V 2.

(operator, 5 Nov, mid-16: "keeping the millenial woes tweet persistent like text rather than removing it would be
better"; the "It's time to stop" meme from its original upload "since this has sound")

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Meditor/CHANGELOG.md | 2++
Mumtool/components/projects/review/PostItemPlayer.tsx | 28+++++++++++++++++++++++++++-
Mumtool/docs/cli.md | 1+
Mumtool/docs/knobs.md | 10++++++++--
Mumtool/docs/report-video.md | 10++++++++--
Mumtool/e2e/picture-replies.spec.ts | 40+++++++++++++++++++++++++++++++++++++++-
Mumtool/lib/report/manifest.mjs | 31+++++++++++++++++++++++++++++++
Mumtool/lib/report/postsCli.mjs | 45+++++++++++++++++++++++++++++++++++++++++++--
Mumtool/report-to-video/package.json | 1+
Mumtool/report-to-video/post-conversation.mjs | 11++++++++---
Mumtool/report-to-video/post-item.mjs | 43+++++++++++++++++++++++++++++++++++--------
Mumtool/report-to-video/post-picture.mjs | 25+++++++++++++++++--------
Mumtool/report-to-video/post-picture.test.mjs | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
Mumtool/report-to-video/post-render.mjs | 50+++++++++++++++++++++++++++++++++++++-------------
14 files changed, 328 insertions(+), 42 deletions(-)

diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## [Unreleased] +- **A reply that is only a video with sound now plays its sound, and plays to its end.** A picture-only reply whose attachment is a video with audio (the "It's time to stop" meme from its original upload) used to play silent, cut to 4 s. Now its sound plays through its beat before the reply is read, mixed like any attachment's sound and never ducked under the read. The beat lasts the whole clip, up to 8 s. Play unmutes it on its own clock during the beat. A GIF stays silent, and the same post carried up as context shows a still with no sound. The cut's picture-only rule now has a command: `umtool posts picture-reply <p> [on=] [image=] [min=] [max=] [maxSound=] [--in-take <take>]`. +- **A reply that is only a picture keeps its picture when it is carried up as context.** When the next post of a thread answered Kirsche's picture-only reply, her card was carried up above it with only her name and a lone "@ObviousRises" line: the Millennial Woes screenshot it was made of vanished (operator, 5 Nov, mid-16: "keeping the millenial woes tweet persistent like text rather than removing it would be better"). A picture-only post carried in from the item before, or kept on top by the next post of its run, now keeps its picture in its card, shrunk and dimmed with it the way a text post keeps its words. A GIF or a video shows as a still from the middle of its clip, the channel's censor markup still applies, it never moves beside the card, and it gets no second beat. Item lengths are unchanged, and posts that are not picture-only render exactly as before. - **umtool: the post bench's attachment lanes are back on the take-only bench, and a GIF has one.** On `?inTake=<t>` (the only bench of an item a take carries and the cut does not) the bench showed a note where the lanes were, so a video's in and out could only be typed; and the lane covered the first video only. Now every video and GIF of the item has a lane under the player: its whole length as a waveform (a flat line for a GIF or a silent video, which still drags), the in and out as its two handles (never closer than 0.5 s, never past the file), the part the item plays dashed and the playhead, with the bench's clock following a moving edge so the player shows its frame. A handle moves the same draft the **in / out** fields do (they follow at once, as the plan's seconds do) and **Save** writes it -- into the take's patch on a take-only bench, the project's manifest untouched; focused, `[ ]` and `, .` nudge the in and out (Shift coarser) and `← →` the edge last moved. The read's lane (its lead dragged) and **Re-pick best** write the take there too (`/api/report/post-narration` takes `inTake` for set and fit); recording, re-takes and the mix stay on the cut's bench. umtool/docs/knobs.md. - **A reply that is only a picture is drawn as its message, and a long post on a card alone keeps large text.** A post whose words are only @mentions and links with an attachment (an "@ObviousRises" and a GIF, a reply that is a screenshot of another post) is now picture-only in a report video: its picture is drawn inside its own card where its words would be, at the card's width, with the mention drawn small as a reply-to line, never in the side slot. The GIF that showed beside Mr. Obvious's reply while he was being read now has its own beat first: shown alone in its card for its own length (an image for 2 s, between 1.5 and 4 s), then the read. The read's start moves and the take is not re-made, so word zooms, captions, slams and beeps stay on their words. The render plays the GIF over its place in the card, Play plays it in the card, and the post bench has a **picture-only** block with an auto, on or off setting for the item and for each post it answers or quotes (`umtool posts set-item <p> <item> pictureOnly=on|off|auto`, `parent.<i>.pictureOnly=`, `quoted.pictureOnly=`). `render.posts.pictureReply` sets the beat's length or turns the rule off. A long post on a card alone is now drawn at a reading size and scrolled with the read, where it used to shrink to read-follow's minimum to fit (operator, 5 Nov: "bigger text for the novel"). Posts that are not picture-only, and posts whose words fit their card, render exactly as before. - **umtool: a pause can be put in after words of an approved read, without reading it again.** A countdown read as "20 10 4 0" in one breath could only be spaced by synthesizing a new read, losing a delivery that was liked. `umtool posts reread <p> <item> --pause "20=0.45,10=0.45,4=0.45"` now cuts the picked take just after each word named (found in its word timings as a word zoom finds one: case and punctuation aside, `#2` its second time, `--target linked:0` one piece's words) and puts that much silence in (0.05–3 s), moving everything after it on -- its words, its parts and its length, so zooms, captions, slams, beeps and the read-follow stay on their words. It is a new take, picked in one undoable write; on a paused take it re-cuts from the take before (`=0` takes a pause away), `--dry-run` shows each cut and the new length, `--in-take <t>` puts it in a take's read, and a take with no word timings is refused naming `umtool posts narrate <p> <item> --words`. The post bench's Options → Re-join the read has **pause after** with Preview and Apply, on the take-only bench too. umtool/docs/cli.md, knobs.md. diff --git a/umtool/components/projects/review/PostItemPlayer.tsx b/umtool/components/projects/review/PostItemPlayer.tsx @@ -134,7 +134,7 @@ export type PanelShow = { scope: string; media: Array<Record<string, unknown> & export type PostPlan = { panel?: { fade: number; shows: PanelShow[] }; /** PICTURE-ONLY posts (post-picture.mjs): each picture drawn in its own card (Play: the card's page plays it). */ - pics?: Array<{ scope: string; media: PanelShow["media"] }>; + pics?: Array<{ scope: string; media: PanelShow["media"]; sound?: { t0: number; t1: number } }>; /** Its own attachments come in at this item second, with his own post (post-item.mjs ownMediaEnterAt). */ enter?: number; reading: number; @@ -943,6 +943,31 @@ export default function PostItemPlayer({ // The item changed under a loaded page (a knob, a zoom added): measure again. onFrameLoad(); }, [onFrameLoad]); + // A PICTURE-ONLY post's video SPEAKING through its beat (post-picture.mjs, plan.pics' `sound`): the card's own video + // unmuted and on Play's clock while the beat plays; muted (looping, as the card draws it) the rest of the time. + const picSound = (plan.pics ?? []).find((p) => p.sound && s >= p.sound.t0 && s < p.sound.t1) ?? null; + useEffect(() => { + const doc = readFrame.current?.contentDocument; + if (!doc) return; + for (const p of plan.pics ?? []) { + if (!p.sound) continue; + const v = doc.querySelector(`[data-post-pic="${p.scope}"] video`) as HTMLVideoElement | null; + if (!v) continue; + const on = picSound === p && playing; + if (on) { + const start = typeof p.media[0]?.start === "number" ? (p.media[0].start as number) : 0; + const want = start + (s - p.sound.t0); + if (Math.abs(v.currentTime - want) > DRIFT * Math.max(1, speed)) v.currentTime = want; + setRate(v, speed); + v.loop = false; + v.muted = false; + if (v.paused) void v.play().catch(() => {}); + } else if (!v.muted) { + v.muted = true; + v.loop = true; + } + } + }, [picSound, playing, s, speed, plan.pics]); const live = zooms.find((z) => s >= z.span.t0 && s < z.span.t3) ?? null; const zf = live ? zoomAt(live.span, zoomProgressAt(live.span, s)) : 1; const hl = live ? highlightAt(live.span, s) : 0; @@ -1116,6 +1141,7 @@ export default function PostItemPlayer({ data-post-panel={layout.panel ?? undefined} data-post-pics={plan.pics?.length ? plan.pics.map((p) => p.scope).join(" ") : undefined} data-post-beat={beatNow ? beatNow.scope : undefined} + data-post-pic-sound={picSound ? picSound.scope : undefined} data-post-join={joinOn ? (jp !== null ? String(Math.round(jp * 100) / 100) : "done") : undefined} data-post-step={reading ? "read" : current?.kind ?? "held"} data-post-s={String(Math.round(s * 100) / 100)} diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md @@ -109,6 +109,7 @@ Inbox cannot disagree about what is wrong with one. | `posts redact <project> ls \| add "<term>" [--substring] [--note "…"] \| remove <n> [--json]` | **REDACTED WORDS** ([knobs.md](knobs.md#redacted-words-blanked-from-what-is-published)): the project's list (`render.posts.redact`, `updatePostRedact`) of words or phrases blanked from everything the cut publishes -- a solid bar on the rendered card, left out of a synthesized read, a post's chapter line and an attachment's captions; matched without case, as whole words (`--substring`: inside words too), a phrase across any spaces or punctuation. The posts' words and the scripts are never rewritten. `ls` numbers the terms as `remove` takes them, and counts the corpus's (`transcripts/redactions.json`) and the posts marked up in the cut's channels (`posts-markup.json`). A term already listed is refused (**exit 1**) | | `posts slurs <project> [ls] \| on \| off \| level strong\|all \| visual blackout\|placeholder \| voice skip\|beep\|placeholder \| add <word> \| except <word> \| remove <word> [--json]` | **THE SLUR FILTER** ([knobs.md](knobs.md#the-slur-filter-slurs-masked-in-what-is-published-off-for-the-uncensored-cut)): `render.posts.slurs` (`updatePostSlurs`, one undo point each), on by default -- the slurs of the shipped list (`report-to-video/slurs.json`; `level strong`: only the strong ones) and the project's own (`add`; `except` never masks one) masked in everything the cut publishes: a dark pill with its mask (`visual placeholder`, the default, "f*****") or a bar (`blackout`) on the card; said and beeped by the take's word timings (`voice beep`, the default), left out of a synthesized read (`skip`), or its stand-in said (`placeholder`). `ls` counts what the cut masks per slur and per post -- masks only, never the word -- and names each narrated post whose take says one with no word timings (a censored build refuses it; `posts narrate <p> <item> --words`). `off` is the uncensored cut (the redaction stays). A word already on a list, or on neither for `remove`, is refused (**exit 1**); an unknown verb or value (**exit 2**) | | `posts context <project> [--dry-run] [--json]` | every **post item's context from its capture** (`postContext.mjs`): the post it quotes and the post it answers, as its page showed them (`capture.json`'s `context`, read by the editor's `capture-posts` -- `"contextOnly": true` reads it alone), filled where the archive row lacks them -- `quoted` where the entry has none (or a named one with no words, the same post), `parents` where it has none (a thread shot stays on the entry; the card draws the parents). An x.com/twitter.com **status link** in its words (or its row's links) is a quote: the post it names, from any channel's archive, fills `quoted` (`via: "link"`) when it has none; the row's `threadId` is snapshotted as the item's `conversation` (the thread walk reads it). What the archive gave is never replaced. ONE write for every entry (`setPostItemsContext`: one undo point, refused whole in the build's words); a re-run with nothing new writes nothing. A post whose capture read no context is listed with the call that reads it (`pnpm ops capture-posts --json '{"slug":…,"ids":[…],"contextOnly":true}' --wait`). The card's blur of other authors is unchanged ([report-video.md](report-video.md#post-items-a-post-as-an-entry-of-the-cut)) | +| `posts picture-reply <project> [on=on\|off] [image=<s>] [min=<s>] [max=<s>] [maxSound=<s>] [--in-take <take>] [--json]` | the cut's **PICTURE-ONLY RULE** ([knobs.md](knobs.md#picture-only-posts-a-reply-that-is-its-picture)): `render.posts.pictureReply` (`updatePostPictureReplyRender`, one undo point) -- `on` the rule at all; a beat's length: an image `image` s (2), a GIF's or a silent video's own length clamped to `min`–`max` (1.5–4 s), a video with its sound its whole length up to `maxSound` (8 s). `k=` the default again; none: the rule as it stands. `--in-take` writes it into a take's patch. Refused in the build's words (**exit 1**) | | `posts repeats <project> [--match id\|file\|audio] [--json]` | the **combo counter**'s repeats ([report-video.md](report-video.md#the-combo-counter)): every attachment the cut's post items play more than once -- the same X media id (the capture's url), else the same file (the capture's sha256 when its bytes agree, else hashed; cached by path, size and mtime), else (`--match audio`) the same sound (fpcalc, else a coarse ffmpeg hash) -- its posts in the cut's ORDER with their dates, the tier that matched and the badge each draws (`×2` from the second use, `(×n)` counted but not drawn); a post whose CAPTURE holds the same file but whose entry carries no attachment is listed too, `NOT ATTACHED`, with the `posts attach` that brings it in. Reads only | | `posts attach <project> [<item> … \| --all] [--dry-run] [--json]` | a post item with **no attachment whose capture holds one** (captured after it went in -- `posts repeats` marks them `NOT ATTACHED`): the capture's media (its own channel's `posts-media/<postId>/`, else any channel the cut's posts come from) copied into the project's `posts-media/<slug>/<postId>/` and measured, set as the entry's `media` as `posts reel` would have made it -- nothing else of the entry changes (its paraphrases, narration, knobs kept); an item that has an attachment is never touched. ONE write (one undo point: `timeline <p> undo`), refused whole in the build's words | | `posts combo <project> [on=on\|off] [label=L] [position=top-right\|top-left\|bottom-right\|bottom-left\|center] [color=#rrggbb] [scale=0.4-2.5] [sfx=off\|hit\|coin] [minCount=2-20] [match=id\|file\|audio] [--json]` · `posts combo <project> <item> off\|on\|auto\|label=…\|position=…\|color=…\|scale=…\|sfx=… [--json]` | the **combo badge's knobs** ([knobs.md](knobs.md#the-combo-counter)): the cut's (`render.posts.combo`, `updatePostComboRender`; no knobs prints them; `k=` the default again) or one post item's (`combo`, `updatePostCombo`): `off` draws no badge on it -- it still counts -- `on`/`auto` the cut's again. Refused in the build's words (**exit 1**) | diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -999,13 +999,19 @@ at full size and still (`<id>.post.json`'s notes say when); Play plays it in the block says which of the item's posts are and sets the knob. A picture-only post standing BETWEEN two read pieces has no beat (it is drawn in its card and gives way with the piece after it). The rule's beat is part of the item's length everywhere (the schedule, the bench, Play, the build); a parent carried in from the item before (`thread.carry`) is that -item's, and has none. +item's, and has none. AS CONTEXT -- carried in from the item before, or kept on top by the next item of its run (a +scene tile, `post-conversation.mjs sceneRefOf`: `pictureOnly`, `media`) -- a picture-only post keeps its picture in its +card as a text post keeps its words, shrunk and dimmed with it (a GIF or a video as its still), its own attachment +censored by its channel's markup; never in the slot, and never a beat again. A picture-only VIDEO WITH ITS SOUND (a +video not `audio: false`, not `mute`) SPEAKS through its beat: its sound mixed after the read's mix (never ducked: the +beat is before the read), unlevelled and faded as an item's own attachment's sound is, its picture in step; Play plays +the card's video unmuted on its clock through the beat. A GIF stays silent; carried as context it is a still, silent. | Knob | In umtool | From a terminal | Route | |---|---|---|---| | `pictureOnly` on a post item -- `true`: picture-only (it needs an attachment) · `false`: never · absent: the rule (its words only @mentions and links, and an attachment) | post bench, **picture-only**: his post's row (auto / picture-only / not) | `umtool posts set-item <p> <item> pictureOnly=on` (`off`, `auto`) | `POST /api/report/post-item {project, op: "set", id, patch: {pictureOnly: true \| false \| null}, token}` | | `parents[i].pictureOnly`, `quoted.pictureOnly` -- the same for a context post | post bench, **picture-only**: its row | `umtool posts set-item <p> <item> parent.0.pictureOnly=on` · `quoted.pictureOnly=off` (`auto`) | same, `patch: {parents: {"0": {pictureOnly}}, quoted: {pictureOnly}}` | -| `render.posts.pictureReply` -- the cut's rule: `{on, image, min, max}` (default `on: true`; a beat is a GIF's or a video's own length, an image `image` = 2 s, clamped to `min`–`max` = 1.5–4 s); `on: false` turns the rule off (a post's own `pictureOnly: true` still wins) | — | (the manifest) | — | +| `render.posts.pictureReply` -- the cut's rule: `{on, image, min, max, maxSound}` (default `on: true`; a beat is a GIF's or a silent video's own length, an image `image` = 2 s, clamped to `min`–`max` = 1.5–4 s; a VIDEO WITH ITS SOUND its whole length up to `maxSound` = 8 s); `on: false` turns the rule off (a post's own `pictureOnly: true` still wins) | — | `umtool posts picture-reply <p> on=off` · `maxSound=10 max=5` (`k=` the default) · `--in-take <take>` | — | A LONG READ on a card alone (no attachment, or a picture-only one in the card): words that do not fit the card at any size are drawn at a reading size (`POST_LONG_READ_SIZE`, 36 px of a 1080 frame) and panned by read-follow -- never diff --git a/umtool/docs/report-video.md b/umtool/docs/report-video.md @@ -1306,17 +1306,23 @@ it (`isPictureOnly`: the post's own `pictureOnly`, else the rule) and the card d - **in its own card**: its first attachment where its words would be, at the card's (or the tile's) width, its aspect and crop kept, at most about 60 % of the card tall ("+N" when it carries more); its mention-only words drawn small, as X's reply-to line. Never in the side slot (`slotMediaOf`, `panelSchedule` skip it), so never beside another post's - read. An image is drawn by the page (a censored one blurred whole); a GIF's or a video's first frame is the page's + read. An image is drawn by the page (a censored one blurred whole); a GIF's or a video's middle frame is the page's still, and the build lays the file over that place, looped and silent, wherever the card is at full size and still (`measurePics`, from the frames read-follow shoots), fading back to the still as the card moves on; - **its own beat** (`post-thread.mjs pictureBeats`): a picture-only parent or quoted post the read does not read, standing before the read's first piece, is a piece of its own -- revealed, lit and shown alone (a GIF's or a video's - own length, an image 2 s, clamped to 1.5–4 s: `render.posts.pictureReply`), shrinking as the read comes in. The read + own length, an image 2 s, clamped to 1.5–4 s; a video with its sound its whole length up to 8 s, and its sound plays + through the beat: `render.posts.pictureReply`), shrinking as the read comes in. The read is never re-made: postItemPlan moves its START by the beats (as it does for a join), so every word zoom, caption, slam and beep stays on its word; the item is the beats longer; his own attachment enters with his words; - **an item** that is picture-only has no slot (a card alone, its picture in it); not narrated, it lasts its beat; narrated (a read of the words on the picture), the read's length, as any item. +- **as context**: carried in from the item before (a parent drawn as that item drew it), or kept on top by the next item + of its run (a scene tile: `sceneRefOf` carries `pictureOnly` and its `media`), it keeps its picture in its card, + shrunk and dimmed with it -- a GIF or a video as its still (`plan.pics` names the tile: the build draws the still and + plays the GIF only where the tile is at full size) -- its own attachment censored by its channel's markup; no beat again. + One standing between two read pieces has no beat (drawn in its card, it gives way with the piece after it); a parent carried in from the item before is that item's (no beat). `render.posts.pictureReply.on: false` restores the old drawing (a chip, the picture in the slot) for every post that does not say `pictureOnly: true`. diff --git a/umtool/e2e/picture-replies.spec.ts b/umtool/e2e/picture-replies.spec.ts @@ -49,7 +49,16 @@ test.beforeEach(() => { reply.parents = [{ id: "40", author: "Furri", handle: "furri_m", date: "2026-10-30T06:58:00.000Z", text: "@narrsubject", media: [GIF] }]; // A reply of somebody else's that is only "@narrsubject" and a picture. const pic = { ...structuredClone(byId("p-12")), id: "p-42", post: "othchan-x/42", author: "Kir", handle: "kir_v", text: "@narrsubject", date: "2026-10-30T08:00:00.000Z", media: [{ src: "posts-media/narrchan-x/12/12_2.png", kind: "image", width: 320, height: 180 }], panel: "side" }; - m.timeline = [reply, pic, byId("p-13")]; + // A manual thread: her picture-only reply (its read the words on her picture), then his answer to it. + const SEEN = "Its words, as read off her picture, out loud."; + Object.assign(pic, { thread: { group: "kp" }, narration: { script: SEEN, takes: [takeOf(SEEN)], pick: 0 } }); + const ANSWER = "Normally I do not respond to stuff like this, but you called me something, so here we go."; + const answer = { ...structuredClone(byId("p-12")), id: "p-43", post: "narrchan-x/43", text: ANSWER, date: "2026-10-30T09:00:00.000Z", thread: { group: "kp" }, narration: { script: ANSWER, takes: [takeOf(ANSWER)], pick: 0 } }; + delete answer.media; + // His reply to a post that is only "@narrsubject" and a VIDEO WITH ITS SOUND (the meme from its original upload). + const meme = { ...structuredClone(reply), id: "p-44", post: "narrchan-x/44", date: "2026-10-30T11:00:00.000Z" }; + meme.parents = [{ id: "45", author: "Furri", handle: "furri_m", date: "2026-10-30T10:58:00.000Z", text: "@narrsubject", media: [{ src: "posts-media/narrchan-x/11/11_1.mp4", kind: "video", width: 320, height: 180, seconds: 4, audio: true }] }]; + m.timeline = [reply, pic, answer, byId("p-13"), meme]; writeFileSync(MANIFEST, JSON.stringify(m, null, 2) + "\n"); }); @@ -123,3 +132,32 @@ test("THE POST BENCH's picture-only block: the parent picture-only by the rule, await page.locator("[data-post-bench-save]").click(); await expect.poll(() => JSON.parse(readFileSync(MANIFEST, "utf8")).timeline.find((e: { id: string }) => e.id === "p-41").parents[0].pictureOnly).toBe(false); }); + +test("CARRIED AS CONTEXT a picture-only post keeps its picture: his answer's card keeps her card on top, her picture in it (small and dim), never in the slot, no beat again", async ({ page }) => { + await page.setViewportSize({ width: 1366, height: 1000 }); + const { player, frame } = await playAt(page, "p-43", 3); + await expect(player).toHaveAttribute("data-post-pics", "conv:42"); + await expect(player).not.toHaveAttribute("data-post-beat", /./); + await expect(frame.locator('[data-thread-tile="conv:42"] [data-post-pic="conv:42"] img')).toHaveCount(1); + await expect(page.locator('[data-post-panel="conv:42"]')).toHaveCount(0); + await expect(frame.locator("[data-post-slot]")).toHaveCount(0); + await expect(async () => expect(await opacityOf(frame, '[data-thread-tile="conv:42"]')).toBeLessThan(0.7)).toPass({ timeout: 10_000 }); + const pic = await frame.locator('[data-post-pic="conv:42"]').boundingBox({ timeout: 10_000 }); + expect(pic && pic.width > 50 && Math.abs(pic.width / pic.height - 16 / 9) < 0.08, "its aspect kept").toBe(true); + if (SHOTS) await page.screenshot({ path: path.join(SHOTS, "picture-context.png") }); +}); + +test("A PICTURE-ONLY VIDEO WITH ITS SOUND speaks through its beat in Play: the card's own video unmuted on Play's clock, its whole length the beat; muted once his read comes", async ({ page }) => { + await page.setViewportSize({ width: 1366, height: 1000 }); + const { player, frame } = await playAt(page, "p-44", 0.5); + await expect(player).toHaveAttribute("data-post-beat", "parent:0"); + await expect(player).toHaveAttribute("data-post-pic-sound", "parent:0"); + await expect(frame.locator('[data-post-pic="parent:0"] video')).toHaveCount(1); + await page.locator("[data-play-toggle]").click(); + await expect.poll(async () => frame.locator('[data-post-pic="parent:0"] video').evaluate((v) => (v as HTMLVideoElement).muted), { timeout: 10_000 }).toBe(false); + await page.locator("[data-play-toggle]").click(); + // Its beat is the clip's 4 s; after it, his read -- the video muted. + const { player: p2, frame: f2 } = await playAt(page, "p-44", 6); + await expect(p2).not.toHaveAttribute("data-post-pic-sound", /./); + await expect.poll(async () => f2.locator('[data-post-pic="parent:0"] video').evaluate((v) => (v as HTMLVideoElement).muted)).toBe(true); +}); diff --git a/umtool/lib/report/manifest.mjs b/umtool/lib/report/manifest.mjs @@ -74,6 +74,7 @@ import { TakeScopeRefused, scopedTakeToken, takeScopeOf } from "./takeScope.mjs" import { DELIVERABLES_MODES } from "./storage.mjs"; import { COMBO_DEFAULTS, COMBO_ITEM_KEYS, validatePostCombo, validatePostComboRender } from "umtool-report-to-video/post-combo"; import { SCENE_DEFAULTS, validatePostSceneRender } from "umtool-report-to-video/post-media-scene"; +import { PICTURE_REPLY_DEFAULTS, validatePictureReplyRender } from "umtool-report-to-video/post-picture"; import { createSnapshot, listSnapshots } from "./snapshots.mjs"; import { benchPrepAfterWrite } from "./benchPrepTrigger.mjs"; import { citeFollow, clockOf, qrFollowsCite } from "./citeFollow.mjs"; @@ -2685,6 +2686,36 @@ export async function updatePostSceneRender(dir, patch, { token = null } = {}) { } /** + * THE CUT's PICTURE-ONLY RULE (`render.posts.pictureReply`, post-picture.mjs; `umtool posts picture-reply`): `patch` + * is `{ on?, image?, min?, max?, maxSound? }`, a null clearing one (the default again). One structural write, refused + * in the build's words (validatePictureReplyRender). + * + * @param {string} dir + * @param {Record<string, any>} patch + * @param {{ token?: string | null }} [opts] + */ +export async function updatePostPictureReplyRender(dir, patch, { token = null } = {}) { + if (!isObj(patch) || !Object.keys(patch).length) throw new Error("nothing to set"); + for (const k of Object.keys(patch)) if (!(k in PICTURE_REPLY_DEFAULTS)) throw new Error(`${k} is not a picture-reply knob (${Object.keys(PICTURE_REPLY_DEFAULTS).join(", ")})`); + return structural(dir, "post-picture-reply", token, (m) => { + if (!isObj(m.render)) m.render = {}; + const posts = isObj(m.render.posts) ? m.render.posts : {}; + const c = isObj(posts.pictureReply) ? posts.pictureReply : {}; + for (const [k, v] of Object.entries(patch)) { + if (v === null || v === undefined) delete c[k]; + else c[k] = v; + } + if (Object.keys(c).length) posts.pictureReply = c; + else delete posts.pictureReply; + if (Object.keys(posts).length) m.render.posts = posts; + else delete m.render.posts; + const errors = validatePictureReplyRender(m.render); + if (errors.length) throw new StructureRefused(errors); + return { pictureReply: m.render.posts?.pictureReply ?? null }; + }); +} + +/** * ATTACH A CAPTURE's MEDIA to post items that carry none (`umtool posts * attach`): `patches` is `{ <id>: media[] }`, each list already copied into * the project; an item that has an attachment by now is left as it is. One diff --git a/umtool/lib/report/postsCli.mjs b/umtool/lib/report/postsCli.mjs @@ -34,7 +34,8 @@ import path from "node:path"; import { REPORTS_ROOT, resolveProject } from "../projects/core.mjs"; import { channelsDirFor, readManifest } from "../projects/report.mjs"; import { withEditNotes } from "./edit-guard.mjs"; -import { PostsRefused, StaleToken, StructureRefused, addArchiveAvatars, manifestToken, setPostAvatar, updatePostItem, updatePostRedact, updatePosts, upsertPost } from "./manifest.mjs"; +import { PostsRefused, StaleToken, StructureRefused, addArchiveAvatars, manifestToken, setPostAvatar, updatePostItem, updatePostPictureReplyRender, updatePostRedact, updatePosts, upsertPost } from "./manifest.mjs"; +import { pictureReplyKnobs } from "umtool-report-to-video/post-picture"; import { postWarnings } from "./postCards.mjs"; import { censorSpecOf } from "umtool-report-to-video/post-censor"; @@ -181,6 +182,11 @@ export const POSTS_USAGE = [ " umtool posts combo <project> [k=v …] · <item> off|on|k=v … the combo badge's knobs (umtool posts repeats --help)", " umtool posts attach <project> [<item> … | --all] [--dry-run] a capture's media onto items that carry none", " umtool posts scenes <project> [on|off] [--json] the MEDIA SCENES: neighbours with the same attachment", + " umtool posts picture-reply <project> [on=on|off] [image=<s>] [min=<s>] [max=<s>] [maxSound=<s>] [--in-take <take>] [--json]", + " the cut's PICTURE-ONLY rule (render.posts.pictureReply, post-picture.mjs): on at all; a beat's", + " length -- an image `image` s, a GIF's or a silent video's own length clamped to min-max, a", + " video with its sound its whole length up to maxSound (default 2, 1.5, 4, 8 s); k= the default;", + " none: the rule as it stands", ].join("\n"); const VALUED = new Set(["--in-take", "--set", "--attach", "--flag", "--author", "--id", "--crop", "--since", "--until", "--replies", "--order", "--limit", "--after", "--script", "--note", "--voice", "--engine", "--speed", "--pick", "--linger", "--derive", "--op", "--delete", "--match", "--target", "--occurrence", "--at", "--scale", "--hold", "--lead", "--ease", "--highlight", "--worker", "--without", "--drop-parts", "--text", "--place", "--rewind", "--zone", "--gap", "--from-scale", "--color", "--outline", "--outline-width", "--size", "--face", "--sfx", "--volume", "--bar", "--bar-style", "--tempo-for", "--tempo", "--parts", "--stretch", "--yell-gain", "--yell-style", "--pause", "--parents", "--skip-parent", "--voice-for", "--item"]); @@ -597,6 +603,7 @@ export async function postsCommand(args, { root = REPORTS_ROOT, out = (s) => con if (verb === "avatars" && projectArg && !flags.has("--help")) return await avatarsCommand(projectArg, { root, json, dryRun, out }); if (verb === "context" && projectArg && !flags.has("--help")) return await contextCommand(projectArg, { root, json, dryRun, out }); // The combo counter (postComboCli.mjs): the attachments played more than once, the badge's knobs. + if (verb === "picture-reply" && projectArg && !flags.has("--help")) return await pictureReplyCommand(projectArg, words.slice(2), { root, json, out }); if (verb === "repeats" || verb === "combo" || verb === "attach" || verb === "scenes") return await (await import("./postComboCli.mjs")).comboCommand(verb, words.slice(1), flags, { root, json, out, err }); if ((verb !== "add" && verb !== "set") || !projectArg || !ref || flags.has("--help")) { err(POSTS_USAGE); @@ -705,7 +712,7 @@ async function setCommand(projectArg, ref, pairs, { root, json, out }) { } /** The verbs `--in-take <take>` scopes (each writes a post item through manifest.mjs's structural writers). */ -export const IN_TAKE_VERBS = ["set-item", "roles", "narrate", "reread", "fx"]; +export const IN_TAKE_VERBS = ["set-item", "roles", "narrate", "reread", "fx", "picture-reply"]; /** The verbs whose `--take <take>` is `--in-take <take>` (narrate's `--take` is its own: a new read). */ const TAKE_ALIAS_VERBS = new Set(["set-item", "roles", "reread", "fx"]); @@ -794,6 +801,40 @@ async function inTakeCommand({ verb, take, rest }, { root, out, err }) { } } +/** `umtool posts picture-reply <p> [k=v …]`: the cut's picture-only rule (render.posts.pictureReply), shown or set. */ +async function pictureReplyCommand(projectArg, pairs, { root, json, out }) { + const project = await projectOf(projectArg, root); + const patch = {}; + for (const pair of pairs) { + const m = /^(on|image|min|max|maxSound)=(.*)$/.exec(pair); + if (!m) throw new CliError(`posts picture-reply: ${pair} is not a knob (on=on|off, image=, min=, max=, maxSound= seconds; k= the default)`); + const [, k, raw] = m; + const v = raw.trim().toLowerCase(); + if (v === "" || v === "auto" || v === "default") patch[k] = null; + else if (k === "on") { + if (!["on", "off", "true", "false"].includes(v)) throw new CliError("on= takes on or off"); + patch.on = v === "on" || v === "true"; + } else { + const n = Number(v); + if (!Number.isFinite(n)) throw new CliError(`${k}= takes seconds`); + patch[k] = n; + } + } + let rule; + if (Object.keys(patch).length) { + const { result, editNotes } = await withEditNotes(project, async () => updatePostPictureReplyRender(project.dir, patch, { token: await manifestToken(project.dir) })); + rule = result.pictureReply; + if (json) { + out(JSON.stringify({ ok: true, pictureReply: rule, knobs: pictureReplyKnobs({ posts: { pictureReply: rule ?? {} } }), token: result.token, editNotes }, null, 2)); + return 0; + } + } else rule = (await readManifest(project.dir))?.render?.posts?.pictureReply ?? null; + const k = pictureReplyKnobs({ posts: { pictureReply: rule ?? {} } }); + if (json) out(JSON.stringify({ ok: true, pictureReply: rule, knobs: k }, null, 2)); + else out(`the cut's picture-only rule: ${k.on ? "on" : "OFF"} -- an image's beat ${k.image} s; a GIF's or a silent video's its own length, ${k.min}–${k.max} s; a video with its sound its whole length, up to ${k.maxSound} s${rule ? "" : " (the defaults)"}`); + return 0; +} + async function projectOf(projectArg, root) { const r = await resolveProject(projectArg, root); if (r.ambiguous) throw new CliError(`"${projectArg}" is the name of ${r.ambiguous.length} projects — pass its id`); diff --git a/umtool/report-to-video/package.json b/umtool/report-to-video/package.json @@ -75,6 +75,7 @@ "./post-progress": "./post-progress.mjs", "./post-censor": "./post-censor.mjs", "./post-media-scene": "./post-media-scene.mjs", + "./post-picture": "./post-picture.mjs", "./post-redact": "./post-redact.mjs", "./post-say": "./post-say.mjs", "./post-redact-files": "./post-redact-files.mjs", diff --git a/umtool/report-to-video/post-conversation.mjs b/umtool/report-to-video/post-conversation.mjs @@ -36,7 +36,8 @@ // PURE and dependency-free (but its siblings): the build, Play, the bench, // the route, the writers' guard and the lint read the same context from here. -import { cardAuthors, cardText, contextText, isParaphrased, parentsOf } from "./post-item.mjs"; +import { cardAuthors, cardText, contextText, isParaphrased, ownPictureOnly, parentsOf, refPictureOnly } from "./post-item.mjs"; +import { pictureMediaOf, pictureRuleEntry } from "./post-picture.mjs"; import { isNarrated } from "./post-narration.mjs"; import { followKnobs } from "./read-follow.mjs"; import { joinKnobs } from "./post-join.mjs"; @@ -233,6 +234,8 @@ export function sceneRefOf(e, scope) { redact: authors.find((a) => a.where === "author")?.redact === true, ...(parentsOf(e)[0] ? { replyTo: { id: str(parentsOf(e)[0].id), handle: str(parentsOf(e)[0].handle) } } : str(e?.replyingTo) ? { replyTo: { id: "", handle: str(e.replyingTo) } } : {}), src: { post: str(e?.post), scope: "text" }, + // A PICTURE-ONLY post (post-picture.mjs) keeps its picture as context, as a text post keeps its words. + ...(ownPictureOnly(e) ? { pictureOnly: true, media: pictureMediaOf(e) } : {}), }; } const i = Number(/^parent:(\d)$/.exec(scope)?.[1] ?? -1); @@ -249,6 +252,7 @@ export function sceneRefOf(e, scope) { redact: authors.find((a) => a.where === `parents[${i}]`)?.redact === true, ...(parentsOf(e)[i + 1] ? { replyTo: { id: str(parentsOf(e)[i + 1].id), handle: str(parentsOf(e)[i + 1].handle) } } : {}), src: { post: str(e?.post), scope: "parent", index: i }, + ...(refPictureOnly(p) ? { pictureOnly: true, media: pictureMediaOf(p) } : {}), }; } @@ -299,11 +303,12 @@ function contextsOf(tl, render) { if (t.mode === "scene") { if (t.action === "keep") end.push({ id: t.scope.slice(5), ref: t.ref }); } else if (t.scope === "post" || t.scope.startsWith("parent:")) { - const ref = sceneRefOf(e, t.scope); + // (The cut's picture-only rule laid on: off, a picture-only post is carried as its words alone, as before.) + const ref = sceneRefOf(pictureRuleEntry(e, render), t.scope); // What it answers, from the run's tree when its own item does not carry it (the branch map's lines). const up = ref?.id ? runs[r].tree.parentOf.get(ref.id) : undefined; if (ref && !ref.replyTo && up) ref.replyTo = { id: up, handle: "" }; - if (ref?.id && str(ref.text).trim()) end.push({ id: ref.id, ref }); + if (ref?.id && (str(ref.text).trim() || ref.pictureOnly)) end.push({ id: ref.id, ref }); } } } diff --git a/umtool/report-to-video/post-item.mjs b/umtool/report-to-video/post-item.mjs @@ -33,11 +33,11 @@ import { isNarrated, narrationSchedule, postNarrationFiles, postNarrationKnobs, validatePostNarration, } from "./post-narration.mjs"; import { BAR_CSS, barsHtml, hasMarks, projectRedactOf, redactEntry, redactSceneRef, redactionOn, validatePostsRender } from "./post-redact.mjs"; -import { blurErrors, blurOn } from "./post-censor.mjs"; +import { blurErrors, blurOn, censorEntry } from "./post-censor.mjs"; import { WORD_ZOOM_HIGHLIGHT_ALPHA, cardTokens, cardWordsOf, findMatch, targetTextOf, validatePostFx } from "./word-zoom.mjs"; import { FOLLOW_MIN_SIZE, followBlocks, followKnobs, followSchedule, scopeBlocks, validatePostFollow } from "./read-follow.mjs"; import { panelSchedule, pictureBeats, threadLayout, validatePostThread } from "./post-thread.mjs"; -import { isPictureOnly, pictureBeatSeconds, pictureMediaOf, pictureRuleEntry, validatePictureOnly, validatePictureReplyRender } from "./post-picture.mjs"; +import { isPictureOnly, pictureBeatSeconds, pictureHasSound, pictureMediaOf, pictureRuleEntry, validatePictureOnly, validatePictureReplyRender } from "./post-picture.mjs"; import { joinLayerHtml, validatePostJoin, validatePostJoinRender } from "./post-join.mjs"; import { validatePostLinkVisit, validatePostLinkVisitRender, visitsEnd } from "./post-link-visit.mjs"; import { progressErrors } from "./post-progress.mjs"; @@ -357,11 +357,22 @@ const hasPictureContext = (entry) => parentsOf(entry).some(refPictureOnly) || (i export function picturesOf(entry, follow = null) { const hidden = new Set((follow?.thread?.tiles ?? []).filter((t) => t.mode === "hidden").map((t) => t.scope)); const out = []; + // A context post's BEAT with a video that has its sound: the sound plays through the beat (`sound`: its span). + const soundOf = (scope, media) => { + const b = (follow?.beats ?? []).find((x) => x.scope === scope); + return b && pictureHasSound(media[0]) ? { sound: { t0: b.t0, t1: b.t1 } } : {}; + }; if (ownPictureOnly(entry)) out.push({ scope: "post", media: pictureMediaOf(entry) }); parentsOf(entry).forEach((p, i) => { - if (refPictureOnly(p) && !hidden.has(`parent:${i}`)) out.push({ scope: `parent:${i}`, media: pictureMediaOf(p) }); + if (refPictureOnly(p) && !hidden.has(`parent:${i}`)) out.push({ scope: `parent:${i}`, media: pictureMediaOf(p), ...soundOf(`parent:${i}`, pictureMediaOf(p)) }); }); - if (isObj(entry?.quoted) && refPictureOnly(entry.quoted) && !hidden.has("quoted")) out.push({ scope: "quoted", media: pictureMediaOf(entry.quoted) }); + if (isObj(entry?.quoted) && refPictureOnly(entry.quoted) && !hidden.has("quoted")) out.push({ scope: "quoted", media: pictureMediaOf(entry.quoted), ...soundOf("quoted", pictureMediaOf(entry.quoted)) }); + // A picture-only post the run left on screen (post-conversation.mjs sceneRefOf): its picture kept as context, in its + // tile -- `post` names the archive post whose markup may censor it (its own attachment). + for (const t of follow?.thread?.tiles ?? []) { + if (t.mode !== "scene" || !t.ref?.pictureOnly || !pictureMediaOf(t.ref).length) continue; + out.push({ scope: t.scope, media: pictureMediaOf(t.ref), ...(t.ref.src?.scope === "text" && str(t.ref.src.post) ? { post: str(t.ref.src.post) } : {}) }); + } return out; } @@ -1122,7 +1133,7 @@ export function postCardHtml(entry, { width, height, palette = {}, fonts = {}, p const picOwn = ownPictureOnly(entry); const picPar = parentsOf(entry).map(refPictureOnly); const picQ = isObj(entry.quoted) && refPictureOnly(entry.quoted); - const anyPic = picOwn || picQ || picPar.some(Boolean); + const anyPic = picOwn || picQ || picPar.some(Boolean) || (Array.isArray(thread?.tiles) && thread.tiles.some((t) => /** @type {any} */ (t)?.ref?.pictureOnly === true)); // AS PUBLISHED (post-redact.mjs): every redacted match drawn as a bar, its letters never in the page. The // marks keep the text's length and its spaces, so the card's word indices (a word zoom's) are the original's. entry = redactEntry(entry, redaction); @@ -1142,6 +1153,18 @@ export function postCardHtml(entry, { width, height, palette = {}, fonts = {}, p const line = mixHex(pal.bg, pal.fg, 0.18); // A picture-only post's picture where its words would be; its mention-only words small, as X's reply-to line. const picIn = (scope, ref, w, maxH) => pictureHtml(scope, pictureMediaOf(ref), { width: w, maxH, k, mediaUrl, posters, live: livePics, line }); + // A PICTURE-ONLY post drawn as CONTEXT -- carried from the item before (a parent), or a post the run left on screen + // (a scene tile, post-conversation.mjs sceneRefOf: `pictureOnly`, its `media`) -- keeps its picture: `{ media }`, its + // own attachment censored by its channel's markup as its item's is; null when it is not one. + const scenePictureOf = (ref, scope) => { + if (!isObj(ref)) return null; + const isScene = String(scope).startsWith("conv:"); + if (isScene ? ref.pictureOnly !== true : !refPictureOnly(ref)) return null; + const media = pictureMediaOf(ref); + if (!media.length) return null; + const post = isScene && isObj(ref.src) && ref.src.scope === "text" ? str(ref.src.post) : ""; + return { media: post ? censorEntry({ post, media }, redaction).media : media }; + }; const menSize = Math.round(22 * k); const ownPicMax = Math.max(Math.round(140 * k), L.card.height - 2 * L.pad - Math.round(250 * k) - Math.min(2, parentsOf(entry).length) * Math.round(130 * k) - (isObj(entry.quoted) ? Math.round(170 * k) : 0)); const own = { author: entry.author, handle: entry.handle }; @@ -1221,9 +1244,11 @@ export function postCardHtml(entry, { width, height, palette = {}, fonts = {}, p // A PLAIN card before (no thread): its head is the card's (not the words' size) and its words a card's gap below; // a THREADED one: its head at ITS words' box size (`headSize`), not this card's. const sz = fin(join?.size) ? join.size : sizeFor(contextText(p) || " ", innerW, innerH - 170 * k); + // A PICTURE-ONLY post carried in keeps its picture, drawn as the item before drew it (post-picture.mjs). + const pictured = scenePictureOf(p, scope); const own2 = { author: p.author, handle: p.handle }; const headP = `<div class="head"${r ? ' data-redacted=""' : ""}>${avatarHtml(own2, { redact: r, size: Math.round(64 * k), accent: r ? undefined : pal.accent, img: r ? null : pic(p) })}<div class="hwho">${nameHtml(own2, { redact: r, cls: "big" })}<div class="date">${esc(cardDate(p.date))}</div></div><div class="mark">${esc(PLATFORM_NAME[entry.platform] ?? "")}</div></div>`; - tileHtml.push(`<div class="tslot" data-thread-slot="${esc(scope)}"${slotAttr}><div class="tile tpost tcarry${join?.plain ? " tplain" : ""}" data-thread-tile="${esc(scope)}" data-thread-mode="${mode}" ${attr} data-join-anchor="">${relationHtml(t0(scope))}${!join?.plain && fin(join?.headSize) ? headP.replace('<div class="head"', `<div class="head" style="font-size:${join.headSize}px"`) : headP}<div class="twords" style="font-size:${sz}px">${wordsHtml(contextText(p), r && p.handle ? [...blurred, p.handle] : blurred)}</div></div></div>`); + tileHtml.push(`<div class="tslot" data-thread-slot="${esc(scope)}"${slotAttr}><div class="tile tpost tcarry${join?.plain ? " tplain" : ""}" data-thread-tile="${esc(scope)}" data-thread-mode="${mode}" ${attr} data-join-anchor="">${relationHtml(t0(scope))}${!join?.plain && fin(join?.headSize) ? headP.replace('<div class="head"', `<div class="head" style="font-size:${join.headSize}px"`) : headP}<div class="twords${pictured ? " pmen" : ""}" style="font-size:${pictured ? menSize : sz}px">${wordsHtml(contextText(p), r && p.handle ? [...blurred, p.handle] : blurred)}</div>${pictured ? picIn(scope, pictured, innerW, Math.round(innerH * 0.62)) : ""}</div></div>`); }; const refTile = (scope, p, where, attr) => { const mode = tmode(scope); @@ -1279,9 +1304,11 @@ export function postCardHtml(entry, { width, height, palette = {}, fonts = {}, p continue; } const text = str(ref.text); - const tsize = sizeFor(text || " ", innerW - av - Math.round(16 * k), innerH - 90 * k); + // A PICTURE-ONLY post kept as context: its picture in its tile, scaled with it (post-picture.mjs). + const spic = scenePictureOf(ref, t.scope); + const tsize = spic ? menSize : sizeFor(text || " ", innerW - av - Math.round(16 * k), innerH - 90 * k); tileHtml.push( - `<div class="tslot" data-thread-slot="${esc(t.scope)}" data-thread-scene="${t.action === "keep" ? "keep" : "collapse"}"><div class="tile tparent tscene" data-thread-tile="${esc(t.scope)}" data-thread-mode="scene" data-post-scene="${esc(t.scope.slice(5))}"${r ? ' data-redacted=""' : ""}>${avatarHtml(ref, { redact: r, size: av, img: pic(ref) })}<div class="pbody">${relationHtml(t)}<div class="phead">${nameHtml(ref, { redact: r, cls: "big" })}<span class="pdate">${esc(cardDate(ref.date).split(" · ")[0])}</span>${ref.paraphrased ? '<span class="plabel" data-post-paraphrased="">paraphrased</span>' : ""}</div><div class="ptext tt" style="font-size:${tsize}px">${wordsHtml(text, r && ref.handle ? [...blurred, ref.handle] : blurred)}</div></div></div></div>`, + `<div class="tslot" data-thread-slot="${esc(t.scope)}" data-thread-scene="${t.action === "keep" ? "keep" : "collapse"}"><div class="tile tparent tscene" data-thread-tile="${esc(t.scope)}" data-thread-mode="scene" data-post-scene="${esc(t.scope.slice(5))}"${r ? ' data-redacted=""' : ""}>${avatarHtml(ref, { redact: r, size: av, img: pic(ref) })}<div class="pbody">${relationHtml(t)}<div class="phead">${nameHtml(ref, { redact: r, cls: "big" })}<span class="pdate">${esc(cardDate(ref.date).split(" · ")[0])}</span>${ref.paraphrased ? '<span class="plabel" data-post-paraphrased="">paraphrased</span>' : ""}</div><div class="ptext tt${spic ? " pmen" : ""}" style="font-size:${tsize}px">${wordsHtml(text, r && ref.handle ? [...blurred, ref.handle] : blurred)}</div>${spic ? picIn(t.scope, spic, innerW - av - Math.round(16 * k), Math.round(innerH * 0.6)) : ""}</div></div></div>`, ); } const order = [...tiles.map((t) => t.scope).filter((sc) => byScope.has(sc)), ...[...byScope.keys()].filter((sc) => !tiles.some((t) => t.scope === sc))]; diff --git a/umtool/report-to-video/post-picture.mjs b/umtool/report-to-video/post-picture.mjs @@ -27,8 +27,14 @@ const r3 = (v) => Math.round(v * 1000) / 1000; const clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v)); /** The cut's rule (`render.posts.pictureReply`): on; an image's beat; a GIF's or a video's own length clamped to [min, max]. */ -export const PICTURE_REPLY_DEFAULTS = Object.freeze({ on: true, image: 2, min: 1.5, max: 4 }); -export const PICTURE_REPLY_LIMITS = Object.freeze({ image: [0.5, 8], min: [0.5, 8], max: [0.5, 12] }); +export const PICTURE_REPLY_DEFAULTS = Object.freeze({ on: true, image: 2, min: 1.5, max: 4, maxSound: 8 }); +export const PICTURE_REPLY_LIMITS = Object.freeze({ image: [0.5, 8], min: [0.5, 8], max: [0.5, 12], maxSound: [0.5, 30] }); + +/** + * Whether a picture-only post's attachment SPEAKS: a video with its sound (not `audio: false`, not `mute`) -- its beat + * plays it (it is the post's message) and lasts its whole length up to the rule's `maxSound`. A GIF never does. + */ +export const pictureHasSound = (m) => isObj(m) && m.kind === "video" && m.audio !== false && m.mute !== true; /** A word that is not words: an @mention, a link (a bare domain link too: pic.x.com/…, t.co/…). */ const MENTION_RE = /^[(\[]?@[A-Za-z0-9_.]{1,64}[)\],.:;!?]*$/; @@ -63,8 +69,9 @@ export function pictureReplyKnobs(render) { const v = isObj(render?.posts) && isObj(render.posts.pictureReply) ? render.posts.pictureReply : {}; const out = { ...PICTURE_REPLY_DEFAULTS }; if (typeof v.on === "boolean") out.on = v.on; - for (const k of ["image", "min", "max"]) if (fin(v[k])) out[k] = v[k]; + for (const k of ["image", "min", "max", "maxSound"]) if (fin(v[k])) out[k] = v[k]; if (out.max < out.min) out.max = out.min; + if (out.maxSound < out.min) out.maxSound = out.min; return out; } @@ -72,14 +79,15 @@ export function pictureReplyKnobs(render) { export function validatePictureReplyRender(render) { const v = isObj(render?.posts) ? render.posts.pictureReply : undefined; if (v === undefined) return []; - if (!isObj(v)) return ["render.posts.pictureReply must be { on?, image?, min?, max? } (picture-only posts)"]; - const errors = Object.keys(v).filter((k) => !(k in PICTURE_REPLY_DEFAULTS)).map((k) => `render.posts.pictureReply.${k} is not a picture-reply knob (on, image, min, max)`); + if (!isObj(v)) return ["render.posts.pictureReply must be { on?, image?, min?, max?, maxSound? } (picture-only posts)"]; + const errors = Object.keys(v).filter((k) => !(k in PICTURE_REPLY_DEFAULTS)).map((k) => `render.posts.pictureReply.${k} is not a picture-reply knob (on, image, min, max, maxSound)`); if (v.on !== undefined && typeof v.on !== "boolean") errors.push("render.posts.pictureReply.on must be true or false"); - for (const k of ["image", "min", "max"]) { + for (const k of ["image", "min", "max", "maxSound"]) { const [lo, hi] = PICTURE_REPLY_LIMITS[k]; if (v[k] !== undefined && !(fin(v[k]) && v[k] >= lo && v[k] <= hi)) errors.push(`render.posts.pictureReply.${k} must be ${lo}–${hi} seconds`); } if (fin(v.min) && fin(v.max) && v.max < v.min) errors.push("render.posts.pictureReply.max must be at least its min"); + if (fin(v.min) && fin(v.maxSound) && v.maxSound < v.min) errors.push("render.posts.pictureReply.maxSound must be at least its min"); return errors; } @@ -121,7 +129,8 @@ function ownLength(m) { /** * A picture-only post's BEAT, seconds: its attachments' own lengths (a GIF's pass, a video's span; an image the - * rule's `image`), together, clamped to the rule's [min, max]. + * rule's `image`), together, clamped to the rule's [min, max] -- [min, maxSound] when one of them has its sound (a + * video's punchline is never cut: operator, 5 Nov, the "It's time to stop" meme with its audio). * @param {Array<Record<string, any>>} media * @param {Record<string, any>} [render] */ @@ -130,5 +139,5 @@ export function pictureBeatSeconds(media, render = undefined) { const list = (Array.isArray(media) ? media : []).filter(isObj); if (!list.length) return 0; const sum = list.reduce((n, m) => n + (ownLength(m) ?? k.image), 0); - return r3(clamp(sum, k.min, k.max)); + return r3(clamp(sum, k.min, list.some(pictureHasSound) ? k.maxSound : k.max)); } diff --git a/umtool/report-to-video/post-picture.test.mjs b/umtool/report-to-video/post-picture.test.mjs @@ -33,10 +33,11 @@ test("DETECTION: words of only @mentions and links, with an attachment, are pict test("THE BEAT: a GIF's or a video's own length, an image the rule's 2 s, clamped to 1.5–4 s; the cut's knobs over it", () => { assert.equal(pictureBeatSeconds([GIF]), 2.53); assert.equal(pictureBeatSeconds([{ ...GIF, seconds: 0.8 }]), 1.5); - assert.equal(pictureBeatSeconds([VID]), 4); + assert.equal(pictureBeatSeconds([VID]), 8, "a video with its sound: up to maxSound"); + assert.equal(pictureBeatSeconds([{ ...VID, audio: false }]), 4); assert.equal(pictureBeatSeconds([IMG]), 2); assert.equal(pictureBeatSeconds([IMG], { posts: { pictureReply: { image: 3, max: 5 } } }), 3); - assert.deepEqual(pictureReplyKnobs(undefined), { on: true, image: 2, min: 1.5, max: 4 }); + assert.deepEqual(pictureReplyKnobs(undefined), { on: true, image: 2, min: 1.5, max: 4, maxSound: 8 }); }); test("A PICTURE-ONLY PARENT (furri's '@subject' and a GIF): its own beat before his read, drawn in its card in full, never in the slot -- the read moved, the take untouched", () => { @@ -139,3 +140,71 @@ test("THE KNOBS are refused in the build's words", () => { assert.equal(validatePictureReplyRender({ posts: { pictureReply: { on: "x", nope: 1, image: 99, min: 3, max: 2 } } }).length, 4); assert.ok(validatePostItems({ render: { posts: { pictureReply: "on" } }, timeline: [] }).some((x) => /pictureReply/.test(x))); }); + +import { planContext } from "./post-conversation.mjs"; + +test("CARRIED AS CONTEXT a picture-only post keeps its picture: the run's next item draws it in its scene tile (small and dim), never in the slot, no beat again, its length unchanged", () => { + const g = { group: "kir" }; + const kir = narrate(base({ id: "p-7", post: "kir-x/7", author: "Kir", handle: "kir", text: "@subject", date: at(19), media: [IMG], thread: g }), "It's amazing how much discourse is just pretending not to understand things."); + const reply = narrate(base({ id: "p-8", post: "subj-x/8", date: at(20), thread: g })); + const tl = [kir, reply]; + const ctx = planContext(tl, 1, R); + const tile = ctx.scene.tiles.find((t) => t.id === "7"); + assert.equal(tile.ref.pictureOnly, true); + assert.deepEqual(tile.ref.media, [IMG]); + const plan = postItemPlan(reply, R, ctx); + assert.equal(plan.follow.beats, undefined, "seen already: no beat"); + assert.equal(plan.panel, undefined); + assert.deepEqual(plan.pics, [{ scope: "conv:7", media: [IMG], post: "kir-x/7" }]); + const row = plan.follow.thread.tiles.find((t) => t.scope === "conv:7"); + assert.equal(row.mode, "scene"); + const html = postCardHtml(reply, { width: 1920, height: 1080, follow: true, thread: plan.follow.thread, mediaUrl: (s) => `file:///p/${s}` }); + assert.match(html, /data-thread-tile="conv:7"[^]*class="ptext tt pmen"[^]*data-post-pic="conv:7" data-pic-kind="image"[^]*<img src="file:\/\/\/p\/posts-media\/kir-x\/7\/7_1.jpg"/); + // Its length is the read's, as before; the rule off: words only, as before. + const off = { ...R, posts: { pictureReply: { on: false } } }; + const ctxOff = planContext(tl, 1, off); + assert.equal(ctxOff.scene.tiles.find((t) => t.id === "7").ref.pictureOnly, undefined); + assert.equal(postItemPlan(reply, off, ctxOff).total, plan.total); + // Its channel's markup censors it as context too. + const red = { terms: [], markup: { "kir-x/7": { censor: [{ media: 0 }] } } }; + assert.match(postCardHtml(reply, { width: 1920, height: 1080, follow: true, thread: plan.follow.thread, mediaUrl: (s) => `file:///p/${s}`, redaction: red }), /data-post-pic="conv:7"[^]*filter:blur/); +}); + +test("A PICTURE-ONLY PARENT CARRIED from the item before (the join) is drawn with its picture, as that item drew it -- no beat", () => { + const kir = base({ id: "p-7", post: "kir-x/7", author: "Kir", handle: "kir", text: "@subject", date: at(19), media: [IMG] }); + const reply = narrate(base({ id: "p-8", post: "subj-x/8", parents: [{ id: "7", author: "Kir", handle: "kir", date: at(19), text: "@subject", media: [IMG] }] })); + const plan = postItemPlan(reply, R, { prev: kir, join: { seconds: 0.6 } }); + assert.equal(plan.follow.thread.tiles.find((t) => t.scope === "parent:0").mode, "carry"); + assert.equal(plan.follow.beats, undefined); + const html = postCardHtml(reply, { width: 1920, height: 1080, follow: true, thread: plan.follow.thread, mediaUrl: (s) => `file:///p/${s}`, join: { size: 40, plain: true } }); + assert.match(html, /data-thread-tile="parent:0"[^]*data-join-anchor=""[^]*data-post-pic="parent:0"/); +}); + +import { postSegmentArgs } from "./post-render.mjs"; + +test("A PICTURE-ONLY VIDEO WITH ITS SOUND speaks through its beat: its whole length up to maxSound (8 s), its sound mixed after the read's mix (never ducked), faded; a GIF and a muted video stay silent and keep the 1.5-4 s rule", () => { + const MEME = { src: "posts-media/umtool-sources/74TZdKTkr7E.mp4", kind: "video", width: 1280, height: 720, seconds: 4.92, audio: true }; + assert.equal(pictureBeatSeconds([MEME]), 4.92); + assert.equal(pictureBeatSeconds([{ ...MEME, seconds: 12 }]), 8); + assert.equal(pictureBeatSeconds([{ ...MEME, seconds: 12 }], { posts: { pictureReply: { maxSound: 10 } } }), 10); + assert.equal(pictureBeatSeconds([{ ...MEME, audio: false }]), 4); + assert.equal(pictureBeatSeconds([{ ...MEME, mute: true }]), 4); + assert.equal(pictureBeatSeconds([{ ...GIF, seconds: 6 }]), 4); + const e = narrate(base({ parents: [{ ...gifParent, media: [MEME] }], media: [VID] })); + const plan = postItemPlan(e, R); + assert.deepEqual(plan.follow.beats, [{ scope: "parent:0", t0: 0, t1: 4.92 }]); + assert.deepEqual(plan.pics, [{ scope: "parent:0", media: [MEME], sound: { t0: 0, t1: 4.92 } }]); + assert.equal(plan.narration.at, 0.25 + 4.92); + const L = postLayout(e, { width: 1920, height: 1080 }); + const argv = postSegmentArgs({ entry: e, box: { width: 1920, height: 1080 }, plan, layout: L, cards: { read: "r.png" }, files: ["v.mp4"], render: { fps: 30 }, outPath: "o.mp4", narration: { file: "t.wav" }, picSounds: [{ m: MEME, file: "meme.mp4", t0: 0, t1: 4.92 }] }); + const fc = argv[argv.indexOf("-filter_complex") + 1]; + assert.match(fc, /atrim=0:4\.92,afade=t=in:d=0\.04,afade=t=out:st=4\.8:d=0\.12,adelay=0\|0\[psd0\]/); + assert.match(fc, /\[aps\]\[psd0\]amix=inputs=2:normalize=0:duration=first\[a\]/, "after the read's mix, never ducked"); + // A GIF: no sound span. + assert.equal(postItemPlan(narrate(base({ parents: [gifParent], media: [VID] })), R).pics[0].sound, undefined); + // Carried as context (the run's next item): a still -- no sound span. + const g = { group: "m" }; + const tl = [narrate(base({ id: "p-7", post: "f-x/7", handle: "furri", text: "@subject", date: at(19), media: [MEME], thread: g }), "x"), narrate(base({ id: "p-8", post: "subj-x/8", thread: g }))]; + const later = postItemPlan(tl[1], R, planContext(tl, 1, R)); + assert.ok(later.pics.every((p) => !p.sound)); +}); diff --git a/umtool/report-to-video/post-render.mjs b/umtool/report-to-video/post-render.mjs @@ -101,7 +101,7 @@ export function clockJoinExpr(base, d, seconds) { return `${num(base)}+${num(d)}*(1-${e})`; } -export function postSegmentArgs({ entry, box, plan, layout, cards, files, render, place = [], encode = [], captions = [], fontfile = null, outPath, narration = null, zooms = [], follow = null, panelFiles = [], join = null, map = null, captionFx = [], clock = null, slams = [], slamHitList = [], progress = null, pics = [] }) { +export function postSegmentArgs({ entry, box, plan, layout, cards, files, render, place = [], encode = [], captions = [], fontfile = null, outPath, narration = null, zooms = [], follow = null, panelFiles = [], join = null, map = null, captionFx = [], clock = null, slams = [], slamHitList = [], progress = null, pics = [], picSounds = [] }) { const fps = render.fps ?? 30; const T = plan.total; const inputs = []; @@ -136,7 +136,8 @@ export function postSegmentArgs({ entry, box, plan, layout, cards, files, render const label = `pic${pi}`; const raw = blurOn(m) ? `${label}r` : label; const crop = Array.isArray(m.crop) ? `crop=iw*${num(m.crop[2])}:ih*${num(m.crop[3])}:iw*${num(m.crop[0])}:ih*${num(m.crop[1])},` : ""; - const from = Number.isFinite(m.start) && m.start > 0 ? m.start : 0; + // A video whose sound plays from its beat's start (`soundAt`): its picture in step with it. + const from = (Number.isFinite(m.start) && m.start > 0 ? m.start : 0) + (Number.isFinite(pc.soundAt) && t0 > pc.soundAt ? t0 - pc.soundAt : 0); const len = t1 - t0; const k = add(["-stream_loop", "-1", ...(from > 0 ? ["-ss", num(from)] : []), "-t", num(len + 0.1), "-i", file]); const fadeAt = Math.max(0, len - POST_PIC_FADE); @@ -381,7 +382,10 @@ export function postSegmentArgs({ entry, box, plan, layout, cards, files, render // Narrated (post-narration.mjs): the item's own sound is the bed the narrator reads over -- muffled, then clean. // THE SLAM's HITS (post-slam.mjs, trailer-hits.mjs): mixed in after the item's own sound and the read -- no duck. const outA = slamHitList.length ? "apre" : "a"; - const media = narration && plan.narration ? "pm" : outA; + // A PICTURE-ONLY post's video SPEAKING through its beat (post-picture.mjs): mixed in after the read's mix -- never + // ducked under the read (the beat is before it), as the item's own attachment's sound is mixed: unlevelled, faded. + const preSound = picSounds.length ? "aps" : outA; + const media = narration && plan.narration ? "pm" : preSound; if (audio.length) { parts.push(...audio.map((a) => a.chain)); parts.push(`[${sil}:a]${audio.map((a) => `[${a.label}]`).join("")}amix=inputs=${audio.length + 1}:normalize=0:duration=first[${media}]`); @@ -391,7 +395,18 @@ export function postSegmentArgs({ entry, box, plan, layout, cards, files, render // A take that says a slur the cut masks (post-slurs.mjs takeBleeps): silenced or beeped over it, on the take's own clock. const bl = narration.bleeps?.spans?.length ? bleepFilters(`${vi}:a`, "pnbl", narration.bleeps, { audioRate: render.audioRate ?? 48000, seconds: narration.bleeps.seconds ?? 600 }) : []; parts.push(...bl); - parts.push(...postNarrationFilters({ media: "pm", voice: bl.length ? "pnbl" : `${vi}:a`, out: outA, sch: plan.narration, gainDb: narration.gainDb ?? 0, audioRate: render.audioRate ?? 48000 })); + parts.push(...postNarrationFilters({ media: "pm", voice: bl.length ? "pnbl" : `${vi}:a`, out: preSound, sch: plan.narration, gainDb: narration.gainDb ?? 0, audioRate: render.audioRate ?? 48000 })); + } + if (picSounds.length) { + const labels = picSounds.map((ps, i) => { + const from = Number.isFinite(ps.m.start) && ps.m.start > 0 ? ps.m.start : 0; + const dur = Math.max(0.1, ps.t1 - ps.t0); + const k = add([...(from > 0 ? ["-ss", num(from)] : []), "-t", num(dur + 0.1), "-i", ps.file]); + const ms = Math.round(ps.t0 * 1000); + parts.push(`[${k}:a]aresample=${render.audioRate ?? 48000},aformat=channel_layouts=stereo,asetpts=PTS-STARTPTS,atrim=0:${num(dur)},afade=t=in:d=0.04,afade=t=out:st=${num(Math.max(0, dur - 0.12))}:d=0.12,adelay=${ms}|${ms}[psd${i}]`); + return `[psd${i}]`; + }); + parts.push(`[aps]${labels.join("")}amix=inputs=${labels.length + 1}:normalize=0:duration=first[${outA}]`); } if (slamHitList.length) { parts.push(trailerHitsGraph(slamHitList, { seconds: T, rate: render.audioRate ?? 48000, layout: "stereo", prefix: "sl" })); @@ -467,7 +482,7 @@ export async function renderPostCards(entry, { box, render, dir, manifestDir, la const pe = joinFrom.entry; const pf = joinFrom.plan?.follow ?? null; const pShot = typeof pe.parentShot === "string" ? pathToFileURL(path.resolve(manifestDir, pe.parentShot)).href : null; - const ph = postCardHtml(pe, { width: box.width, height: box.height, palette: render.palette, fonts, phase: "read", parentShotUrl: pShot, avatars: av, follow: !!pf, thread: pf?.thread ?? null, redaction, join: joinFrom.carry ?? null }); + const ph = postCardHtml(pe, { width: box.width, height: box.height, palette: render.palette, fonts, phase: "read", parentShotUrl: pShot, avatars: av, follow: !!pf, thread: pf?.thread ?? null, redaction, join: joinFrom.carry ?? null, ...(cardPics ?? {}) }); const pfile = path.join(dir, "join-from.html"); await writeFile(pfile, ph, "utf8"); await page.goto(pathToFileURL(pfile).href, { waitUntil: "load" }); @@ -727,7 +742,7 @@ export const POST_PIC_MIN_SPAN = 0.3; /** Its fade back to the still at a span's end (s). */ export const POST_PIC_FADE = 0.25; /** The drawing of a picture-only post (postSegmentKeyOf `pics`): bump it when the card draws one differently. */ -export const POST_PICTURE_DRAW_V = 1; +export const POST_PICTURE_DRAW_V = 2; const evenBox = (r) => ({ x: Math.round(r.x), y: Math.round(r.y), width: Math.max(2, Math.round(r.width / 2) * 2), height: Math.max(2, Math.round(r.height / 2) * 2) }); @@ -1426,8 +1441,11 @@ export async function buildPostSegment(entry, { render, outDir, manifestDir, box for (const [i, f] of panelFiles.flat().entries()) { if (!(await stat(f).catch(() => null))) throw new Error(`${entry.id}: a context post's attachment is not on disk: ${f} (${i})`); } + // A picture-only post the run left on screen (a scene tile, post-item.mjs picturesOf `post`): its own attachment + // censored by its channel's markup, as its own item's is. + if (plan.pics) plan.pics = plan.pics.map((p) => (p.post ? { ...p, media: censorEntry({ post: p.post, media: p.media }, redaction).media } : p)); // PICTURE-ONLY posts' pictures (post-picture.mjs, plan.pics): files of the project, drawn in their cards. - const picFiles = (plan.pics ?? []).flatMap((p) => p.media.map((m) => path.resolve(manifestDir, m.src))); + const picFiles = [...new Set([...(plan.pics ?? []), ...(from?.plan?.pics ?? [])].flatMap((p) => p.media.map((m) => path.resolve(manifestDir, m.src))))]; for (const f of picFiles) { if (!(await stat(f).catch(() => null))) throw new Error(`${entry.id}: a picture-only post's attachment is not on disk: ${f}`); } @@ -1476,16 +1494,22 @@ export async function buildPostSegment(entry, { render, outDir, manifestDir, box // Its progress bar (post-progress.mjs): the read's span on the item's clock (a long read's, auto). const prog = progressPlan(entry, render, plan, { stack: layout.mode === "stack" }); // PICTURE-ONLY posts (post-picture.mjs): the page draws each picture in its card -- an image itself, a GIF's or a - // video's first frame (its still; the encode plays it over that place while the card is still). + // video's middle frame (its still; the encode plays it over that place while the card is still). + // The item before's too, when this one opens on it (the join's page draws it as it ended). let cardPics = null; - if (plan.pics?.length) { + const drawnPics = [...(plan.pics ?? []), ...(from?.plan?.pics ?? [])]; + if (drawnPics.length) { await mkdir(cardDir, { recursive: true }); const posters = {}; - for (const [pi, pc] of plan.pics.entries()) { + for (const [pi, pc] of drawnPics.entries()) { const m = pc.media[0]; - if (m?.kind !== "gif" && m?.kind !== "video") continue; + if ((m?.kind !== "gif" && m?.kind !== "video") || posters[m.src]) continue; const still = path.join(cardDir, `pic-${pi}.png`); - const from = Number.isFinite(m.start) && m.start > 0 ? m.start : 0; + // Its still is the frame at the middle of its span: a clip's first frame is often empty (a green screen before + // the man walks in) -- and this is what a context post shows once its beat is over. + const start = Number.isFinite(m.start) && m.start > 0 ? m.start : 0; + const end = Number.isFinite(m.end) && m.end > start ? m.end : Number.isFinite(m.seconds) && m.seconds > start ? m.seconds : start; + const from = Math.round((start + (end - start) / 2) * 1000) / 1000; try { await exec(ffmpeg, ["-nostdin", "-v", "error", "-y", "-ss", String(from), "-i", path.resolve(manifestDir, m.src), "-frames:v", "1", still], { maxBuffer: 1 << 24 }); posters[m.src] = pathToFileURL(still).href; @@ -1529,7 +1553,7 @@ export async function buildPostSegment(entry, { render, outDir, manifestDir, box const lufs = Number.isFinite(take.lufs) ? take.lufs : await measureLufsOf(takeFile, { exec, ffmpeg }); narration = { file: takeFile, gainDb: narrationLevelDb(lufs, plan.narration.lufs), lufs, ...(bleeps ? { bleeps } : {}) }; } - const argv = postSegmentArgs({ entry, box, plan, layout, cards, files, render, place, encode, captions, fontfile: render.fontBold ?? render.fontRegular ?? null, outPath: tmp, narration, zooms, follow: cards.follow ?? null, panelFiles, map: cards.map ?? null, join: from && cards.joinFrom ? { seconds: plan.follow.join.seconds, fadeIn: from.fadeIn, from: from.media } : null, captionFx: cards.captions ?? [], clock: cards.clock ? { ...cards.clock, until: layout.mode === "stack" && plan.steps.length ? plan.steps[0].at : plan.total } : null, slams: cards.slams ?? [], slamHitList: (cards.slams ?? []).flatMap((sl) => slamHits(sl.fx, sl.span).map((h) => ({ ...h, gain: h.gain * sl.fx.volume }))), progress: cards.progress ?? null, pics: (cards.pics ?? []).map((pc) => ({ ...pc, file: path.resolve(manifestDir, pc.m.src) })) }); + const argv = postSegmentArgs({ entry, box, plan, layout, cards, files, render, place, encode, captions, fontfile: render.fontBold ?? render.fontRegular ?? null, outPath: tmp, narration, zooms, follow: cards.follow ?? null, panelFiles, map: cards.map ?? null, join: from && cards.joinFrom ? { seconds: plan.follow.join.seconds, fadeIn: from.fadeIn, from: from.media } : null, captionFx: cards.captions ?? [], clock: cards.clock ? { ...cards.clock, until: layout.mode === "stack" && plan.steps.length ? plan.steps[0].at : plan.total } : null, slams: cards.slams ?? [], slamHitList: (cards.slams ?? []).flatMap((sl) => slamHits(sl.fx, sl.span).map((h) => ({ ...h, gain: h.gain * sl.fx.volume }))), progress: cards.progress ?? null, pics: (cards.pics ?? []).map((pc) => ({ ...pc, file: path.resolve(manifestDir, pc.m.src), soundAt: (plan.pics ?? []).find((p) => p.scope === pc.scope)?.sound?.t0 ?? null })), picSounds: (plan.pics ?? []).filter((p) => p.sound && p.media[0]).map((p) => ({ m: p.media[0], file: path.resolve(manifestDir, p.media[0].src), t0: p.sound.t0, t1: Math.min(plan.total, p.sound.t1) })) }); try { await exec(ffmpeg, argv, { maxBuffer: 1 << 24 }); } catch (err) {