mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 02:43:48 +02:00
Use decoder information for resampler sample rate, fix Opus sample rate to 48 kHz everywhere
This commit is contained in:
+6
-3
@@ -24,7 +24,7 @@
|
||||
chunked: true,
|
||||
chunkSize: 2**20
|
||||
});
|
||||
const outputFormat = new Mediabunny.Mp4OutputFormat({});
|
||||
const outputFormat = new Mediabunny.WavOutputFormat({});
|
||||
|
||||
const button = document.createElement('button');
|
||||
button.textContent = 'Cancel';
|
||||
@@ -72,6 +72,9 @@
|
||||
}),
|
||||
output,
|
||||
audio: {
|
||||
codec: 'pcm-s16',
|
||||
//sampleRate: 16000,
|
||||
//numberOfChannels: 1,
|
||||
//discard: true,
|
||||
//codec: 'opus',
|
||||
//bitrate: 128000,
|
||||
@@ -106,7 +109,7 @@
|
||||
*/
|
||||
video: () => ({
|
||||
//discard: true,
|
||||
forceTranscode: true,
|
||||
//forceTranscode: true,
|
||||
//codec: 'avc',
|
||||
//fit: 'contain',
|
||||
//frameRate: 27.123,
|
||||
@@ -129,7 +132,7 @@
|
||||
//height: 100,
|
||||
}),
|
||||
trim: {
|
||||
start: 1,
|
||||
start: 0,
|
||||
end: 10
|
||||
},
|
||||
});
|
||||
|
||||
+5
-3
@@ -14,10 +14,12 @@
|
||||
source: new Mediabunny.BlobSource(file),
|
||||
});
|
||||
|
||||
const videoTrack = await input.getPrimaryVideoTrack();
|
||||
const sink = new Mediabunny.VideoSampleSink(videoTrack);
|
||||
const audioTrack = await input.getPrimaryAudioTrack();
|
||||
const sink = new Mediabunny.EncodedPacketSink(audioTrack);
|
||||
|
||||
console.log(await sink.getSample(2.131875));
|
||||
for await (const packet of sink.packets()) {
|
||||
console.log(packet);
|
||||
}
|
||||
|
||||
/*
|
||||
const sink = new Mediabunny.EncodedPacketSink(videoTrack);
|
||||
|
||||
Reference in New Issue
Block a user