@remotion/renderer 3.3.16 → 3.3.18

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.
@@ -42,6 +42,7 @@ const calculateAssetPositions = (frames) => {
42
42
  trimLeft: asset.mediaFrame,
43
43
  volume: [],
44
44
  playbackRate: asset.playbackRate,
45
+ allowAmplificationDuringRender: asset.allowAmplificationDuringRender,
45
46
  });
46
47
  }
47
48
  const found = assets.find((a) => a.duration === null && areEqual(a, asset));
@@ -4,9 +4,10 @@ declare type FfmpegVolumeExpression = {
4
4
  eval: FfmpegEval;
5
5
  value: string;
6
6
  };
7
- export declare const ffmpegVolumeExpression: ({ volume, fps, trimLeft, }: {
7
+ export declare const ffmpegVolumeExpression: ({ volume, fps, trimLeft, allowAmplificationDuringRender, }: {
8
8
  volume: AssetVolume;
9
9
  trimLeft: number;
10
10
  fps: number;
11
+ allowAmplificationDuringRender: boolean;
11
12
  }) => FfmpegVolumeExpression;
12
13
  export {};
@@ -43,13 +43,14 @@ const ffmpegBuildVolumeExpression = (arr, delay, fps) => {
43
43
  const [volume, frames] = first;
44
44
  return ffmpegIfOrElse(ffmpegIsOneOfFrames({ frames, trimLeft: delay, fps }), String(volume), ffmpegBuildVolumeExpression(rest, delay, fps));
45
45
  };
46
- const ffmpegVolumeExpression = ({ volume, fps, trimLeft, }) => {
46
+ const ffmpegVolumeExpression = ({ volume, fps, trimLeft, allowAmplificationDuringRender, }) => {
47
+ const maxVolume = allowAmplificationDuringRender ? Infinity : 1;
47
48
  // If it's a static volume, we return it and tell
48
49
  // FFMPEG it only has to evaluate it once
49
50
  if (typeof volume === 'number') {
50
51
  return {
51
52
  eval: 'once',
52
- value: String(Math.min(1, volume)),
53
+ value: String(Math.min(maxVolume, volume)),
53
54
  };
54
55
  }
55
56
  if ([...new Set(volume)].length === 1) {
@@ -57,6 +58,7 @@ const ffmpegVolumeExpression = ({ volume, fps, trimLeft, }) => {
57
58
  volume: volume[0],
58
59
  fps,
59
60
  trimLeft,
61
+ allowAmplificationDuringRender,
60
62
  });
61
63
  }
62
64
  // A 1 sec video with frames 0-29 would mean that
@@ -71,7 +73,7 @@ const ffmpegVolumeExpression = ({ volume, fps, trimLeft, }) => {
71
73
  const volumeMap = {};
72
74
  paddedVolume.forEach((baseVolume, frame) => {
73
75
  // Adjust volume based on how many other tracks have not yet finished
74
- const actualVolume = (0, round_volume_to_avoid_stack_overflow_1.roundVolumeToAvoidStackOverflow)(Math.min(1, baseVolume));
76
+ const actualVolume = (0, round_volume_to_avoid_stack_overflow_1.roundVolumeToAvoidStackOverflow)(Math.min(maxVolume, baseVolume));
75
77
  if (!volumeMap[actualVolume]) {
76
78
  volumeMap[actualVolume] = [];
77
79
  }
@@ -6,6 +6,7 @@ export declare type UnsafeAsset = Omit<TAsset, 'frame' | 'id' | 'volume' | 'medi
6
6
  volume: number[];
7
7
  id: string;
8
8
  playbackRate: number;
9
+ allowAmplificationDuringRender: boolean;
9
10
  };
10
11
  export declare type AssetVolume = number | number[];
11
12
  export declare type MediaAsset = Omit<UnsafeAsset, 'duration' | 'volume'> & {
@@ -526,6 +526,10 @@ export interface CaptureScreenshotRequest {
526
526
  * Capture the screenshot beyond the viewport. Defaults to false.
527
527
  */
528
528
  captureBeyondViewport?: boolean;
529
+ /**
530
+ * Optimize image encoding for speed, not for resulting size (defaults to false) EXPERIMENTAL
531
+ */
532
+ optimizeForSpeed?: boolean;
529
533
  }
530
534
  export interface CaptureScreenshotResponse {
531
535
  /**
@@ -19,6 +19,7 @@ const calculateFfmpegFilter = ({ asset, fps, durationInFrames, channels, assetDu
19
19
  playbackRate: asset.playbackRate,
20
20
  durationInFrames,
21
21
  assetDuration,
22
+ allowAmplificationDuringRender: asset.allowAmplificationDuringRender,
22
23
  });
23
24
  };
24
25
  exports.calculateFfmpegFilter = calculateFfmpegFilter;
@@ -33,6 +33,7 @@ const screenshotTask = async ({ format, height, omitBackground, page, width, pat
33
33
  width,
34
34
  },
35
35
  captureBeyondViewport: true,
36
+ optimizeForSpeed: true,
36
37
  });
37
38
  (0, perf_1.stopPerfMeasure)(cap);
38
39
  if (shouldSetDefaultBackground)
@@ -1,5 +1,5 @@
1
1
  import type { AssetVolume } from './assets/types';
2
- export declare const stringifyFfmpegFilter: ({ trimLeft, trimRight, channels, startInVideo, volume, fps, playbackRate, durationInFrames, assetDuration, }: {
2
+ export declare const stringifyFfmpegFilter: ({ trimLeft, trimRight, channels, startInVideo, volume, fps, playbackRate, durationInFrames, assetDuration, allowAmplificationDuringRender, }: {
3
3
  trimLeft: number;
4
4
  trimRight: number;
5
5
  channels: number;
@@ -9,4 +9,5 @@ export declare const stringifyFfmpegFilter: ({ trimLeft, trimRight, channels, st
9
9
  durationInFrames: number;
10
10
  playbackRate: number;
11
11
  assetDuration: number | null;
12
+ allowAmplificationDuringRender: boolean;
12
13
  }) => string | null;
@@ -5,7 +5,7 @@ const calculate_atempo_1 = require("./assets/calculate-atempo");
5
5
  const ffmpeg_volume_expression_1 = require("./assets/ffmpeg-volume-expression");
6
6
  const sample_rate_1 = require("./sample-rate");
7
7
  const truthy_1 = require("./truthy");
8
- const stringifyFfmpegFilter = ({ trimLeft, trimRight, channels, startInVideo, volume, fps, playbackRate, durationInFrames, assetDuration, }) => {
8
+ const stringifyFfmpegFilter = ({ trimLeft, trimRight, channels, startInVideo, volume, fps, playbackRate, durationInFrames, assetDuration, allowAmplificationDuringRender, }) => {
9
9
  const startInVideoSeconds = startInVideo / fps;
10
10
  if (assetDuration && trimLeft >= assetDuration) {
11
11
  return null;
@@ -14,6 +14,7 @@ const stringifyFfmpegFilter = ({ trimLeft, trimRight, channels, startInVideo, vo
14
14
  volume,
15
15
  fps,
16
16
  trimLeft,
17
+ allowAmplificationDuringRender,
17
18
  });
18
19
  // Avoid setting filters if possible, as combining them can create noise
19
20
  const chunkLength = durationInFrames / fps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "3.3.16",
3
+ "version": "3.3.18",
4
4
  "description": "Renderer for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,7 +22,7 @@
22
22
  "dependencies": {
23
23
  "execa": "5.1.1",
24
24
  "extract-zip": "2.0.1",
25
- "remotion": "3.3.16",
25
+ "remotion": "3.3.18",
26
26
  "source-map": "^0.8.0-beta.0",
27
27
  "ws": "8.7.0"
28
28
  },
@@ -57,5 +57,5 @@
57
57
  "publishConfig": {
58
58
  "access": "public"
59
59
  },
60
- "gitHead": "f9ad91106fe6fbcc61a25d917cc526a995d9322c"
60
+ "gitHead": "0d1b7297c2ca88ee49e710e05afb7236fc887187"
61
61
  }