mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 10:53:50 +02:00
Fix incorrectly processed timestamps for fragmented MP4
This commit is contained in:
+4
-4
@@ -21,7 +21,7 @@
|
||||
chunked: true,
|
||||
chunkSize: 2**20
|
||||
});
|
||||
const outputFormat = new Metamuxer.Mp4OutputFormat();
|
||||
const outputFormat = new Metamuxer.Mp4OutputFormat({ fastStart: 'fragmented' });
|
||||
|
||||
const button = document.createElement('button');
|
||||
button.textContent = 'Cancel';
|
||||
@@ -41,7 +41,7 @@
|
||||
//numberOfChannels: 1,
|
||||
//sampleRate: 4000
|
||||
//discard: true
|
||||
forceReencode: true,
|
||||
//forceReencode: true,
|
||||
},
|
||||
/*
|
||||
video: {
|
||||
@@ -72,7 +72,7 @@
|
||||
//width: 1280,
|
||||
//discard: true,
|
||||
//width: 640
|
||||
forceReencode: true,
|
||||
//forceReencode: true,
|
||||
//rotate: 90
|
||||
//width: 720 ?? 2160,
|
||||
//height: 1280 ?? 3840,
|
||||
@@ -85,7 +85,7 @@
|
||||
},
|
||||
trim: {
|
||||
start: 0,
|
||||
end: 40
|
||||
end: 3
|
||||
},
|
||||
});
|
||||
console.log(conversion);
|
||||
|
||||
+15
-3
@@ -15,10 +15,17 @@
|
||||
formats: Metamuxer.ALL_FORMATS,
|
||||
source
|
||||
});
|
||||
|
||||
let timestamps = [];
|
||||
|
||||
const videoTrack = await input.getPrimaryVideoTrack();
|
||||
|
||||
const sink = new Metamuxer.EncodedPacketSink(videoTrack);
|
||||
for await (const packet of sink.packets()) {
|
||||
if (packet.timestamp >= 2) break;
|
||||
console.log(packet);
|
||||
}
|
||||
|
||||
/*
|
||||
let timestamps = [];
|
||||
const packetSink = new Metamuxer.EncodedPacketSink(videoTrack);
|
||||
for await (const packet of packetSink.packets()) {
|
||||
if (packet.timestamp >= 1) {
|
||||
@@ -71,22 +78,25 @@
|
||||
7.253333333333333,
|
||||
7.253333333333333,
|
||||
];
|
||||
*/
|
||||
|
||||
console.log(timestamps);
|
||||
//return;
|
||||
/*
|
||||
console.log(timestamps);
|
||||
const sink = new Metamuxer.EncodedPacketSink(videoTrack);
|
||||
for await (const packet of sink.packets()) {
|
||||
console.log(packet.sequenceNumber);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
const sink = new Metamuxer.VideoSampleSink(videoTrack);
|
||||
for await (const sample of sink.samplesAtTimestamps(timestamps)) {
|
||||
console.log("wee", sample.timestamp);
|
||||
sample.close();
|
||||
}
|
||||
console.log("don")
|
||||
*/
|
||||
|
||||
/*
|
||||
const sink = new Metamuxer.CanvasSink(videoTrack, { width: 320 });
|
||||
@@ -100,6 +110,7 @@
|
||||
|
||||
|
||||
|
||||
/*
|
||||
for (let i = 0; i < 40; i++) {
|
||||
const count = Math.floor(50 * Math.random());
|
||||
const timestamps = Array.from({ length: count }, () => Math.random() * 20).sort((a, b) => a-b);
|
||||
@@ -112,6 +123,7 @@
|
||||
}
|
||||
|
||||
console.log("DONE!")
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user