Repository navigation
Description
Describe the bug
A short music bed with native loop and an explicit longer slot exports only its first source cycle, then silence. The audio mix reports success. Audible video loops lose their repeated sound too.
Minimal reproduction
From a dependency-ready checkout of main 886e8696dfc43d748a221adf51678fc99d4ca74a, generate a synthetic one-second tone:
mkdir -p loop-repro
ffmpeg -v error -y -f lavfi -i sine=frequency=1000:duration=1:sample_rate=48000 -c:a pcm_s16le loop-repro/tone.wavSave loop-repro/repro.ts:
import { resolve } from "node:path";
import { parseAudioElements, processCompositionAudio } from "../packages/engine/src/services/audioMixer.ts";
const dir = resolve("loop-repro");
const html = '<audio id="tone" src="tone.wav" data-start="0" data-duration="3" data-end="3" loop></audio>';
console.log(await processCompositionAudio(
parseAudioElements(html), dir, resolve(dir, "work"), resolve(dir, "loop.m4a"), 3,
));Run:
bun loop-repro/repro.ts
ffmpeg -hide_banner -i loop-repro/loop.m4a -af silencedetect=n=-50dB:d=0.1 -f null -Expected behavior
Repeat the one-second source until the three-second slot ends. With a source in-point, each cycle should start there, matching runtime playback.
Actual behavior
Both baseline and focused fix return success: true, tracksProcessed: 1, and exactly three seconds of AAC/stereo/48 kHz output. The content differs:
| Same source and three-second slot | Main | Focused fix |
|---|---|---|
| Detected silence | Starts at 1 s, lasts 2 s | None |
| Decoded PCM RMS in each second | [2896, 0, 0] |
[2896, 2896, 2896] |
The source WAV is byte-identical in both runs. RMS samples exclude 50 ms at either edge of each second. No audio was played.
Environment
Main 886e8696d, engine 0.8.191. Linux x86_64, Node 26.11.1, Bun 1.4.1, FFmpeg/ffprobe n9.0.2. Repository Bun pin is 1.4.4. This directly executes the real engine parser and mixer and measures its M4A output; it does not claim a full browser/producer render.
Additional context
AudioElement does not retain the native loop attribute, and extractAudioSegment reads only one source pass. The final mixer pads the remaining slot with silence. Runtime looping is supported, including the short background-music workflow in #41. Open #5462 and merged #5455 cover stream timing/video loop periods, not repeated audio extraction. The separately documented split-scene loop-phase limitation in #5454 is outside this reproduction.
Activity