mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-03 05:43:50 +02:00
Update convert.html
This commit is contained in:
+13
-24
@@ -23,9 +23,7 @@
|
|||||||
chunked: true,
|
chunked: true,
|
||||||
chunkSize: 2**20
|
chunkSize: 2**20
|
||||||
});
|
});
|
||||||
const outputFormat = new Mediabunny.HlsOutputFormat({
|
const outputFormat = new Mediabunny.WavOutputFormat();
|
||||||
segmentFormat: new Mediabunny.MpegTsOutputFormat(),
|
|
||||||
});
|
|
||||||
|
|
||||||
const p = document.createElement('p');
|
const p = document.createElement('p');
|
||||||
p.textContent = 'Capturing...';
|
p.textContent = 'Capturing...';
|
||||||
@@ -52,17 +50,16 @@
|
|||||||
|
|
||||||
const output = new Mediabunny.Output({
|
const output = new Mediabunny.Output({
|
||||||
format: outputFormat,
|
format: outputFormat,
|
||||||
target: new Mediabunny.PathedTarget('master.m3u8', ({ path }) => new Mediabunny.BufferTarget()),
|
target,
|
||||||
});
|
});
|
||||||
|
|
||||||
let input;
|
let input;
|
||||||
const tracks = [];
|
const tracks = [];
|
||||||
let start = 0;
|
let start = 0;
|
||||||
|
|
||||||
if (false) {
|
if (true) {
|
||||||
input = new Mediabunny.Input({
|
input = new Mediabunny.Input({
|
||||||
entryPath: 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8',
|
source: new Mediabunny.UrlSource('https://stream.mux.com/v69RSHhFelSm4701snP22dYz2jICy4E4FUyk02rW4gxRM.m3u8'),
|
||||||
source: ({ path }) => new Mediabunny.UrlSource(path),
|
|
||||||
formats: Mediabunny.ALL_FORMATS,
|
formats: Mediabunny.ALL_FORMATS,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -88,15 +85,14 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const primaryTrack = await input.getPrimaryAudioTrack();
|
||||||
|
const startTime = await primaryTrack.getFirstTimestamp();
|
||||||
|
|
||||||
let ctx = null;
|
let ctx = null;
|
||||||
let conversion = await Mediabunny.Conversion.init({
|
let conversion = await Mediabunny.Conversion.init({
|
||||||
input,
|
input,
|
||||||
output,
|
output,
|
||||||
audio: (track, n) => [{
|
audio: (track) => ({ discard: track.number !== primaryTrack.number }),
|
||||||
codec: 'aac',
|
|
||||||
}, {
|
|
||||||
codec: 'aac',
|
|
||||||
}],
|
|
||||||
/*
|
/*
|
||||||
video: {
|
video: {
|
||||||
discard: true,
|
discard: true,
|
||||||
@@ -121,13 +117,9 @@
|
|||||||
bitrate: 320000
|
bitrate: 320000
|
||||||
},
|
},
|
||||||
*/
|
*/
|
||||||
video: [
|
video: {
|
||||||
{ height: 1080 },
|
discard: true,
|
||||||
{ height: 720 },
|
},
|
||||||
{ height: 480 },
|
|
||||||
{ height: 360 },
|
|
||||||
{ height: 240 },
|
|
||||||
],
|
|
||||||
tags: {} ?? {
|
tags: {} ?? {
|
||||||
title: 'Bigggy',
|
title: 'Bigggy',
|
||||||
artist: 'Buck Bunny',
|
artist: 'Buck Bunny',
|
||||||
@@ -146,11 +138,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
trim: {
|
trim: {
|
||||||
//end: 5,
|
start: startTime,
|
||||||
//start,
|
end: startTime + 2,
|
||||||
//end: start + 5,
|
|
||||||
////start: 0,
|
|
||||||
//end: 2
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
//console.log(conversion);
|
//console.log(conversion);
|
||||||
|
|||||||
Reference in New Issue
Block a user