mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 19:03:46 +02:00
Add proper packet duration extraction to MPEG-TS demuxer
This commit is contained in:
+37
-3
@@ -14,10 +14,44 @@
|
||||
source: new Mediabunny.BlobSource(file),
|
||||
});
|
||||
|
||||
const videoTrack = await input.getPrimaryVideoTrack();
|
||||
const sink = new Mediabunny.EncodedPacketSink(videoTrack);
|
||||
const track = await input.getPrimaryVideoTrack();
|
||||
const sink = new Mediabunny.EncodedPacketSink(track);
|
||||
|
||||
console.log(await sink.getKeyPacket(Infinity));
|
||||
const packet = await sink.getPacket(12.5);
|
||||
console.log(packet, await sink.getNextPacket(packet))
|
||||
|
||||
/*
|
||||
|
||||
let currentPacket = await sink.getFirstPacket();
|
||||
while (currentPacket) {
|
||||
console.log(currentPacket);
|
||||
currentPacket = await sink.getNextPacket(currentPacket);
|
||||
}
|
||||
|
||||
//const secondPacket = await sink.getNextPacket(firstPacket);
|
||||
//const thirdPacket = await sink.getNextPacket(secondPacket);
|
||||
//const fourthPacket = await sink.getNextPacket(thirdPacket);
|
||||
//const fifthPacket = await sink.getNextPacket(fourthPacket);
|
||||
//const sixthPacket = await sink.getNextPacket(fifthPacket);
|
||||
//const seventhPacket = await sink.getNextPacket(sixthPacket);
|
||||
//const eighthPacket = await sink.getNextPacket(seventhPacket);
|
||||
//const ninthPacket = await sink.getNextPacket(eighthPacket);
|
||||
//const tenthPacket = await sink.getNextPacket(ninthPacket);
|
||||
|
||||
console.log(firstPacket, secondPacket, thirdPacket, fourthPacket, fifthPacket, sixthPacket, seventhPacket, eighthPacket, ninthPacket, tenthPacket);
|
||||
|
||||
const packets = [firstPacket, secondPacket, thirdPacket, fourthPacket, fifthPacket, sixthPacket, seventhPacket, eighthPacket, ninthPacket, tenthPacket];
|
||||
|
||||
const videoDecoder = new VideoDecoder({
|
||||
output: (frame) => console.log(frame.timestamp, frame),
|
||||
error: console.error,
|
||||
});
|
||||
videoDecoder.configure(await videoTrack.getDecoderConfig());
|
||||
|
||||
for (const packet of packets) {
|
||||
//videoDecoder.decode(packet.toEncodedVideoChunk());
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user