mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 02:43:48 +02:00
Fix null sample in encoder support checking logic in Conversion API (#90)
This commit is contained in:
+5
-4
@@ -24,7 +24,7 @@
|
|||||||
chunked: true,
|
chunked: true,
|
||||||
chunkSize: 2**20
|
chunkSize: 2**20
|
||||||
});
|
});
|
||||||
const outputFormat = new Mediabunny.WavOutputFormat({});
|
const outputFormat = new Mediabunny.Mp4OutputFormat({});
|
||||||
|
|
||||||
const button = document.createElement('button');
|
const button = document.createElement('button');
|
||||||
button.textContent = 'Cancel';
|
button.textContent = 'Cancel';
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
format: outputFormat,
|
format: outputFormat,
|
||||||
target
|
target
|
||||||
});
|
});
|
||||||
output.setMetadata({
|
output.setMetadataTags({
|
||||||
title: 'Bigggy',
|
title: 'Bigggy',
|
||||||
artist: 'Buck Bunny',
|
artist: 'Buck Bunny',
|
||||||
images: [{
|
images: [{
|
||||||
@@ -105,7 +105,8 @@
|
|||||||
},
|
},
|
||||||
*/
|
*/
|
||||||
video: () => ({
|
video: () => ({
|
||||||
discard: true,
|
//discard: true,
|
||||||
|
forceTranscode: true,
|
||||||
//codec: 'avc',
|
//codec: 'avc',
|
||||||
//fit: 'contain',
|
//fit: 'contain',
|
||||||
//frameRate: 27.123,
|
//frameRate: 27.123,
|
||||||
@@ -128,7 +129,7 @@
|
|||||||
//height: 100,
|
//height: 100,
|
||||||
}),
|
}),
|
||||||
trim: {
|
trim: {
|
||||||
start: 0,
|
start: 1,
|
||||||
end: 10
|
end: 10
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
+14
-4
@@ -14,12 +14,22 @@
|
|||||||
source: new Mediabunny.BlobSource(file),
|
source: new Mediabunny.BlobSource(file),
|
||||||
});
|
});
|
||||||
|
|
||||||
const audioTrack = await input.getPrimaryAudioTrack();
|
const videoTrack = await input.getPrimaryVideoTrack();
|
||||||
const sink = new Mediabunny.EncodedPacketSink(audioTrack);
|
const sink = new Mediabunny.VideoSampleSink(videoTrack);
|
||||||
|
|
||||||
console.log(await audioTrack.getDecoderConfig())
|
console.log(await sink.getSample(await videoTrack.getFirstTimestamp()))
|
||||||
console.log(await sink.getFirstPacket());
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
for await (const sample of sink.samples(0.99)) {
|
||||||
|
console.log(sample);
|
||||||
|
|
||||||
|
if (sample.timestamp >= 2) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
//console.log(await sink.getSample(1))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
const screenStream = await navigator.mediaDevices.getDisplayMedia({ video: true });
|
const screenStream = await navigator.mediaDevices.getDisplayMedia({ video: true });
|
||||||
|
|||||||
Generated
+6
-6
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "mediabunny",
|
"name": "mediabunny",
|
||||||
"version": "1.14.0",
|
"version": "1.14.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "mediabunny",
|
"name": "mediabunny",
|
||||||
"version": "1.14.0",
|
"version": "1.14.1",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
@@ -7749,9 +7749,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mediabunny": {
|
"node_modules/mediabunny": {
|
||||||
"version": "1.13.3",
|
"version": "1.14.0",
|
||||||
"resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.13.3.tgz",
|
"resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.14.0.tgz",
|
||||||
"integrity": "sha512-kV12CVwMdhMQILGrVcyDWOgnZHwAytStQYKZeEaUj32XamYhlDX0Od4SkXVr0Yms8iapJsiCoEQdSK4UKUfooA==",
|
"integrity": "sha512-GaULQgUWpz5m4S7N6iNjpyLxqhpudjcSNGLC4Ni9A0A2vA6l5frBpxQJZM2JmqrN1B2BkArnCgyuTZv7ePw2vQ==",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"peer": true,
|
"peer": true,
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
@@ -12242,7 +12242,7 @@
|
|||||||
},
|
},
|
||||||
"packages/mp3-encoder": {
|
"packages/mp3-encoder": {
|
||||||
"name": "@mediabunny/mp3-encoder",
|
"name": "@mediabunny/mp3-encoder",
|
||||||
"version": "1.14.0",
|
"version": "1.14.1",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/emscripten": "^1.40.1"
|
"@types/emscripten": "^1.40.1"
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "mediabunny",
|
"name": "mediabunny",
|
||||||
"author": "Vanilagy",
|
"author": "Vanilagy",
|
||||||
"version": "1.14.0",
|
"version": "1.14.1",
|
||||||
"description": "Pure TypeScript media toolkit for reading, writing, and converting media files, directly in the browser.",
|
"description": "Pure TypeScript media toolkit for reading, writing, and converting media files, directly in the browser.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@mediabunny/mp3-encoder",
|
"name": "@mediabunny/mp3-encoder",
|
||||||
"author": "Vanilagy",
|
"author": "Vanilagy",
|
||||||
"version": "1.14.0",
|
"version": "1.14.1",
|
||||||
"description": "MP3 encoder extension for Mediabunny, based on LAME.",
|
"description": "MP3 encoder extension for Mediabunny, based on LAME.",
|
||||||
"main": "./dist/bundles/mediabunny-mp3-encoder.mjs",
|
"main": "./dist/bundles/mediabunny-mp3-encoder.mjs",
|
||||||
"module": "./dist/bundles/mediabunny-mp3-encoder.mjs",
|
"module": "./dist/bundles/mediabunny-mp3-encoder.mjs",
|
||||||
|
|||||||
+1
-1
@@ -723,7 +723,7 @@ export class Conversion {
|
|||||||
await tempOutput.start();
|
await tempOutput.start();
|
||||||
|
|
||||||
const sink = new VideoSampleSink(track);
|
const sink = new VideoSampleSink(track);
|
||||||
const firstSample = await sink.getSample(this._startTimestamp);
|
const firstSample = await sink.getSample(firstTimestamp); // Let's just use the first sample
|
||||||
|
|
||||||
if (firstSample) {
|
if (firstSample) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user