mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 02:43:48 +02:00
Merge branch 'main' into hls
This commit is contained in:
@@ -61,3 +61,46 @@ test('ISOBMFF muxer internally converts ADTS to AAC', async () => {
|
||||
|
||||
expect(count).toBe(4557);
|
||||
});
|
||||
|
||||
test('Fragmented fMP4 with video+audio preserves B-frame CTS', async () => {
|
||||
using input = new Input({
|
||||
source: new FilePathSource(path.join(__dirname, '../public/video.mp4')),
|
||||
formats: ALL_FORMATS,
|
||||
});
|
||||
|
||||
const videoTrack = await input.getPrimaryVideoTrack();
|
||||
const audioTrack = await input.getPrimaryAudioTrack();
|
||||
assert(videoTrack);
|
||||
assert(audioTrack);
|
||||
|
||||
const originalVideoSink = new EncodedPacketSink(videoTrack);
|
||||
const originalTimestamps: number[] = [];
|
||||
for await (const packet of originalVideoSink.packets()) {
|
||||
originalTimestamps.push(packet.timestamp);
|
||||
}
|
||||
|
||||
const output = new Output({
|
||||
format: new Mp4OutputFormat({ fastStart: 'fragmented' }),
|
||||
target: new BufferTarget(),
|
||||
});
|
||||
|
||||
const conversion = await Conversion.init({ input, output, showWarnings: false });
|
||||
await conversion.execute();
|
||||
|
||||
using outputAsInput = new Input({
|
||||
source: new BufferSource(output.target.buffer!),
|
||||
formats: ALL_FORMATS,
|
||||
});
|
||||
|
||||
const outputVideoTrack = await outputAsInput.getPrimaryVideoTrack();
|
||||
assert(outputVideoTrack);
|
||||
|
||||
const videoSink = new EncodedPacketSink(outputVideoTrack);
|
||||
|
||||
const timestamps: number[] = [];
|
||||
for await (const packet of videoSink.packets()) {
|
||||
timestamps.push(packet.timestamp);
|
||||
}
|
||||
|
||||
expect(timestamps).toEqual(originalTimestamps);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user