mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 10:53:50 +02:00
Add configurable minimum MP4 fragment duration and Matroska cluster duration
This commit is contained in:
+3
-1
@@ -16,7 +16,9 @@
|
||||
|
||||
const source = new Metamuxer.BlobSource(file);
|
||||
const target = new Metamuxer.BufferTarget();
|
||||
const outputFormat = new Metamuxer.WebMOutputFormat()
|
||||
const outputFormat = new Metamuxer.Mp4OutputFormat({
|
||||
fastStart: 'fragmented'
|
||||
})
|
||||
|
||||
const button = document.createElement('button');
|
||||
button.textContent = 'Cancel';
|
||||
|
||||
+4
-17
@@ -41,8 +41,8 @@
|
||||
let format = new Metamuxer.MkvOutputFormat({ streamable: false });
|
||||
format = new Metamuxer.Mp4OutputFormat({ fastStart: 'fragmented' }); // new Metamuxer.MkvOutputFormat();// new Metamuxer.Mp4OutputFormat({ fastStart: false });
|
||||
format = new Metamuxer.OggOutputFormat();
|
||||
format = new Metamuxer.Mp4OutputFormat();
|
||||
format = new Metamuxer.WebMOutputFormat();
|
||||
format = new Metamuxer.Mp4OutputFormat({ fastStart: 'fragmented', minimumFragmentDuration: 2 });
|
||||
format = new Metamuxer.WebMOutputFormat({ minimumClusterDuration: 2 });
|
||||
let target = new Metamuxer.BufferTarget();
|
||||
|
||||
/*
|
||||
@@ -86,12 +86,10 @@
|
||||
download(new Blob([target.buffer]), 'test.mkv');
|
||||
*/
|
||||
|
||||
/*
|
||||
let videoSource = new Metamuxer.CanvasSource(canvas, {
|
||||
codec: 'av1',
|
||||
bitrate: 1e6
|
||||
});*/
|
||||
let videoSource = new Metamuxer.EncodedVideoPacketSource('av1');
|
||||
});
|
||||
let audioSource = new Metamuxer.AudioBufferSource({
|
||||
codec: 'opus',
|
||||
bitrate: 128e3,
|
||||
@@ -162,22 +160,11 @@ Testing... <00:17.350>One... <00:18.125>Two...
|
||||
//subtitleSource.add(simpleWebvttFile);
|
||||
//subtitleSource.close();
|
||||
|
||||
/*
|
||||
for (let i = 0; i < 100; 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);
|
||||
}
|
||||
*/
|
||||
for (let i = 0; i < 40; i += 0.1) {
|
||||
await videoSource.add(new Metamuxer.EncodedPacket(new Uint8Array(1234), i === 0 ? 'key' : 'delta', i, 0.1), {
|
||||
decoderConfig: {
|
||||
codec: 'vp09.00.10.08',
|
||||
codedWidth: 64,
|
||||
codedHeight: 64
|
||||
}
|
||||
});
|
||||
await videoSource.add(i / 10, 1 / 10, { keyFrame: true });
|
||||
}
|
||||
|
||||
let audioContext = new AudioContext();
|
||||
|
||||
Reference in New Issue
Block a user