mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-03 05:43:50 +02:00
Fix tests and elaborate on point in docs
This commit is contained in:
@@ -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.
|
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
|
## 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:
|
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:
|
||||||
|
|||||||
@@ -239,7 +239,6 @@ test('MPEG-TS muxing with HEVC and MP3', async () => {
|
|||||||
let isFirstVideo = true;
|
let isFirstVideo = true;
|
||||||
let videoPacketCountWritten = 0;
|
let videoPacketCountWritten = 0;
|
||||||
for await (const packet of hevcSink.packets()) {
|
for await (const packet of hevcSink.packets()) {
|
||||||
console.log(packet.timestamp);
|
|
||||||
if (packet.timestamp >= duration) break;
|
if (packet.timestamp >= duration) break;
|
||||||
|
|
||||||
await videoSource.add(packet, {
|
await videoSource.add(packet, {
|
||||||
@@ -620,7 +619,11 @@ test('MPEG-TS transmux (Annex B and ADTS passthrough)', async () => {
|
|||||||
target: new BufferTarget(),
|
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);
|
expect(conversion.isValid).toBe(true);
|
||||||
|
|
||||||
await conversion.execute();
|
await conversion.execute();
|
||||||
|
|||||||
@@ -482,7 +482,7 @@ test('MPEG-TS with unknown file size (ReadableStreamSource)', async () => {
|
|||||||
.toBeGreaterThanOrEqual(10);
|
.toBeGreaterThanOrEqual(10);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('MPEG-TS transmuxed by FFmpeg', async () => {
|
test('MPEG-TS transmuxed by FFmpeg', { timeout: 30_000 }, async () => {
|
||||||
using input = new Input({
|
using input = new Input({
|
||||||
source: new UrlSource('https://pub-cf9fcfcb5c0a44e9b1bb5ff890e041ae.r2.dev/trim-buck-bunny-ffmpeg.ts'),
|
source: new UrlSource('https://pub-cf9fcfcb5c0a44e9b1bb5ff890e041ae.r2.dev/trim-buck-bunny-ffmpeg.ts'),
|
||||||
formats: ALL_FORMATS,
|
formats: ALL_FORMATS,
|
||||||
|
|||||||
Reference in New Issue
Block a user