mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 02:43:48 +02:00
Add ConversionOptions.tracks, add better converstion start timestamp computation, optimize endPacket logic, utilize metadata duration for progress callback for better performance
This commit is contained in:
+8
-3
@@ -60,11 +60,12 @@
|
||||
|
||||
if (true) {
|
||||
input = new Mediabunny.Input({
|
||||
entryPath: 'https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_fmp4/master.m3u8',
|
||||
entryPath: 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8',
|
||||
source: ({ path }) => new Mediabunny.UrlSource(path),
|
||||
formats: Mediabunny.ALL_FORMATS,
|
||||
});
|
||||
|
||||
/*
|
||||
const videoTrack = await input.getPrimaryVideoTrack();
|
||||
const audioTrack = await input.getPrimaryAudioTrack();
|
||||
|
||||
@@ -75,6 +76,7 @@
|
||||
videoTrack.computeDuration({ skipLiveWait: true }),
|
||||
audioTrack.computeDuration({ skipLiveWait: true }),
|
||||
]));
|
||||
*/
|
||||
} else {
|
||||
const file = fileInput.files[0];
|
||||
const source = new Mediabunny.BlobSource(file);
|
||||
@@ -90,7 +92,8 @@
|
||||
input,
|
||||
output,
|
||||
audio: (track, n) => ({
|
||||
discard: !tracks.includes(track),
|
||||
//discard: true,
|
||||
//discard: !tracks.includes(track),
|
||||
//codec: 'eac3',
|
||||
//discard: true,
|
||||
//discard: n > 1,
|
||||
@@ -137,7 +140,8 @@
|
||||
},
|
||||
*/
|
||||
video: (track) => ({
|
||||
discard: !tracks.includes(track),
|
||||
//discard: true,
|
||||
//discard: !tracks.includes(track),
|
||||
//forceTranscode: true,
|
||||
//forceTranscode: true,
|
||||
//width: 1280,
|
||||
@@ -222,6 +226,7 @@
|
||||
}
|
||||
},
|
||||
trim: {
|
||||
end: 10,
|
||||
//start,
|
||||
//end: start + 5,
|
||||
////start: 0,
|
||||
|
||||
+11
-2
@@ -11,6 +11,7 @@
|
||||
document.body.append(fileInput);
|
||||
|
||||
fileInput.addEventListener('change', async () => {
|
||||
/*
|
||||
const file = fileInput.files[0];
|
||||
const input = new Mediabunny.Input({
|
||||
formats: Mediabunny.ALL_FORMATS,
|
||||
@@ -25,14 +26,22 @@
|
||||
|
||||
//console.log(await input.getDurationFromMetadata(), await input.computeDuration());
|
||||
return;
|
||||
*/
|
||||
|
||||
const manifest = new Mediabunny.Input({
|
||||
entryPath: 'https://playertest.longtailvideo.com/adaptive/alt-audio-no-video/sintel/playlist.m3u8',
|
||||
entryPath: 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8',
|
||||
source: ({ path }) => new Mediabunny.UrlSource(path),
|
||||
formats: Mediabunny.ALL_FORMATS,
|
||||
});
|
||||
|
||||
const audioTrack = await manifest.getPrimaryAudioTrack();
|
||||
const ugh = new Mediabunny.EncodedPacketSink(audioTrack);
|
||||
|
||||
console.log(await manifest.getTracks());
|
||||
for await (const packet of ugh.packets()) {
|
||||
console.log(packet);
|
||||
}
|
||||
|
||||
//console.log(await manifest.getTracks());
|
||||
return;
|
||||
|
||||
const videoTrack = await manifest.getPrimaryVideoTrack();
|
||||
|
||||
Reference in New Issue
Block a user