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,
chunkSize: 2**20
});
const outputFormat = new Mediabunny.FlacOutputFormat();
const outputFormat = new Mediabunny.Mp4OutputFormat();
const p = document.createElement('p');
p.textContent = 'Capturing...';
@@ -96,6 +96,7 @@
input,
output,
audio: {
discard: true,
//forceTranscode: true,
//sampleFormat: 's16',
},
@@ -124,7 +125,7 @@
},
*/
video: {
discard: true,
//discard: true,
},
tags: {} ?? {
title: 'Bigggy',
@@ -144,6 +145,7 @@
}
},
trim: {
end: 10,
//start: startTime,
//end: startTime + 2,
},
+9 -9
View File
@@ -1,12 +1,12 @@
{
"name": "mediabunny",
"version": "1.43.0",
"version": "1.43.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "mediabunny",
"version": "1.43.0",
"version": "1.43.1",
"license": "MPL-2.0",
"workspaces": [
"packages/*"
@@ -7751,9 +7751,9 @@
}
},
"node_modules/mediabunny": {
"version": "1.42.0",
"resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.42.0.tgz",
"integrity": "sha512-s9ypTqLi6kbh95gC+YaJlG0PkLvMxu37Q/wO/pFZx0fUCA5Ym5mp+2dWoa83mKQ3Uo18aNlgev5iJ5ESZqWwgQ==",
"version": "1.43.0",
"resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.43.0.tgz",
"integrity": "sha512-QGj6PcXXQvhs+29Pl25z3THv17g31k18zHUrJ25UQc5KWVN0vMKbMbB8KuHXNcseALIhbs6nh+wskimaeH/EEw==",
"license": "MPL-2.0",
"peer": true,
"workspaces": [
@@ -12077,7 +12077,7 @@
},
"packages/aac-encoder": {
"name": "@mediabunny/aac-encoder",
"version": "1.43.0",
"version": "1.43.1",
"license": "MPL-2.0",
"devDependencies": {
"@types/emscripten": "^1.40.1"
@@ -12092,7 +12092,7 @@
},
"packages/ac3": {
"name": "@mediabunny/ac3",
"version": "1.43.0",
"version": "1.43.1",
"license": "MPL-2.0",
"devDependencies": {
"@types/emscripten": "^1.40.1"
@@ -12107,7 +12107,7 @@
},
"packages/flac-encoder": {
"name": "@mediabunny/flac-encoder",
"version": "1.43.0",
"version": "1.43.1",
"license": "MPL-2.0",
"devDependencies": {
"@types/emscripten": "^1.40.1"
@@ -12122,7 +12122,7 @@
},
"packages/mp3-encoder": {
"name": "@mediabunny/mp3-encoder",
"version": "1.43.0",
"version": "1.43.1",
"license": "MPL-2.0",
"devDependencies": {
"@types/emscripten": "^1.40.1"
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "mediabunny",
"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.",
"type": "module",
"workspaces": [
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@mediabunny/aac-encoder",
"author": "Vanilagy",
"version": "1.43.0",
"version": "1.43.1",
"description": "AAC encoder extension for Mediabunny, based on FFmpeg.",
"main": "./dist/bundles/mediabunny-aac-encoder.mjs",
"module": "./dist/bundles/mediabunny-aac-encoder.mjs",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@mediabunny/ac3",
"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.",
"main": "./dist/bundles/mediabunny-ac3.mjs",
"module": "./dist/bundles/mediabunny-ac3.mjs",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@mediabunny/flac-encoder",
"author": "Vanilagy",
"version": "1.43.0",
"version": "1.43.1",
"description": "FLAC encoder extension for Mediabunny, based on libFLAC.",
"main": "./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",
"author": "Vanilagy",
"version": "1.43.0",
"version": "1.43.1",
"description": "MP3 encoder extension for Mediabunny, based on LAME.",
"main": "./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).',
);
}
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 (!isAllowSharedBufferSource(metadata.decoderConfig.description)) {
throw new TypeError(
+7 -4
View File
@@ -1475,10 +1475,13 @@ export class IsobmffDemuxer extends Demuxer {
const num = readU32Be(slice);
const den = readU32Be(slice);
if (num > den) {
track.info.squarePixelWidth = Math.round(track.info.width * num / den);
} else {
track.info.squarePixelHeight = Math.round(track.info.height * den / num);
// https://github.com/Vanilagy/mediabunny/issues/362
if (num > 0 && den > 0) {
if (num > den) {
track.info.squarePixelWidth = Math.round(track.info.width * num / den);
} else {
track.info.squarePixelHeight = Math.round(track.info.height * den / num);
}
}
}; 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 den = this.currentTrack.info.displayHeight * this.currentTrack.info.width;
if (num > den) {
this.currentTrack.info.squarePixelWidth = Math.round(
this.currentTrack.info.width * num / den,
);
} else {
this.currentTrack.info.squarePixelHeight = Math.round(
this.currentTrack.info.height * den / num,
);
if (num > 0 && den > 0) {
if (num > den) {
this.currentTrack.info.squarePixelWidth = Math.round(
this.currentTrack.info.width * num / den,
);
} else {
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 => {
assert(Number.isInteger(rational.num));
assert(Number.isInteger(rational.den));
assert(rational.den !== 0);
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.height = spsInfo.displayHeight;
if (spsInfo.pixelAspectRatio.num > spsInfo.pixelAspectRatio.den) {
elementaryStream.info.squarePixelWidth = Math.round(
elementaryStream.info.width
* spsInfo.pixelAspectRatio.num / spsInfo.pixelAspectRatio.den,
);
elementaryStream.info.squarePixelHeight = elementaryStream.info.height;
} else {
elementaryStream.info.squarePixelWidth = elementaryStream.info.width;
elementaryStream.info.squarePixelHeight = Math.round(
elementaryStream.info.height
* spsInfo.pixelAspectRatio.den / spsInfo.pixelAspectRatio.num,
);
const num = spsInfo.pixelAspectRatio.num;
const den = spsInfo.pixelAspectRatio.den;
if (num > 0 && den > 0) {
if (num > den) {
elementaryStream.info.squarePixelWidth = Math.round(
elementaryStream.info.width * num / den,
);
elementaryStream.info.squarePixelHeight = elementaryStream.info.height;
} else {
elementaryStream.info.squarePixelWidth = elementaryStream.info.width;
elementaryStream.info.squarePixelHeight = Math.round(
elementaryStream.info.height * den / num,
);
}
}
elementaryStream.info.colorSpace = {