diff --git a/docs/guide/converting-media-files.md b/docs/guide/converting-media-files.md index 8e11193..ade6f9c 100644 --- a/docs/guide/converting-media-files.md +++ b/docs/guide/converting-media-files.md @@ -365,6 +365,8 @@ In this case, the output will be 15 seconds long. If only `start` is set, the clip will run until the end of the input file. If only `end` is set, the clip will start at the beginning of the input file. +Note that when using the trimming defaults, the resulting media file will always begin at timestamp 0. If your input file has a start time offset (like is common with MPEG-TS files) and you want to retain that, use `trim: { start: 0 }` to ensure timestamps don't get shifted. + ## Metadata tags By default, any [descriptive metadata tags](../api/MetadataTags.md) of the input will be copied to the output. If you want to further control the metadata tags written to the output, you can use the `tags` options: diff --git a/test/browser/mpeg-ts-muxing.test.ts b/test/browser/mpeg-ts-muxing.test.ts index 4b91cc8..5bb2728 100644 --- a/test/browser/mpeg-ts-muxing.test.ts +++ b/test/browser/mpeg-ts-muxing.test.ts @@ -239,7 +239,6 @@ test('MPEG-TS muxing with HEVC and MP3', async () => { let isFirstVideo = true; let videoPacketCountWritten = 0; for await (const packet of hevcSink.packets()) { - console.log(packet.timestamp); if (packet.timestamp >= duration) break; await videoSource.add(packet, { @@ -620,7 +619,11 @@ test('MPEG-TS transmux (Annex B and ADTS passthrough)', async () => { target: new BufferTarget(), }); - const conversion = await Conversion.init({ input, output }); + const conversion = await Conversion.init({ + input, + output, + trim: { start: 0 }, // So we maintain the timestamps + }); expect(conversion.isValid).toBe(true); await conversion.execute(); diff --git a/test/node/mpeg-ts-demuxing.test.ts b/test/node/mpeg-ts-demuxing.test.ts index a46844d..4afe629 100644 --- a/test/node/mpeg-ts-demuxing.test.ts +++ b/test/node/mpeg-ts-demuxing.test.ts @@ -482,7 +482,7 @@ test('MPEG-TS with unknown file size (ReadableStreamSource)', async () => { .toBeGreaterThanOrEqual(10); }); -test('MPEG-TS transmuxed by FFmpeg', async () => { +test('MPEG-TS transmuxed by FFmpeg', { timeout: 30_000 }, async () => { using input = new Input({ source: new UrlSource('https://pub-cf9fcfcb5c0a44e9b1bb5ff890e041ae.r2.dev/trim-buck-bunny-ffmpeg.ts'), formats: ALL_FORMATS,