@remotion/media 4.0.423 → 4.0.425

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,6 +36,9 @@ var __callDispose = (stack, error, hasError) => {
36
36
  return next();
37
37
  };
38
38
 
39
+ // src/index.ts
40
+ import { registerAc3Decoder } from "@mediabunny/ac3";
41
+
39
42
  // src/audio/audio.tsx
40
43
  import { Internals as Internals15, useRemotionEnvironment as useRemotionEnvironment2 } from "remotion";
41
44
 
@@ -2409,6 +2412,17 @@ var makeKeyframeBank = async ({
2409
2412
  let hasReachedEndOfVideo = false;
2410
2413
  let lastUsed = Date.now();
2411
2414
  let allocationSize = 0;
2415
+ const getDurationOfFrame = (timestamp) => {
2416
+ const index = frameTimestamps.indexOf(timestamp);
2417
+ if (index === -1) {
2418
+ throw new Error(`Frame ${timestamp} not found`);
2419
+ }
2420
+ const nextTimestamp = frameTimestamps[index + 1];
2421
+ if (!nextTimestamp) {
2422
+ return null;
2423
+ }
2424
+ return nextTimestamp - timestamp;
2425
+ };
2412
2426
  const deleteFrameAtTimestamp = (timestamp) => {
2413
2427
  allocationSize -= getAllocationSize(frames[timestamp]);
2414
2428
  frameTimestamps.splice(frameTimestamps.indexOf(timestamp), 1);
@@ -2430,7 +2444,7 @@ var makeKeyframeBank = async ({
2430
2444
  if (!frames[frameTimestamp]) {
2431
2445
  continue;
2432
2446
  }
2433
- const { duration } = frames[frameTimestamp];
2447
+ const duration = getDurationOfFrame(frameTimestamp) ?? frames[frameTimestamp].duration;
2434
2448
  if (frameTimestamp + duration < timestampInSeconds) {
2435
2449
  deleteFrameAtTimestamp(frameTimestamp);
2436
2450
  deletedTimestamps.push(frameTimestamp);
@@ -2449,7 +2463,8 @@ var makeKeyframeBank = async ({
2449
2463
  if (!lastFrame) {
2450
2464
  return true;
2451
2465
  }
2452
- return roundTo4Digits(lastFrame.timestamp + lastFrame.duration) > roundTo4Digits(timestamp);
2466
+ const duration = getDurationOfFrame(lastFrameTimestamp) ?? lastFrame.duration;
2467
+ return roundTo4Digits(lastFrameTimestamp + duration) > roundTo4Digits(timestamp);
2453
2468
  };
2454
2469
  const addFrame = (frame, logLevel) => {
2455
2470
  if (frames[frame.timestamp]) {
@@ -2523,9 +2538,10 @@ var makeKeyframeBank = async ({
2523
2538
  const firstTimestamp = frameTimestamps[0];
2524
2539
  const lastTimestamp = frameTimestamps[frameTimestamps.length - 1];
2525
2540
  const lastFrame = frames[lastTimestamp];
2541
+ const lastFrameDuration = getDurationOfFrame(lastTimestamp) ?? lastFrame.duration ?? 0;
2526
2542
  return {
2527
2543
  firstTimestamp,
2528
- lastTimestamp: lastTimestamp + lastFrame.duration
2544
+ lastTimestamp: lastTimestamp + lastFrameDuration
2529
2545
  };
2530
2546
  };
2531
2547
  const prepareForDeletion = (logLevel, reason) => {
@@ -4944,9 +4960,11 @@ var Video = ({
4944
4960
  });
4945
4961
  };
4946
4962
  Internals18.addSequenceStackTraces(Video);
4963
+
4947
4964
  // src/index.ts
4948
4965
  var experimental_Audio = Audio;
4949
4966
  var experimental_Video = Video;
4967
+ registerAc3Decoder();
4950
4968
  export {
4951
4969
  experimental_Video,
4952
4970
  experimental_Audio,
@@ -1,2 +1,2 @@
1
- import type { VideoSample } from 'mediabunny';
2
- export declare const getAllocationSize: (sample: VideoSample) => number;
1
+ import type { VideoSampleWithoutDuration } from './keyframe-bank';
2
+ export declare const getAllocationSize: (sample: VideoSampleWithoutDuration) => number;
@@ -1,8 +1,9 @@
1
1
  import type { VideoSample, VideoSampleSink } from 'mediabunny';
2
2
  import { type LogLevel } from 'remotion';
3
+ export type VideoSampleWithoutDuration = Omit<VideoSample, 'duration'>;
3
4
  export type KeyframeBank = {
4
5
  src: string;
5
- getFrameFromTimestamp: (timestamp: number, fps: number) => Promise<VideoSample | null>;
6
+ getFrameFromTimestamp: (timestamp: number, fps: number) => Promise<VideoSampleWithoutDuration | null>;
6
7
  prepareForDeletion: (logLevel: LogLevel, reason: string) => {
7
8
  framesDeleted: number;
8
9
  };
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@remotion/media",
3
- "version": "4.0.423",
3
+ "version": "4.0.425",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/esm/index.mjs",
7
7
  "repository": {
8
8
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/media"
9
9
  },
10
- "sideEffects": false,
11
10
  "author": "Jonny Burger <jonny@remotion.dev>, Hunain Ahmed <junaidhunain6@gmail.com>",
12
11
  "bugs": {
13
12
  "url": "https://github.com/remotion-dev/remotion/issues"
@@ -15,30 +14,30 @@
15
14
  "type": "module",
16
15
  "scripts": {
17
16
  "if-node-18+": "node -e \"const [maj]=process.versions.node.split('.').map(Number); process.exit(maj>=18?0:1)\"",
18
- "formatting": "prettier --experimental-cli src --check",
17
+ "formatting": "prettier src --check",
19
18
  "lint": "eslint src",
20
19
  "watch": "tsgo -w",
21
20
  "test": "node src/test/execute.mjs",
22
21
  "make": "tsgo && bun --env-file=../.env.bundle bundle.ts"
23
22
  },
24
23
  "dependencies": {
25
- "mediabunny": "1.34.2",
26
- "@mediabunny/ac3": "1.34.2",
27
- "remotion": "4.0.423"
24
+ "mediabunny": "1.34.4",
25
+ "@mediabunny/ac3": "1.34.4",
26
+ "remotion": "4.0.425"
28
27
  },
29
28
  "peerDependencies": {
30
29
  "react": ">=16.8.0",
31
30
  "react-dom": ">=16.8.0"
32
31
  },
33
32
  "devDependencies": {
34
- "@remotion/eslint-config-internal": "4.0.423",
33
+ "@remotion/eslint-config-internal": "4.0.425",
35
34
  "@vitest/browser-webdriverio": "4.0.9",
36
35
  "eslint": "9.19.0",
37
36
  "react": "19.2.3",
38
37
  "react-dom": "19.2.3",
39
38
  "vitest": "4.0.9",
40
39
  "webdriverio": "9.19.2",
41
- "@typescript/native-preview": "7.0.0-dev.20260105.1"
40
+ "@typescript/native-preview": "7.0.0-dev.20260217.1"
42
41
  },
43
42
  "keywords": [],
44
43
  "publishConfig": {