Allow negative timestamps in media sources, add negative timestamp support to ISOBMFF muxer

This commit is contained in:
Vanilagy
2026-09-04 11:48:50 +02:00
parent 6c88763a5c
commit 3c94d062d2
10 changed files with 207 additions and 63 deletions
+6 -6
View File
@@ -47,7 +47,7 @@
format = new Mediabunny.MkvOutputFormat();
format = new Mediabunny.MovOutputFormat();
format = new Mediabunny.Mp4OutputFormat({ fastStart: 'reserve' });
format = new Mediabunny.Mp4OutputFormat();
format = new Mediabunny.Mp4OutputFormat({ });
let target = new Mediabunny.BufferTarget();
/*
@@ -191,17 +191,17 @@ Testing... <00:17.350>One... <00:18.125>Two...
9. <b>justify (bottom, right)</b>.
`;
subtitleSource.add(simpleWebvttFile);
subtitleSource.close();
//subtitleSource.add(simpleWebvttFile);
//subtitleSource.close();
const p = document.createElement('p');
document.body.append(p);
for (let i = 0; i < 100; i++) {
for (let i = 0; i < 1; i++) {
context.fillStyle = ['red', 'green', 'blue', 'yellow'][i % 4];
context.fillRect(canvas.width * Math.random(), canvas.height * Math.random(), canvas.width * Math.random(), canvas.height * Math.random());
await videoSource.add(i / 10, 1 / 10);
await videoSource.add(i / 10 - 1, 1 / 10);
p.textContent = i;
}
@@ -211,7 +211,7 @@ Testing... <00:17.350>One... <00:18.125>Two...
let length = 10;
let slicedAudioBuffer = sliceAudioBuffer(audioBuffer, length, audioContext);
await audioSource.add(slicedAudioBuffer);
//await audioSource.add(slicedAudioBuffer);
await output.finalize();