mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-05 23:03:54 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
149a2b4571 | ||
|
|
0c455236da | ||
|
|
41fb9657cb | ||
|
|
d77ddf033b | ||
|
|
b9f48ca9ef | ||
|
|
aa38385cae |
@@ -148,6 +148,7 @@ const sponsors = {
|
||||
{ image: 'https://avatars.githubusercontent.com/u/13042781', name: 'Anshul Bansal', url: 'https://github.com/akbansa' },
|
||||
{ image: 'https://avatars.githubusercontent.com/u/43105172', name: 'zhmou', url: 'https://github.com/zhmou' },
|
||||
{ image: 'https://avatars.githubusercontent.com/u/695166', name: 'Takenori Nakagawa', url: 'https://github.com/ww24' },
|
||||
{ image: 'https://avatars.githubusercontent.com/u/43607012', name: 'Sturlen', url: 'https://github.com/Sturlen' },
|
||||
],
|
||||
};
|
||||
</script>
|
||||
|
||||
Generated
+7
-7
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "mediabunny",
|
||||
"version": "1.45.1",
|
||||
"version": "1.45.3",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "mediabunny",
|
||||
"version": "1.45.1",
|
||||
"version": "1.45.3",
|
||||
"license": "MPL-2.0",
|
||||
"workspaces": [
|
||||
".",
|
||||
@@ -12806,7 +12806,7 @@
|
||||
},
|
||||
"packages/aac-encoder": {
|
||||
"name": "@mediabunny/aac-encoder",
|
||||
"version": "1.45.1",
|
||||
"version": "1.45.3",
|
||||
"license": "MPL-2.0",
|
||||
"devDependencies": {
|
||||
"@types/emscripten": "^1.40.1"
|
||||
@@ -12821,7 +12821,7 @@
|
||||
},
|
||||
"packages/ac3": {
|
||||
"name": "@mediabunny/ac3",
|
||||
"version": "1.45.1",
|
||||
"version": "1.45.3",
|
||||
"license": "MPL-2.0",
|
||||
"devDependencies": {
|
||||
"@types/emscripten": "^1.40.1"
|
||||
@@ -12836,7 +12836,7 @@
|
||||
},
|
||||
"packages/flac-encoder": {
|
||||
"name": "@mediabunny/flac-encoder",
|
||||
"version": "1.45.1",
|
||||
"version": "1.45.3",
|
||||
"license": "MPL-2.0",
|
||||
"devDependencies": {
|
||||
"@types/emscripten": "^1.40.1"
|
||||
@@ -12851,7 +12851,7 @@
|
||||
},
|
||||
"packages/mp3-encoder": {
|
||||
"name": "@mediabunny/mp3-encoder",
|
||||
"version": "1.45.1",
|
||||
"version": "1.45.3",
|
||||
"license": "MPL-2.0",
|
||||
"devDependencies": {
|
||||
"@types/emscripten": "^1.40.1"
|
||||
@@ -12866,7 +12866,7 @@
|
||||
},
|
||||
"packages/server": {
|
||||
"name": "@mediabunny/server",
|
||||
"version": "1.45.1",
|
||||
"version": "1.45.3",
|
||||
"license": "MPL-2.0",
|
||||
"dependencies": {
|
||||
"node-av": "^5.2.4"
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "mediabunny",
|
||||
"author": "Vanilagy",
|
||||
"version": "1.45.1",
|
||||
"version": "1.45.3",
|
||||
"description": "Pure TypeScript media toolkit for reading, writing, and converting media files, directly in the browser.",
|
||||
"type": "module",
|
||||
"workspaces": [
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@mediabunny/aac-encoder",
|
||||
"author": "Vanilagy",
|
||||
"version": "1.45.1",
|
||||
"version": "1.45.3",
|
||||
"description": "AAC encoder extension for Mediabunny, based on FFmpeg.",
|
||||
"main": "./dist/bundles/mediabunny-aac-encoder.mjs",
|
||||
"module": "./dist/bundles/mediabunny-aac-encoder.mjs",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@mediabunny/ac3",
|
||||
"author": "Vanilagy",
|
||||
"version": "1.45.1",
|
||||
"version": "1.45.3",
|
||||
"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,7 +1,7 @@
|
||||
{
|
||||
"name": "@mediabunny/flac-encoder",
|
||||
"author": "Vanilagy",
|
||||
"version": "1.45.1",
|
||||
"version": "1.45.3",
|
||||
"description": "FLAC encoder extension for Mediabunny, based on libFLAC.",
|
||||
"main": "./dist/bundles/mediabunny-flac-encoder.mjs",
|
||||
"module": "./dist/bundles/mediabunny-flac-encoder.mjs",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@mediabunny/mp3-encoder",
|
||||
"author": "Vanilagy",
|
||||
"version": "1.45.1",
|
||||
"version": "1.45.3",
|
||||
"description": "MP3 encoder extension for Mediabunny, based on LAME.",
|
||||
"main": "./dist/bundles/mediabunny-mp3-encoder.mjs",
|
||||
"module": "./dist/bundles/mediabunny-mp3-encoder.mjs",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@mediabunny/server",
|
||||
"author": "Vanilagy",
|
||||
"version": "1.45.1",
|
||||
"version": "1.45.3",
|
||||
"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",
|
||||
|
||||
+1
-1
@@ -488,7 +488,7 @@ export class Id3V2Reader {
|
||||
|
||||
readU24() {
|
||||
const high = this.view.getUint16(this.pos, false);
|
||||
const low = this.view.getUint8(this.pos + 1);
|
||||
const low = this.view.getUint8(this.pos + 2);
|
||||
this.pos += 3;
|
||||
return high * 0x100 + low;
|
||||
}
|
||||
|
||||
+23
-6
@@ -46,7 +46,7 @@ import {
|
||||
customVideoEncoders,
|
||||
customAudioEncoders,
|
||||
} from './custom-coder';
|
||||
import { EncodedPacket, EncodedPacketSideData } from './packet';
|
||||
import { EncodedPacket, EncodedPacketSideData, PacketType } from './packet';
|
||||
import {
|
||||
AudioSample,
|
||||
audioSampleToInterleavedFormat,
|
||||
@@ -63,6 +63,7 @@ import {
|
||||
VideoEncodingConfig,
|
||||
} from './encode';
|
||||
import { AudioResampler } from './resample';
|
||||
import { determineVideoPacketType } from './codec-data';
|
||||
|
||||
/**
|
||||
* Base class for media sources. Media sources are used to add media samples to an output file.
|
||||
@@ -224,6 +225,7 @@ class VideoEncoderWrapper {
|
||||
private encoder: VideoEncoder | null = null;
|
||||
private muxer: Muxer | null = null;
|
||||
private lastMultipleOfKeyFrameInterval = -1;
|
||||
private emittedEncoderPackets = 0;
|
||||
|
||||
// Tracks the input dimensions of the first frame
|
||||
private codedWidth: number | null = null;
|
||||
@@ -694,6 +696,7 @@ class VideoEncoderWrapper {
|
||||
|
||||
let packet = EncodedPacket.fromEncodedChunk(colorChunk, sideData);
|
||||
|
||||
// See if there's a relevant timing entry to refine the packet's timing data
|
||||
const preciseTimingIndex = binarySearchLessOrEqual(
|
||||
this.preciseTimings,
|
||||
colorChunk.timestamp,
|
||||
@@ -703,12 +706,24 @@ class VideoEncoderWrapper {
|
||||
? this.preciseTimings[preciseTimingIndex]
|
||||
: null;
|
||||
|
||||
// If there's a relevant timing entry, refine the packet's timing data to get better accuracy than
|
||||
// microseconds
|
||||
if (entry && entry.microsecondTimestamp === colorChunk.timestamp) {
|
||||
let actualType: PacketType | null = null;
|
||||
if (this.emittedEncoderPackets === 0 && packet.type === 'delta' && meta?.decoderConfig) {
|
||||
// https://github.com/Vanilagy/mediabunny/issues/365
|
||||
// We expect the first packet to be a key packet. If it's not, let's actually verify that it's
|
||||
// not by getting the actual type.
|
||||
actualType = determineVideoPacketType(
|
||||
this.encodingConfig.codec,
|
||||
meta.decoderConfig,
|
||||
packet.data,
|
||||
);
|
||||
}
|
||||
|
||||
// Define the packet
|
||||
if ((entry && entry.microsecondTimestamp === colorChunk.timestamp) || actualType !== null) {
|
||||
packet = packet.clone({
|
||||
timestamp: entry.timestampIsValid ? entry.timestamp : undefined,
|
||||
duration: entry.durationIsValid ? entry.duration : undefined,
|
||||
timestamp: entry?.timestampIsValid ? entry.timestamp : undefined,
|
||||
duration: entry?.durationIsValid ? entry.duration : undefined,
|
||||
type: actualType ?? undefined,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -720,6 +735,8 @@ class VideoEncoderWrapper {
|
||||
.catch((error) => {
|
||||
this.error ??= error;
|
||||
});
|
||||
|
||||
this.emittedEncoderPackets++;
|
||||
};
|
||||
|
||||
const stack = new Error('Encoding error').stack;
|
||||
|
||||
Reference in New Issue
Block a user