Compare commits

...
9 Commits
15 changed files with 83 additions and 41 deletions
-8
View File
@@ -44,14 +44,6 @@ Mediabunny is a JavaScript library for reading, writing, and converting media (l
</a>
</div>
### Silver sponsors
<div align="center">
<a href="https://ponder.ai/" target="_blank" rel="sponsored">
<img src="./docs/public/sponsors/ponder.png" width="50" height="50" alt="Ponder">
</a>
</div>
### Bronze sponsors
<div align="center">
+1 -3
View File
@@ -102,9 +102,7 @@ const sponsors = {
{ image: '/sponsors/screen-studio.webp', name: 'Screen Studio', url: 'https://screen.studio/' },
{ image: '/sponsors/tella.svg', name: 'Tella', url: 'https://www.tella.com/' },
],
silver: [
{ image: '/sponsors/ponder.png', name: 'Ponder', url: 'https://ponder.ai/' },
],
silver: [],
bronze: [
{ image: '/sponsors/elevenlabs.png', name: 'ElevenLabs', url: 'https://elevenlabs.io/' },
{ image: '/sponsors/rve.png', name: 'React Video Editor', url: 'https://www.reactvideoeditor.com/' },
+9 -9
View File
@@ -1,12 +1,12 @@
{
"name": "mediabunny",
"version": "1.50.4",
"version": "1.50.7",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "mediabunny",
"version": "1.50.4",
"version": "1.50.7",
"license": "MPL-2.0",
"workspaces": [
".",
@@ -12894,7 +12894,7 @@
},
"packages/aac-encoder": {
"name": "@mediabunny/aac-encoder",
"version": "1.50.4",
"version": "1.50.7",
"license": "MPL-2.0",
"devDependencies": {
"@types/emscripten": "^1.40.1"
@@ -12909,7 +12909,7 @@
},
"packages/ac3": {
"name": "@mediabunny/ac3",
"version": "1.50.4",
"version": "1.50.7",
"license": "MPL-2.0",
"devDependencies": {
"@types/emscripten": "^1.40.1"
@@ -12924,7 +12924,7 @@
},
"packages/flac-encoder": {
"name": "@mediabunny/flac-encoder",
"version": "1.50.4",
"version": "1.50.7",
"license": "MPL-2.0",
"devDependencies": {
"@types/emscripten": "^1.40.1"
@@ -12939,7 +12939,7 @@
},
"packages/mp3-encoder": {
"name": "@mediabunny/mp3-encoder",
"version": "1.50.4",
"version": "1.50.7",
"license": "MPL-2.0",
"devDependencies": {
"@types/emscripten": "^1.40.1"
@@ -12954,7 +12954,7 @@
},
"packages/prores": {
"name": "@mediabunny/prores",
"version": "1.50.4",
"version": "1.50.7",
"license": "MPL-2.0",
"dependencies": {
"turbores": "^1.2.1"
@@ -12969,10 +12969,10 @@
},
"packages/server": {
"name": "@mediabunny/server",
"version": "1.50.4",
"version": "1.50.7",
"license": "MPL-2.0",
"dependencies": {
"@mediabunny/prores": "^1.50.0",
"@mediabunny/prores": "^1.50.6",
"node-av": "^6.0.0"
},
"funding": {
+5 -5
View File
@@ -1,7 +1,7 @@
{
"name": "mediabunny",
"author": "Vanilagy",
"version": "1.50.4",
"version": "1.50.7",
"description": "Pure TypeScript media toolkit for reading, writing, and converting media files, directly in the browser.",
"type": "module",
"workspaces": [
@@ -56,10 +56,10 @@
"examples:build": "vite build",
"fix-build-import-paths": "tsx scripts/add-import-extensions.ts",
"append-namespace": "echo 'export as namespace Mediabunny;' >> dist/mediabunny.d.ts",
"bump-patch": "npm version patch --no-git-tag-version --workspaces",
"bump-minor": "npm version minor --no-git-tag-version --workspaces",
"bump-major": "npm version major --no-git-tag-version --workspaces",
"set-version": "npm version --no-git-tag-version --workspaces"
"bump-patch": "npm version patch --no-git-tag-version --workspaces && tsx scripts/sync-workspace-deps.ts",
"bump-minor": "npm version minor --no-git-tag-version --workspaces && tsx scripts/sync-workspace-deps.ts",
"bump-major": "npm version major --no-git-tag-version --workspaces && tsx scripts/sync-workspace-deps.ts",
"set-version": "npm version --no-git-tag-version --workspaces && tsx scripts/sync-workspace-deps.ts"
},
"license": "MPL-2.0",
"repository": {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@mediabunny/aac-encoder",
"author": "Vanilagy",
"version": "1.50.4",
"version": "1.50.7",
"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.50.4",
"version": "1.50.7",
"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.50.4",
"version": "1.50.7",
"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.50.4",
"version": "1.50.7",
"description": "MP3 encoder extension for Mediabunny, based on LAME.",
"main": "./dist/bundles/mediabunny-mp3-encoder.mjs",
"module": "./dist/bundles/mediabunny-mp3-encoder.mjs",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@mediabunny/prores",
"author": "Vanilagy",
"version": "1.50.4",
"version": "1.50.7",
"description": "Apple ProRes decoder extension for Mediabunny, based on TurboRes.",
"main": "./dist/bundles/mediabunny-prores.mjs",
"module": "./dist/bundles/mediabunny-prores.mjs",
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "@mediabunny/server",
"author": "Vanilagy",
"version": "1.50.4",
"version": "1.50.7",
"description": "Adds full video and audio decoder and encoder support to Mediabunny for use in server-side environments (Node, Bun, Deno). Based on NodeAV.",
"main": "./dist/bundles/mediabunny-server.cjs",
"module": "./dist/bundles/mediabunny-server.mjs",
@@ -35,7 +35,7 @@
},
"dependencies": {
"node-av": "^6.0.0",
"@mediabunny/prores": "^1.50.0"
"@mediabunny/prores": "^1.50.7"
},
"peerDependencies": {
"mediabunny": "^1.45.0"
+40
View File
@@ -0,0 +1,40 @@
import fs from 'node:fs';
import path from 'node:path';
// After `npm version --workspaces` bumps each package's version, this rewrites dependency ranges that point at sibling
// workspaces so they follow along.
const root = path.join(import.meta.dirname, '..');
const workspaceDirs = ['.', ...fs.readdirSync(path.join(root, 'packages')).map(x => `packages/${x}`)]
.filter(dir => fs.existsSync(path.join(root, dir, 'package.json')));
type Manifest = {
name: string;
version: string;
dependencies?: Record<string, string>;
};
const manifests = workspaceDirs.map((dir) => {
const filePath = path.join(root, dir, 'package.json');
return { filePath, json: JSON.parse(fs.readFileSync(filePath, 'utf8')) as Manifest };
});
const versions = new Map(manifests.map(({ json }) => [json.name, json.version]));
for (const { filePath, json } of manifests) {
let changed = false;
for (const name of Object.keys(json.dependencies ?? {})) {
const version = versions.get(name);
if (version && json.dependencies![name] !== `^${version}`) {
json.dependencies![name] = `^${version}`;
changed = true;
}
}
if (changed) {
fs.writeFileSync(filePath, JSON.stringify(json, null, 2) + '\n');
console.log(`Synced workspace dependency ranges in ${path.relative(root, filePath)}`);
}
}
+2 -1
View File
@@ -544,7 +544,8 @@ export class InputVideoTrack extends InputTrack {
}
async hasOnlyKeyPackets() {
return (await this._backing.getHasOnlyKeyPackets?.()) ?? false;
return (await this._backing.getHasOnlyKeyPackets?.())
?? (await this._backing.getCodec() === 'prores'); // Only ProRes is fully intra-frame
}
/** Returns the width in pixels of the track's coded samples, before any transformations or rotations. */
+11 -4
View File
@@ -1011,15 +1011,22 @@ class VideoDecoderWrapper extends DecoderWrapper<VideoSample> {
if (this.codec === 'avc') {
// Workaround for https://issues.chromium.org/issues/470109459
const filteredNalUnits: Uint8Array[] = [];
let hasFrameData = false;
for (const loc of iterateAvcNalUnits(packet.data, this.decoderConfig)) {
const type = extractNalUnitTypeForAvc(packet.data[loc.offset]!);
hasFrameData ||= type >= 1 && type <= 5;
if (type === AvcNalUnitType.AUD) {
// If packets contain an AUD and have NALUs before it, this trips up Chromium's key frame
// detector. Clear the NALUs if an AUD is encountered.
// https://github.com/Vanilagy/mediabunny/issues/396
filteredNalUnits.length = 0;
if (hasFrameData) {
// Already has actual frame data, so treat an AUD as simply the end of the packet
break;
} else {
// If packets contain an AUD and have NALUs before it, this trips up Chromium's key
// frame detector. Clear the NALUs if an AUD is encountered.
// https://github.com/Vanilagy/mediabunny/issues/396
filteredNalUnits.length = 0;
}
}
// These trip up Chromium's key frame detection, so let's strip them
+1 -1
View File
@@ -199,7 +199,7 @@ export class AudioResampler {
const inputEndTime = inputStartTime + audioSample.duration;
// Compute which output frames are affected by this sample
const outputStartFrame = Math.floor(inputStartTime * this.targetSampleRate);
const outputStartFrame = Math.floor((inputStartTime - 1 / this.sourceSampleRate) * this.targetSampleRate) + 1;
const outputEndFrame = Math.ceil(inputEndTime * this.targetSampleRate);
for (let outputFrame = outputStartFrame; outputFrame < outputEndFrame; outputFrame++) {
+7 -3
View File
@@ -2129,7 +2129,7 @@ class ReadOrchestrator {
}
})
.finally(() => {
if (worker.running || this.workers.length >= this.options.maxWorkerCount) {
if (worker.running) {
// Rare, but can happen with multiple concurrent reads. In this case, don't do anything.
return;
}
@@ -2144,15 +2144,19 @@ class ReadOrchestrator {
}
const queuedRead = this.queuedReads[oldestIndex]!;
this.queuedReads.splice(oldestIndex, 1);
const newWorker = this.createWorker(
queuedRead.hole.start,
queuedRead.hole.end,
queuedRead.strictTarget,
);
assert(newWorker); // We just freed up a worker, so this should never fail
if (!newWorker) {
// In high-contention cases, it could be that we've already reached max worker count, so in this
// case we don't do anything.
return;
}
this.queuedReads.splice(oldestIndex, 1);
newWorker.pendingSlices = queuedRead.pendingSlices;
this.runWorker(newWorker);
}