Merge main into release for tag v1.43.1

This commit is contained in:
github-actions[bot]
2026-05-02 12:29:10 +00:00
12 changed files with 84 additions and 40 deletions
+4 -2
View File
@@ -25,7 +25,7 @@
chunked: true, chunked: true,
chunkSize: 2**20 chunkSize: 2**20
}); });
const outputFormat = new Mediabunny.FlacOutputFormat(); const outputFormat = new Mediabunny.Mp4OutputFormat();
const p = document.createElement('p'); const p = document.createElement('p');
p.textContent = 'Capturing...'; p.textContent = 'Capturing...';
@@ -96,6 +96,7 @@
input, input,
output, output,
audio: { audio: {
discard: true,
//forceTranscode: true, //forceTranscode: true,
//sampleFormat: 's16', //sampleFormat: 's16',
}, },
@@ -124,7 +125,7 @@
}, },
*/ */
video: { video: {
discard: true, //discard: true,
}, },
tags: {} ?? { tags: {} ?? {
title: 'Bigggy', title: 'Bigggy',
@@ -144,6 +145,7 @@
} }
}, },
trim: { trim: {
end: 10,
//start: startTime, //start: startTime,
//end: startTime + 2, //end: startTime + 2,
}, },
+9 -9
View File
@@ -1,12 +1,12 @@
{ {
"name": "mediabunny", "name": "mediabunny",
"version": "1.43.0", "version": "1.43.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "mediabunny", "name": "mediabunny",
"version": "1.43.0", "version": "1.43.1",
"license": "MPL-2.0", "license": "MPL-2.0",
"workspaces": [ "workspaces": [
"packages/*" "packages/*"
@@ -7751,9 +7751,9 @@
} }
}, },
"node_modules/mediabunny": { "node_modules/mediabunny": {
"version": "1.42.0", "version": "1.43.0",
"resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.42.0.tgz", "resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.43.0.tgz",
"integrity": "sha512-s9ypTqLi6kbh95gC+YaJlG0PkLvMxu37Q/wO/pFZx0fUCA5Ym5mp+2dWoa83mKQ3Uo18aNlgev5iJ5ESZqWwgQ==", "integrity": "sha512-QGj6PcXXQvhs+29Pl25z3THv17g31k18zHUrJ25UQc5KWVN0vMKbMbB8KuHXNcseALIhbs6nh+wskimaeH/EEw==",
"license": "MPL-2.0", "license": "MPL-2.0",
"peer": true, "peer": true,
"workspaces": [ "workspaces": [
@@ -12077,7 +12077,7 @@
}, },
"packages/aac-encoder": { "packages/aac-encoder": {
"name": "@mediabunny/aac-encoder", "name": "@mediabunny/aac-encoder",
"version": "1.43.0", "version": "1.43.1",
"license": "MPL-2.0", "license": "MPL-2.0",
"devDependencies": { "devDependencies": {
"@types/emscripten": "^1.40.1" "@types/emscripten": "^1.40.1"
@@ -12092,7 +12092,7 @@
}, },
"packages/ac3": { "packages/ac3": {
"name": "@mediabunny/ac3", "name": "@mediabunny/ac3",
"version": "1.43.0", "version": "1.43.1",
"license": "MPL-2.0", "license": "MPL-2.0",
"devDependencies": { "devDependencies": {
"@types/emscripten": "^1.40.1" "@types/emscripten": "^1.40.1"
@@ -12107,7 +12107,7 @@
}, },
"packages/flac-encoder": { "packages/flac-encoder": {
"name": "@mediabunny/flac-encoder", "name": "@mediabunny/flac-encoder",
"version": "1.43.0", "version": "1.43.1",
"license": "MPL-2.0", "license": "MPL-2.0",
"devDependencies": { "devDependencies": {
"@types/emscripten": "^1.40.1" "@types/emscripten": "^1.40.1"
@@ -12122,7 +12122,7 @@
}, },
"packages/mp3-encoder": { "packages/mp3-encoder": {
"name": "@mediabunny/mp3-encoder", "name": "@mediabunny/mp3-encoder",
"version": "1.43.0", "version": "1.43.1",
"license": "MPL-2.0", "license": "MPL-2.0",
"devDependencies": { "devDependencies": {
"@types/emscripten": "^1.40.1" "@types/emscripten": "^1.40.1"
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "mediabunny", "name": "mediabunny",
"author": "Vanilagy", "author": "Vanilagy",
"version": "1.43.0", "version": "1.43.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 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "@mediabunny/aac-encoder", "name": "@mediabunny/aac-encoder",
"author": "Vanilagy", "author": "Vanilagy",
"version": "1.43.0", "version": "1.43.1",
"description": "AAC encoder extension for Mediabunny, based on FFmpeg.", "description": "AAC encoder extension for Mediabunny, based on FFmpeg.",
"main": "./dist/bundles/mediabunny-aac-encoder.mjs", "main": "./dist/bundles/mediabunny-aac-encoder.mjs",
"module": "./dist/bundles/mediabunny-aac-encoder.mjs", "module": "./dist/bundles/mediabunny-aac-encoder.mjs",
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "@mediabunny/ac3", "name": "@mediabunny/ac3",
"author": "Vanilagy", "author": "Vanilagy",
"version": "1.43.0", "version": "1.43.1",
"description": "AC-3 and E-AC-3 (Dolby Digital) decoder and encoder extension for Mediabunny, based on FFmpeg.", "description": "AC-3 and E-AC-3 (Dolby Digital) decoder and encoder extension for Mediabunny, based on FFmpeg.",
"main": "./dist/bundles/mediabunny-ac3.mjs", "main": "./dist/bundles/mediabunny-ac3.mjs",
"module": "./dist/bundles/mediabunny-ac3.mjs", "module": "./dist/bundles/mediabunny-ac3.mjs",
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "@mediabunny/flac-encoder", "name": "@mediabunny/flac-encoder",
"author": "Vanilagy", "author": "Vanilagy",
"version": "1.43.0", "version": "1.43.1",
"description": "FLAC encoder extension for Mediabunny, based on libFLAC.", "description": "FLAC encoder extension for Mediabunny, based on libFLAC.",
"main": "./dist/bundles/mediabunny-flac-encoder.mjs", "main": "./dist/bundles/mediabunny-flac-encoder.mjs",
"module": "./dist/bundles/mediabunny-flac-encoder.mjs", "module": "./dist/bundles/mediabunny-flac-encoder.mjs",
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "@mediabunny/mp3-encoder", "name": "@mediabunny/mp3-encoder",
"author": "Vanilagy", "author": "Vanilagy",
"version": "1.43.0", "version": "1.43.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",
+31
View File
@@ -784,6 +784,37 @@ export const validateVideoChunkMetadata = (metadata: EncodedVideoChunkMetadata |
'Video chunk metadata decoder configuration must specify a valid codedHeight (positive integer).', 'Video chunk metadata decoder configuration must specify a valid codedHeight (positive integer).',
); );
} }
if (
metadata.decoderConfig.displayAspectWidth !== undefined
&& (
!Number.isInteger(metadata.decoderConfig.displayAspectWidth)
|| metadata.decoderConfig.displayAspectWidth <= 0
)
) {
throw new TypeError(
'Video chunk metadata decoder configuration displayAspectWidth, when defined, must be a positive integer.',
);
}
if (
metadata.decoderConfig.displayAspectHeight !== undefined
&& (
!Number.isInteger(metadata.decoderConfig.displayAspectHeight)
|| metadata.decoderConfig.displayAspectHeight <= 0
)
) {
throw new TypeError(
'Video chunk metadata decoder configuration displayAspectHeight, when defined, must be a positive integer.',
);
}
if (
(metadata.decoderConfig.displayAspectWidth !== undefined)
!== (metadata.decoderConfig.displayAspectHeight !== undefined)
) {
throw new TypeError(
'Video chunk metadata decoder configuration must specify both displayAspectWidth and displayAspectHeight,'
+ ' or neither.',
);
}
if (metadata.decoderConfig.description !== undefined) { if (metadata.decoderConfig.description !== undefined) {
if (!isAllowSharedBufferSource(metadata.decoderConfig.description)) { if (!isAllowSharedBufferSource(metadata.decoderConfig.description)) {
throw new TypeError( throw new TypeError(
+7 -4
View File
@@ -1475,10 +1475,13 @@ export class IsobmffDemuxer extends Demuxer {
const num = readU32Be(slice); const num = readU32Be(slice);
const den = readU32Be(slice); const den = readU32Be(slice);
if (num > den) { // https://github.com/Vanilagy/mediabunny/issues/362
track.info.squarePixelWidth = Math.round(track.info.width * num / den); if (num > 0 && den > 0) {
} else { if (num > den) {
track.info.squarePixelHeight = Math.round(track.info.height * den / num); track.info.squarePixelWidth = Math.round(track.info.width * num / den);
} else {
track.info.squarePixelHeight = Math.round(track.info.height * den / num);
}
} }
}; break; }; break;
+10 -8
View File
@@ -1051,14 +1051,16 @@ export class MatroskaDemuxer extends Demuxer {
const num = this.currentTrack.info.displayWidth * this.currentTrack.info.height; const num = this.currentTrack.info.displayWidth * this.currentTrack.info.height;
const den = this.currentTrack.info.displayHeight * this.currentTrack.info.width; const den = this.currentTrack.info.displayHeight * this.currentTrack.info.width;
if (num > den) { if (num > 0 && den > 0) {
this.currentTrack.info.squarePixelWidth = Math.round( if (num > den) {
this.currentTrack.info.width * num / den, this.currentTrack.info.squarePixelWidth = Math.round(
); this.currentTrack.info.width * num / den,
} else { );
this.currentTrack.info.squarePixelHeight = Math.round( } else {
this.currentTrack.info.height * den / num, this.currentTrack.info.squarePixelHeight = Math.round(
); this.currentTrack.info.height * den / num,
);
}
} }
} }
+2
View File
@@ -938,6 +938,8 @@ export type Rational = {
}; };
export const simplifyRational = (rational: Rational): Rational => { export const simplifyRational = (rational: Rational): Rational => {
assert(Number.isInteger(rational.num));
assert(Number.isInteger(rational.den));
assert(rational.den !== 0); assert(rational.den !== 0);
let a = Math.abs(rational.num); let a = Math.abs(rational.num);
+16 -12
View File
@@ -474,18 +474,22 @@ export class MpegTsDemuxer extends Demuxer {
elementaryStream.info.width = spsInfo.displayWidth; elementaryStream.info.width = spsInfo.displayWidth;
elementaryStream.info.height = spsInfo.displayHeight; elementaryStream.info.height = spsInfo.displayHeight;
if (spsInfo.pixelAspectRatio.num > spsInfo.pixelAspectRatio.den) {
elementaryStream.info.squarePixelWidth = Math.round( const num = spsInfo.pixelAspectRatio.num;
elementaryStream.info.width const den = spsInfo.pixelAspectRatio.den;
* spsInfo.pixelAspectRatio.num / spsInfo.pixelAspectRatio.den,
); if (num > 0 && den > 0) {
elementaryStream.info.squarePixelHeight = elementaryStream.info.height; if (num > den) {
} else { elementaryStream.info.squarePixelWidth = Math.round(
elementaryStream.info.squarePixelWidth = elementaryStream.info.width; elementaryStream.info.width * num / den,
elementaryStream.info.squarePixelHeight = Math.round( );
elementaryStream.info.height elementaryStream.info.squarePixelHeight = elementaryStream.info.height;
* spsInfo.pixelAspectRatio.den / spsInfo.pixelAspectRatio.num, } else {
); elementaryStream.info.squarePixelWidth = elementaryStream.info.width;
elementaryStream.info.squarePixelHeight = Math.round(
elementaryStream.info.height * den / num,
);
}
} }
elementaryStream.info.colorSpace = { elementaryStream.info.colorSpace = {