commit 559077ea4c3be3f39479ab218ed23a6b11d7f9e0
parent 08579f87c51342e188f8fa4eef5c35ada8f2a98f
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Thu, 22 Oct 2026 10:07:41 -0400
report video: every clip's sound on its own clock before the joins count samples
A segment is in sync by its timestamps, but apad, atrim's reset, acrossfade
and concat count samples. A late audio start (rescue: the cut reaches 0.49 s
before its window's media) and a hole in a source's sound (fed: two HLS-seam
gaps, 68 ms) moved that clip's sound, and every later clip's in the batch,
early. AUDIO_ON_CLOCK (aresample async, first_pts=0, 10 ms hard compensation)
lays each input on its timestamps in the crossfade pin, the hard-cut concat
filter and the preview concat, and at the segment encode; a stream with
neither passes sample for sample. Regression test: a late-start and a holed
segment through one pass, a batched pass and the hard cut.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
5 files changed, 184 insertions(+), 26 deletions(-)
diff --git a/umtool/report-to-video/av-clock.test.mjs b/umtool/report-to-video/av-clock.test.mjs
@@ -0,0 +1,120 @@
+// Every clip's sound lands with its picture, whatever its audio's timestamps say.
+//
+// A segment is in sync by its TIMESTAMPS: one whose audio starts late (a cut
+// that reaches before its window's media begins) or has a hole (a source's HLS
+// seam) plays right on its own. The joins count SAMPLES -- apad, atrim's
+// reset, acrossfade, concat -- so, unaligned, the late start and the hole moved
+// that clip's sound and every later clip's early (469 ms and 68 ms on the Huck
+// cut, 2026-10-22). These segments put a tone burst exactly 1.0 s into each by
+// its timestamps: the second's audio starts 0.5 s late, the third's has a
+// 60 ms hole before its tone. In every join path -- one crossfade pass, a
+// batched one, the hard-cut concat filter -- each burst must start within a
+// frame of 1.0 s after its segment does.
+//
+// Run with: pnpm test:scripts
+import assert from "node:assert/strict";
+import { spawnSync } from "node:child_process";
+import { mkdtempSync, rmSync } from "node:fs";
+import { tmpdir } from "node:os";
+import path from "node:path";
+import test from "node:test";
+
+import { buildXfadeBatches, hardCutFilterArgs, xfadeConcatArgs, xfadeGraph } from "./build-video.mjs";
+
+const have = spawnSync("ffmpeg", ["-version"]).status === 0;
+const FPS = 30;
+const RENDER = { width: 320, height: 180, fps: FPS, audioRate: 48000, audioChannels: 2, transition: 0.5, preset: "ultrafast", palette: { bg: "#12101a" } };
+const SECONDS = 4;
+
+/**
+ * A 4 s segment whose sound has a 0.5 s tone burst at TIMESTAMP 1.0 s.
+ * `late`: the audio stream starts this late (s). `hole`: a gap of this many
+ * seconds opens in the audio's timestamps at 0.5 s.
+ */
+function segment(dir, name, { late = 0, hole = 0 } = {}) {
+ const out = path.join(dir, `${name}.mp4`);
+ // The tone in SAMPLE time, so that after the shifts it sits at pts 1.0.
+ const on = 1.0 - late - hole;
+ const shift = [
+ late ? `asetpts=PTS+${late}/TB` : null,
+ hole ? `asetpts='PTS+gte(T,0.5)*${hole}/TB'` : null,
+ ].filter(Boolean);
+ const r = spawnSync("ffmpeg", [
+ "-v", "error", "-y",
+ "-f", "lavfi", "-i", `color=c=gray:s=320x180:r=${FPS}:d=${SECONDS}`,
+ "-f", "lavfi", "-i", `sine=f=1000:r=48000:d=${(SECONDS - late - hole - 0.02).toFixed(3)}`,
+ "-filter_complex",
+ `[1:a]volume=enable='not(between(t,${on.toFixed(3)},${(on + 0.5).toFixed(3)}))':volume=0,aformat=channel_layouts=stereo${shift.length ? "," + shift.join(",") : ""}[a]`,
+ "-map", "0:v", "-map", "[a]", "-c:v", "libx264", "-preset", "ultrafast", "-pix_fmt", "yuv420p", "-c:a", "aac", out,
+ ]);
+ assert.equal(r.status, 0, String(r.stderr));
+ return out;
+}
+
+/** The time (s) of the first loud 5 ms window at or after `after`, in a file's decoded sound. */
+function onsetAfter(file, after) {
+ const r = spawnSync("ffmpeg", ["-v", "error", "-i", file, "-ac", "1", "-ar", "8000", "-f", "s16le", "-"], { maxBuffer: 1 << 26 });
+ const pcm = new Int16Array(r.stdout.buffer, r.stdout.byteOffset, r.stdout.length / 2);
+ const w = 40;
+ for (let i = Math.floor(after * 8000); i + w < pcm.length; i += w) {
+ let sum = 0;
+ for (let k = i; k < i + w; k += 1) sum += pcm[k] * pcm[k];
+ if (Math.sqrt(sum / w) > 1000) return i / 8000;
+ }
+ return null;
+}
+
+function run(args) {
+ const r = spawnSync("ffmpeg", args, { maxBuffer: 1 << 26 });
+ assert.equal(r.status, 0, String(r.stderr));
+}
+
+/** Each segment's burst, measured in `file` against where its segment starts there. */
+function assertOnsets(file, starts, what) {
+ starts.forEach((s, i) => {
+ const got = onsetAfter(file, s + 0.6);
+ assert.ok(got != null, `${what}: no burst in segment ${i}`);
+ assert.ok(Math.abs(got - (s + 1.0)) <= 1 / FPS, `${what}: segment ${i}'s burst at ${got.toFixed(3)}, expected ${(s + 1).toFixed(3)}`);
+ });
+}
+
+test("the joins lay each clip's sound on its own clock: a late start and a hole stay in sync", { skip: !have && "no ffmpeg" }, async () => {
+ const dir = mkdtempSync(path.join(tmpdir(), "av-clock-"));
+ try {
+ const segs = [
+ segment(dir, "plain"),
+ segment(dir, "late", { late: 0.5 }),
+ segment(dir, "hole", { hole: 0.06 }),
+ segment(dir, "after"),
+ ];
+ // The fixtures are what they say: the late one's audio starts at 0.5 s.
+ const st = spawnSync("ffprobe", ["-v", "error", "-select_streams", "a:0", "-show_entries", "stream=start_time", "-of", "csv=p=0", segs[1]]);
+ assert.ok(Math.abs(Number(String(st.stdout).trim()) - 0.5) < 0.03, `late fixture starts at ${String(st.stdout).trim()}`);
+
+ const D = RENDER.transition;
+ const durs = segs.map(() => SECONDS);
+ const xStarts = durs.map((_, i) => i * (SECONDS - D));
+
+ // One crossfade pass.
+ const one = path.join(dir, "one.mp4");
+ const g = xfadeGraph(durs, D, null, RENDER);
+ run(["-v", "error", "-y", ...segs.flatMap((s) => ["-i", s]), "-filter_complex", g.parts.join(";"),
+ "-map", g.vlab, "-map", g.alab, "-c:v", "libx264", "-preset", "ultrafast", "-pix_fmt", "yuv420p", "-c:a", "aac", one]);
+ assertOnsets(one, xStarts, "one pass");
+
+ // Batched: two batches of two, then the join pass over the batch files.
+ const batches = await buildXfadeBatches({
+ segments: segs, durs, batches: [{ from: 0, to: 2 }, { from: 2, to: 4 }], render: RENDER, dir: path.join(dir, "batches"),
+ });
+ const batched = path.join(dir, "batched.mp4");
+ run(xfadeConcatArgs({ segments: segs, durs, render: RENDER, outPath: batched, dip: false, batches }));
+ assertOnsets(batched, xStarts, "batched");
+
+ // Hard cuts through the concat filter (a cut with joins).
+ const hard = path.join(dir, "hard.mp4");
+ run(hardCutFilterArgs(segs, [null, null, null, null], RENDER, hard));
+ assertOnsets(hard, durs.map((_, i) => i * SECONDS), "hard cut");
+ } finally {
+ rmSync(dir, { recursive: true, force: true });
+ }
+});
diff --git a/umtool/report-to-video/build-video.mjs b/umtool/report-to-video/build-video.mjs
@@ -1256,13 +1256,24 @@ async function buildClipSegment(entry, meta, render, dirs, opts, chrome, nodes,
// poster's waveform also reads it), else nothing and `0:a` as ever.
// Room's fades (muted head and tail) after the gain.
const roomAf = room ? roomAudioFilter(room.plan) : "";
- const soundChain = [!mont && level != null ? levelFilters(level.gain) : "", roomAf].filter(Boolean).join(",");
+ // First, the sound laid on its own clock (AUDIO_ON_CLOCK): a cut that starts
+ // before its source's sound does, or a source with a hole in its sound,
+ // makes a segment whose audio is continuous from 0 -- in sync by samples,
+ // not only by timestamps, for every pass after this one.
+ if (segA < 0) {
+ EMIT("note", {
+ message: `${entry.id}: the cut starts ${(-segA).toFixed(2)}s before the media in ${path.basename(raw)} — ` +
+ `its first frame held, silence under it`,
+ });
+ }
+ const soundChain = [AUDIO_ON_CLOCK, !mont && level != null ? levelFilters(level.gain) : "", roomAf].filter(Boolean).join(",");
const leveled = !mont && soundChain !== "";
- const levelParts = (posterParts) => (leveled
- ? [
- ...(posterParts ? [`[0:a]asplit=2[lda][ldw]`, ...posterParts.map((p) => p.replaceAll("[0:a]", "[ldw]")), `[lda]${soundChain}[al]`] : [`[0:a]${soundChain}[al]`]),
- ]
- : (posterParts ?? []));
+ const levelParts = (posterParts) => {
+ if (!leveled) return posterParts ?? [];
+ // An asplit only when the poster reads the sound too (its waveform).
+ if (!(posterParts ?? []).some((p) => p.includes("[0:a]"))) return [...(posterParts ?? []), `[0:a]${soundChain}[al]`];
+ return [`[0:a]asplit=2[lda][ldw]`, ...posterParts.map((p) => p.replaceAll("[0:a]", "[ldw]")), `[lda]${soundChain}[al]`];
+ };
const audioMap = leveled ? "[al]" : "0:a";
const quotePath = path.join(outDir, "segments", `${entry.id}.quote.txt`);
@@ -4062,6 +4073,15 @@ export async function cutOffsets(segments, D, fps, joins = null) {
}
/**
+ * A sound laid on its own timestamps from 0: silence where its first sample
+ * starts late or where a hole opens, samples dropped where two overlap --
+ * whatever is more than 10 ms off (a third of a frame); no resampling, and a
+ * stream with neither passes sample for sample. Every filter after it that
+ * counts samples (apad, acrossfade, concat) then counts the clock.
+ */
+export const AUDIO_ON_CLOCK = "aresample=async=1:min_hard_comp=0.01:first_pts=0";
+
+/**
* The crossfade concat's filtergraph from the cut's segment lengths (`durs`,
* holds included) and the per-input joins. Without joins, the graph it always was.
*/
@@ -4081,9 +4101,17 @@ export function xfadeGraph(durs, D, joins = null, render = null, { joined = fals
// silence and trimmed to exactly `d`, every clip's sound starts with its
// picture. `d` is the segment's length in the cut (frames ÷ fps, hold
// included), the same number the xfade offsets are summed from.
+ //
+ // Before the pin, the sound is laid on its own TIMESTAMPS (AUDIO_ON_CLOCK):
+ // a segment whose audio starts late (a cut that reaches before its
+ // window's media begins) or has a hole in it (a source's HLS seam) plays
+ // in sync by its timestamps, but apad, atrim's reset and acrossfade count
+ // SAMPLES -- unaligned, the late start and every hole moved this clip's
+ // sound, and every later clip's, early by that much (measured 469 ms and
+ // 68 ms on the Huck cut).
const len = d.toFixed(6);
const a = `[p${i}a]`;
- parts.push(`${c.a}apad=whole_dur=${len},atrim=end=${len},asetpts=PTS-STARTPTS${a}`);
+ parts.push(`${c.a}${AUDIO_ON_CLOCK},apad=whole_dur=${len},atrim=end=${len},asetpts=PTS-STARTPTS${a}`);
// A blur slide smears and grains each side of a plain seam (transition.mjs).
const special = (k) => !!(joins?.[k]?.dip || (!joined && (joins?.[k]?.wipe || joins?.[k]?.whip)));
const edges = blurSlideEdges(d, D, render, {
@@ -4134,7 +4162,9 @@ export function hardCutFilterArgs(segments, joins, render, outPath, dips = null)
const pairs = segments.map((_, i) => {
const c = joinInputChain(i, joins?.[i] ?? null, render);
parts.push(...c.parts);
- return `${c.v}${c.a}`;
+ // Each sound on its own clock before concat counts its samples (AUDIO_ON_CLOCK).
+ parts.push(`${c.a}${AUDIO_ON_CLOCK}[h${i}a]`);
+ return `${c.v}[h${i}a]`;
});
parts.push(`${pairs.join("")}concat=n=${segments.length}:v=1:a=1[vc][ac]`);
const dp = dipParts("[vc]", dips, render.fps);
@@ -4519,7 +4549,11 @@ export function previewFromSegmentsArgs({ segments, durs, starts, D, at, dur, re
if (segs.length > 1 && D > 0) {
({ parts, vlab, alab } = xfadeGraph(ds, D, js, render));
} else {
- const ins = segs.map((_, i) => joinInputChain(i, js?.[i] ?? null, render));
+ const ins = segs.map((_, i) => {
+ const c = joinInputChain(i, js?.[i] ?? null, render);
+ // Each sound on its own clock, as the full concat lays it (AUDIO_ON_CLOCK).
+ return { ...c, parts: [...c.parts, `${c.a}${AUDIO_ON_CLOCK}[w${i}a]`], a: `[w${i}a]` };
+ });
for (const c of ins) parts.push(...c.parts);
vlab = ins[0].v;
alab = ins[0].a;
diff --git a/umtool/report-to-video/cut-edits.test.mjs b/umtool/report-to-video/cut-edits.test.mjs
@@ -160,8 +160,8 @@ test("withCutEdits: nothing to add leaves the joins as they were (null stays nul
test("the graphs: unchanged without edits; the hard cut's record names a mute and a fade, so a changed one is never reused", () => {
// No edits: the plain crossfade graph (each sound pinned to its picture).
assert.deepEqual(xfadeGraph([10, 12], 0.5, withCutEdits(null, 2), RENDER).parts, [
- "[0:a]apad=whole_dur=10.000000,atrim=end=10.000000,asetpts=PTS-STARTPTS[p0a]",
- "[1:a]apad=whole_dur=12.000000,atrim=end=12.000000,asetpts=PTS-STARTPTS[p1a]",
+ "[0:a]aresample=async=1:min_hard_comp=0.01:first_pts=0,apad=whole_dur=10.000000,atrim=end=10.000000,asetpts=PTS-STARTPTS[p0a]",
+ "[1:a]aresample=async=1:min_hard_comp=0.01:first_pts=0,apad=whole_dur=12.000000,atrim=end=12.000000,asetpts=PTS-STARTPTS[p1a]",
"[0:v][1:v]xfade=transition=fade:duration=0.5:offset=9.500[v1]",
"[p0a][p1a]acrossfade=d=0.5:c1=tri:c2=tri[a1]",
]);
@@ -185,9 +185,11 @@ test("the graphs: unchanged without edits; the hard cut's record names a mute an
const fc = hardCutFilterArgs(segs, edited, RENDER, "/o.mp4");
assert.equal(fc[fc.indexOf("-filter_complex") + 1],
"[0:a]afade=t=out:st=2.96:d=0.04[j0a];" +
+ "[j0a]aresample=async=1:min_hard_comp=0.01:first_pts=0[h0a];" +
"[1:v]tpad=stop_mode=clone:stop_duration=2.5,geq=lum='lum(X,Y)+(31-lum(X,Y))*clip((T-10.9667)/1,0,1)+0.5':cb='cb(X,Y)+(132-cb(X,Y))*clip((T-10.9667)/1,0,1)+0.5':cr='cr(X,Y)+(128-cr(X,Y))*clip((T-10.9667)/1,0,1)+0.5':enable='gte(t,10.9667)'[j1v];" +
"[1:a]apad=pad_dur=2.5,afade=t=out:st=10.9667:d=1[j1a];" +
- "[0:v][j0a][j1v][j1a]concat=n=2:v=1:a=1[vc][ac]");
+ "[j1a]aresample=async=1:min_hard_comp=0.01:first_pts=0[h1a];" +
+ "[0:v][h0a][j1v][h1a]concat=n=2:v=1:a=1[vc][ac]");
});
// ---- ffmpeg, for real -------------------------------------------------------
diff --git a/umtool/report-to-video/deck-overlay.test.mjs b/umtool/report-to-video/deck-overlay.test.mjs
@@ -86,8 +86,8 @@ test("previewFromSegmentsArgs: the window's segments crossfaded as the full conc
assert.equal(
args[args.indexOf("-filter_complex") + 1],
[
- "[0:a]apad=whole_dur=10.000000,atrim=end=10.000000,asetpts=PTS-STARTPTS[p0a]",
- "[1:a]apad=whole_dur=10.000000,atrim=end=10.000000,asetpts=PTS-STARTPTS[p1a]",
+ "[0:a]aresample=async=1:min_hard_comp=0.01:first_pts=0,apad=whole_dur=10.000000,atrim=end=10.000000,asetpts=PTS-STARTPTS[p0a]",
+ "[1:a]aresample=async=1:min_hard_comp=0.01:first_pts=0,apad=whole_dur=10.000000,atrim=end=10.000000,asetpts=PTS-STARTPTS[p1a]",
"[0:v][1:v]xfade=transition=fade:duration=0.5:offset=9.500[v1]",
"[p0a][p1a]acrossfade=d=0.5:c1=tri:c2=tri[a1]",
"[v1]trim=start=2.500:duration=10.000,setpts=PTS-STARTPTS[vw]",
@@ -105,12 +105,12 @@ test("previewFromSegmentsArgs: hard cuts concatenate; one segment needs neither"
D: 0, at: 8, dur: 4, render: DECK, chromePlan: plan, outPath: "/p.mp4",
});
const fc2 = two[two.indexOf("-filter_complex") + 1];
- assert.match(fc2, /^\[0:v\]\[0:a\]\[1:v\]\[1:a\]concat=n=2:v=1:a=1\[vc\]\[ac\];\[vc\]trim=start=8\.000:duration=4\.000/);
+ assert.match(fc2, /^\[0:a\]aresample=async=1:min_hard_comp=0\.01:first_pts=0\[w0a\];\[1:a\]aresample=[^;]*\[w1a\];\[0:v\]\[w0a\]\[1:v\]\[w1a\]concat=n=2:v=1:a=1\[vc\]\[ac\];\[vc\]trim=start=8\.000:duration=4\.000/);
const one = previewFromSegmentsArgs({
segments: ["/s/a.mp4", "/s/b.mp4"], durs: [10, 10], starts: [0, 10],
D: 0, at: 1, dur: 4, render: DECK, chromePlan: plan, outPath: "/p.mp4",
});
- assert.match(one[one.indexOf("-filter_complex") + 1], /^\[0:v\]trim=start=1\.000:duration=4\.000/);
+ assert.match(one[one.indexOf("-filter_complex") + 1], /^\[0:a\]aresample=[^;]*\[w0a\];\[0:v\]trim=start=1\.000:duration=4\.000/);
});
test("chromeFlags: the three deck flags, one at a time", () => {
diff --git a/umtool/report-to-video/deck-room.test.mjs b/umtool/report-to-video/deck-room.test.mjs
@@ -184,9 +184,9 @@ test("xfadeGraph: without joins, the graph the crossfade concat always wrote", (
const g = xfadeGraph([10, 12, 4], 0.5, null, RENDER);
assert.deepEqual(g.parts, [
// Each input's sound pinned to its picture's length before the crossfade.
- "[0:a]apad=whole_dur=10.000000,atrim=end=10.000000,asetpts=PTS-STARTPTS[p0a]",
- "[1:a]apad=whole_dur=12.000000,atrim=end=12.000000,asetpts=PTS-STARTPTS[p1a]",
- "[2:a]apad=whole_dur=4.000000,atrim=end=4.000000,asetpts=PTS-STARTPTS[p2a]",
+ "[0:a]aresample=async=1:min_hard_comp=0.01:first_pts=0,apad=whole_dur=10.000000,atrim=end=10.000000,asetpts=PTS-STARTPTS[p0a]",
+ "[1:a]aresample=async=1:min_hard_comp=0.01:first_pts=0,apad=whole_dur=12.000000,atrim=end=12.000000,asetpts=PTS-STARTPTS[p1a]",
+ "[2:a]aresample=async=1:min_hard_comp=0.01:first_pts=0,apad=whole_dur=4.000000,atrim=end=4.000000,asetpts=PTS-STARTPTS[p2a]",
"[0:v][1:v]xfade=transition=fade:duration=0.5:offset=9.500[v1]",
"[p0a][p1a]acrossfade=d=0.5:c1=tri:c2=tri[a1]",
"[v1][2:v]xfade=transition=fade:duration=0.5:offset=21.000[v2]",
@@ -203,11 +203,11 @@ test("xfadeGraph: a held input joins through its chain, and the offsets after it
const g = xfadeGraph([10, 14.5, 4], 0.5, joins, RENDER);
const chain = joinInputChain(1, joins[1], RENDER).parts;
assert.deepEqual(g.parts, [
- "[0:a]apad=whole_dur=10.000000,atrim=end=10.000000,asetpts=PTS-STARTPTS[p0a]",
+ "[0:a]aresample=async=1:min_hard_comp=0.01:first_pts=0,apad=whole_dur=10.000000,atrim=end=10.000000,asetpts=PTS-STARTPTS[p0a]",
...chain,
// The held input's sound is pinned to its length WITH the hold.
- "[j1a]apad=whole_dur=14.500000,atrim=end=14.500000,asetpts=PTS-STARTPTS[p1a]",
- "[2:a]apad=whole_dur=4.000000,atrim=end=4.000000,asetpts=PTS-STARTPTS[p2a]",
+ "[j1a]aresample=async=1:min_hard_comp=0.01:first_pts=0,apad=whole_dur=14.500000,atrim=end=14.500000,asetpts=PTS-STARTPTS[p1a]",
+ "[2:a]aresample=async=1:min_hard_comp=0.01:first_pts=0,apad=whole_dur=4.000000,atrim=end=4.000000,asetpts=PTS-STARTPTS[p2a]",
"[0:v][j1v]xfade=transition=fade:duration=0.5:offset=9.500[v1]",
"[p0a][p1a]acrossfade=d=0.5:c1=tri:c2=tri[a1]",
"[v1][2:v]xfade=transition=fade:duration=0.5:offset=23.500[v2]",
@@ -221,8 +221,10 @@ test("hardCutFilterArgs: the concat filter over each input's chain, one encode",
assert.deepEqual(args.filter((_, i) => args[i - 1] === "-i"), ["/s/a.mp4", "/s/b.mp4", "/s/c.mp4"]);
assert.equal(
args[args.indexOf("-filter_complex") + 1],
- "[1:v]tpad=stop_mode=clone:stop_duration=2.5[j1v];[1:a]apad=pad_dur=2.5[j1a];" +
- "[0:v][0:a][j1v][j1a][2:v][2:a]concat=n=3:v=1:a=1[vc][ac]",
+ "[0:a]aresample=async=1:min_hard_comp=0.01:first_pts=0[h0a];" +
+ "[1:v]tpad=stop_mode=clone:stop_duration=2.5[j1v];[1:a]apad=pad_dur=2.5[j1a];[j1a]aresample=async=1:min_hard_comp=0.01:first_pts=0[h1a];" +
+ "[2:a]aresample=async=1:min_hard_comp=0.01:first_pts=0[h2a];" +
+ "[0:v][h0a][j1v][h1a][2:v][h2a]concat=n=3:v=1:a=1[vc][ac]",
);
assert.deepEqual(args.slice(args.indexOf("-map"), args.indexOf("-map") + 4), ["-map", "[vc]", "-map", "[ac]"]);
assert.equal(args[args.indexOf("-c:v") + 1], "libx264");
@@ -272,14 +274,14 @@ test("a preview window over a held clip: picked by the cut's lengths, its inputs
segments: ["/s/a.mp4", "/s/b.mp4", "/s/c.mp4"], durs, starts, D: 0.5, at: 21.5, dur: 1.5,
render: RENDER, chromePlan: plan, outPath: "/p.mp4", joins,
});
- assert.match(one[one.indexOf("-filter_complex") + 1], /\[j0v\]trim=start=12\.000:duration=1\.500,setpts=PTS-STARTPTS\[vw\];\[j0a\]atrim=/);
+ assert.match(one[one.indexOf("-filter_complex") + 1], /\[j0a\]aresample=[^;]*\[w0a\];\[j0v\]trim=start=12\.000:duration=1\.500,setpts=PTS-STARTPTS\[vw\];\[w0a\]atrim=/);
const plain = previewFromSegmentsArgs({
segments: ["/s/a.mp4", "/s/b.mp4"], durs: [10, 10], starts: [0, 9.5], D: 0.5, at: 8, dur: 4,
render: RENDER, chromePlan: plan, outPath: "/p.mp4",
});
// Without joins, the window's graph is the crossfade concat's: each sound
// pinned to its picture, then the fades.
- assert.match(plain[plain.indexOf("-filter_complex") + 1], /^\[0:a\]apad=whole_dur=10\.000000,atrim=end=10\.000000,asetpts=PTS-STARTPTS\[p0a\];\[1:a\]apad=whole_dur=10\.000000[^;]*\[p1a\];\[0:v\]\[1:v\]xfade=transition=fade:duration=0\.5:offset=9\.500\[v1\];\[p0a\]\[p1a\]acrossfade/);
+ assert.match(plain[plain.indexOf("-filter_complex") + 1], /^\[0:a\]aresample=async=1:min_hard_comp=0\.01:first_pts=0,apad=whole_dur=10\.000000,atrim=end=10\.000000,asetpts=PTS-STARTPTS\[p0a\];\[1:a\]aresample=[^;]*apad=whole_dur=10\.000000[^;]*\[p1a\];\[0:v\]\[1:v\]xfade=transition=fade:duration=0\.5:offset=9\.500\[v1\];\[p0a\]\[p1a\]acrossfade/);
});
// ---- ffmpeg, for real -------------------------------------------------------