@remotion/renderer 4.0.140 → 4.0.142

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.
@@ -44,6 +44,7 @@ const calculateAssetPositions = (frames) => {
44
44
  playbackRate: asset.playbackRate,
45
45
  allowAmplificationDuringRender: asset.allowAmplificationDuringRender,
46
46
  toneFrequency: asset.toneFrequency,
47
+ audioStartFrame: asset.audioStartFrame,
47
48
  });
48
49
  }
49
50
  const found = assets.find((a) => a.duration === null && areEqual(a, asset));
@@ -1,5 +1,5 @@
1
1
  import type { TRenderAsset } from 'remotion/no-react';
2
- export type UnsafeAsset = Omit<TRenderAsset, 'frame' | 'id' | 'volume' | 'mediaFrame'> & {
2
+ export type UnsafeAsset = Omit<TRenderAsset, 'frame' | 'id' | 'volume' | 'mediaFrame' | 'audioStartFrom'> & {
3
3
  startInVideo: number;
4
4
  duration: number | null;
5
5
  trimLeft: number;
@@ -1,3 +1,3 @@
1
1
  import type { LogLevel } from './log-level';
2
2
  export declare const gLibCErrorMessage: (libCString: string) => string | null;
3
- export declare const checkNodeVersionAndWarnAboutRosetta: (logLevel: LogLevel, indent: boolean) => void;
3
+ export declare const checkRuntimeVersion: (logLevel: LogLevel, indent: boolean) => void;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkNodeVersionAndWarnAboutRosetta = exports.gLibCErrorMessage = void 0;
3
+ exports.checkRuntimeVersion = exports.gLibCErrorMessage = void 0;
4
+ const no_react_1 = require("remotion/no-react");
4
5
  const get_executable_path_1 = require("./compositor/get-executable-path");
5
6
  const logger_1 = require("./logger");
6
7
  const getRequiredLibCVersion = () => {
@@ -54,13 +55,25 @@ const checkLibCRequirement = (logLevel, indent) => {
54
55
  }
55
56
  }
56
57
  };
57
- const checkNodeVersionAndWarnAboutRosetta = (logLevel, indent) => {
58
+ const checkNodeVersion = () => {
58
59
  const version = process.version.replace('v', '').split('.');
59
60
  const majorVersion = Number(version[0]);
60
- const requiredNodeVersion = 16;
61
- if (majorVersion < 16) {
62
- throw new Error(`Remotion requires at least Node ${requiredNodeVersion}. You currently have ${process.version}. Update your node version to ${requiredNodeVersion} to use Remotion.`);
61
+ if (majorVersion < no_react_1.NoReactInternals.MIN_NODE_VERSION) {
62
+ throw new Error(`Remotion requires at least Node ${no_react_1.NoReactInternals.MIN_NODE_VERSION}. You currently have ${process.version}. Update your node version to ${no_react_1.NoReactInternals.MIN_NODE_VERSION} to use Remotion.`);
63
+ }
64
+ };
65
+ const checkBunVersion = () => {
66
+ if (!Bun.semver.satisfies(Bun.version, `>=${no_react_1.NoReactInternals.MIN_BUN_VERSION}`)) {
67
+ throw new Error(`Remotion requires at least Bun ${no_react_1.NoReactInternals.MIN_BUN_VERSION}. You currently have ${Bun.version}. Update your Bun version to ${no_react_1.NoReactInternals.MIN_BUN_VERSION} to use Remotion.`);
68
+ }
69
+ };
70
+ const checkRuntimeVersion = (logLevel, indent) => {
71
+ if (typeof Bun === 'undefined') {
72
+ checkNodeVersion();
73
+ }
74
+ else {
75
+ checkBunVersion();
63
76
  }
64
77
  checkLibCRequirement(logLevel, indent);
65
78
  };
66
- exports.checkNodeVersionAndWarnAboutRosetta = checkNodeVersionAndWarnAboutRosetta;
79
+ exports.checkRuntimeVersion = checkRuntimeVersion;
package/dist/client.d.ts CHANGED
@@ -771,6 +771,21 @@ export declare const BrowserSafeApis: {
771
771
  getValue: () => never;
772
772
  setConfig: () => never;
773
773
  };
774
+ throwIfSiteExistsOption: {
775
+ cliFlag: string;
776
+ description: () => string;
777
+ docLink: string;
778
+ getValue: ({ commandLine }: {
779
+ commandLine: Record<string, unknown>;
780
+ }) => {
781
+ source: string;
782
+ value: boolean;
783
+ };
784
+ name: string;
785
+ setConfig: () => never;
786
+ ssrName: string;
787
+ type: boolean;
788
+ };
774
789
  };
775
790
  validColorSpaces: readonly ["default", "bt709", "bt2020-ncl"];
776
791
  optionsMap: {
@@ -2199,6 +2214,38 @@ export declare const BrowserSafeApis: {
2199
2214
  setConfig: () => never;
2200
2215
  };
2201
2216
  };
2217
+ readonly deploySiteLambda: {
2218
+ readonly logLevel: {
2219
+ cliFlag: "log";
2220
+ name: string;
2221
+ ssrName: string;
2222
+ description: () => import("react/jsx-runtime").JSX.Element;
2223
+ docLink: string;
2224
+ getValue: ({ commandLine }: {
2225
+ commandLine: Record<string, unknown>;
2226
+ }) => {
2227
+ value: "verbose" | "info" | "warn" | "error";
2228
+ source: string;
2229
+ };
2230
+ setConfig: (newLogLevel: "verbose" | "info" | "warn" | "error") => void;
2231
+ type: "verbose" | "info" | "warn" | "error";
2232
+ };
2233
+ readonly throwIfSiteExists: {
2234
+ cliFlag: string;
2235
+ description: () => string;
2236
+ docLink: string;
2237
+ getValue: ({ commandLine }: {
2238
+ commandLine: Record<string, unknown>;
2239
+ }) => {
2240
+ source: string;
2241
+ value: boolean;
2242
+ };
2243
+ name: string;
2244
+ setConfig: () => never;
2245
+ ssrName: string;
2246
+ type: boolean;
2247
+ };
2248
+ };
2202
2249
  };
2203
2250
  codecSupportsCrf: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif") => boolean;
2204
2251
  codecSupportsVideoBitrate: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif") => boolean;
@@ -10,7 +10,6 @@ const logger_1 = require("../logger");
10
10
  let warned = false;
11
11
  function isMusl({ indent, logLevel, }) {
12
12
  var _a;
13
- // @ts-expect-error bun no types
14
13
  if (!process.report && typeof Bun !== 'undefined') {
15
14
  if (!warned) {
16
15
  logger_1.Log.warn({ indent, logLevel }, 'Bun limitation: Could not determine if your Linux is using musl or glibc. Assuming glibc.');
@@ -40,7 +40,7 @@ export type VideoMetadata = {
40
40
  audioFileExtension: string | null;
41
41
  pixelFormat: null | 'yuv420p' | 'yuyv422' | 'rgb24' | 'bgr24' | 'yuv422p' | 'yuv444p' | 'yuv410p' | 'yuv411p' | 'yuvj420p' | 'yuvj422p' | 'yuvj444p' | 'argb' | 'rgba' | 'abgr' | 'bgra' | 'yuv440p' | 'yuvj440p' | 'yuva420p' | 'yuv420p16le' | 'yuv420p16be' | 'yuv422p16le' | 'yuv422p16be' | 'yuv444p16le' | 'yuv444p16be' | 'yuv420p9be' | 'yuv420p9le' | 'yuv420p10be' | 'yuv420p10le' | 'yuv422p10be' | 'yuv422p10le' | 'yuv444p9be' | 'yuv444p9le' | 'yuv444p10be' | 'yuv444p10le' | 'yuv422p9be' | 'yuv422p9le' | 'yuva420p9be' | 'yuva420p9le' | 'yuva422p9be' | 'yuva422p9le' | 'yuva444p9be' | 'yuva444p9le' | 'yuva420p10be' | 'yuva420p10le' | 'yuva422p10be' | 'yuva422p10le' | 'yuva444p10be' | 'yuva444p10le' | 'yuva420p16be' | 'yuva420p16le' | 'yuva422p16be' | 'yuva422p16le' | 'yuva444p16be' | 'yuva444p16le' | 'yuva444p' | 'yuva422p' | 'yuv420p12be' | 'yuv420p12le' | 'yuv420p14be' | 'yuv420p14le' | 'yuv422p12be' | 'yuv422p12le' | 'yuv422p14be' | 'yuv422p14le' | 'yuv444p12be' | 'yuv444p12le' | 'yuv444p14be' | 'yuv444p14le' | 'yuvj411p' | 'yuv440p10le' | 'yuv440p10be' | 'yuv440p12le' | 'yuv440p12be' | 'yuv420p9' | 'yuv422p9' | 'yuv444p9' | 'yuv420p10' | 'yuv422p10' | 'yuv440p10' | 'yuv444p10' | 'yuv420p12' | 'yuv422p12' | 'yuv440p12' | 'yuv444p12' | 'yuv420p14' | 'yuv422p14' | 'yuv444p14' | 'yuv420p16' | 'yuv422p16' | 'yuv444p16' | 'yuva420p9' | 'yuva422p9' | 'yuva444p9' | 'yuva420p10' | 'yuva422p10' | 'yuva444p10' | 'yuva420p16' | 'yuva422p16' | 'yuva444p16' | 'yuva422p12be' | 'yuva422p12le' | 'yuva444p12be' | 'yuva444p12le' | 'unknown';
42
42
  };
43
- type SilentPart = {
43
+ export type SilentPart = {
44
44
  startInSeconds: number;
45
45
  endInSeconds: number;
46
46
  };
@@ -109,4 +109,3 @@ export type ErrorPayload = {
109
109
  error: string;
110
110
  backtrace: string;
111
111
  };
112
- export {};
@@ -4,6 +4,9 @@ export declare const createFfmpegComplexFilter: ({ filters, downloadMap, }: {
4
4
  filters: PreprocessedAudioTrack[];
5
5
  downloadMap: DownloadMap;
6
6
  }) => Promise<{
7
- complexFilterFlag: [string, string] | null;
7
+ complexFilterFlag: [
8
+ string,
9
+ string
10
+ ] | null;
8
11
  cleanup: () => void;
9
12
  }>;
@@ -6,6 +6,7 @@ import type { ChromiumOptions } from './open-browser';
6
6
  import type { ToOptions } from './options/option';
7
7
  import type { optionsMap } from './options/options-map';
8
8
  import type { RemotionServer } from './prepare-server';
9
+ import type { RequiredInputPropsInV5 } from './v5-required-input-props';
9
10
  type InternalGetCompositionsOptions = {
10
11
  serializedInputPropsWithCustomSchema: string;
11
12
  envVariables: Record<string, string>;
@@ -18,8 +19,7 @@ type InternalGetCompositionsOptions = {
18
19
  indent: boolean;
19
20
  serveUrlOrWebpackUrl: string;
20
21
  } & ToOptions<typeof optionsMap.getCompositions>;
21
- export type GetCompositionsOptions = {
22
- inputProps?: Record<string, unknown> | null;
22
+ export type GetCompositionsOptions = RequiredInputPropsInV5 & {
23
23
  envVariables?: Record<string, string>;
24
24
  puppeteerInstance?: HeadlessBrowser;
25
25
  onBrowserLog?: (log: BrowserLog) => void;
@@ -1,5 +1,6 @@
1
- import type { GetSilentPartsResponse } from './compositor/payloads';
1
+ import type { GetSilentPartsResponse, SilentPart } from './compositor/payloads';
2
2
  import type { LogLevel } from './log-level';
3
+ export type { SilentPart };
3
4
  export declare const getSilentParts: ({ src, noiseThresholdInDecibels: passedNoiseThresholdInDecibels, minDurationInSeconds: passedMinDuration, logLevel, binariesDirectory, }: {
4
5
  src: string;
5
6
  minDurationInSeconds?: number | undefined;
package/dist/index.d.ts CHANGED
@@ -19,7 +19,7 @@ export type { FfmpegOverrideFn } from './ffmpeg-override';
19
19
  export { FileExtension } from './file-extensions';
20
20
  export { FrameRange } from './frame-range';
21
21
  export { GetCompositionsOptions, getCompositions } from './get-compositions';
22
- export { getSilentParts } from './get-silent-parts';
22
+ export { SilentPart, getSilentParts } from './get-silent-parts';
23
23
  export { VideoMetadata, getVideoMetadata } from './get-video-metadata';
24
24
  export { ImageFormat, StillImageFormat, VideoImageFormat, validateSelectedPixelFormatAndImageFormatCombination, } from './image-format';
25
25
  export type { LogLevel } from './log-level';
@@ -352,8 +352,8 @@ export declare const RenderInternals: {
352
352
  }) => execa.ExecaChildProcess<string>;
353
353
  validStillImageFormats: readonly ["png", "jpeg", "pdf", "webp"];
354
354
  validVideoImageFormats: readonly ["png", "jpeg", "none"];
355
- DEFAULT_STILL_IMAGE_FORMAT: "png" | "jpeg" | "pdf" | "webp";
356
- DEFAULT_VIDEO_IMAGE_FORMAT: "png" | "jpeg" | "none";
355
+ DEFAULT_STILL_IMAGE_FORMAT: "jpeg" | "png" | "webp" | "pdf";
356
+ DEFAULT_VIDEO_IMAGE_FORMAT: "jpeg" | "png" | "none";
357
357
  DEFAULT_JPEG_QUALITY: number;
358
358
  chalk: {
359
359
  enabled: () => boolean;
@@ -408,12 +408,12 @@ export declare const RenderInternals: {
408
408
  Log: {
409
409
  verbose: (options: import("./logger").LogOptions & {
410
410
  tag?: string | undefined;
411
- }, message?: any, ...optionalParams: any[]) => void;
412
- info: (options: import("./logger").LogOptions, message?: any, ...optionalParams: any[]) => void;
413
- warn: (options: import("./logger").LogOptions, message?: any, ...optionalParams: any[]) => void;
411
+ }, ...args: any[]) => void;
412
+ info: (options: import("./logger").LogOptions, ...args: any[]) => void;
413
+ warn: (options: import("./logger").LogOptions, ...args: any[]) => void;
414
414
  error: (options: import("./logger").LogOptions & {
415
415
  tag?: string | undefined;
416
- }, message?: any, ...optionalParams: any[]) => void;
416
+ }, ...args: any[]) => void;
417
417
  };
418
418
  INDENT_TOKEN: string;
419
419
  isColorSupported: () => boolean;
@@ -452,7 +452,7 @@ export declare const RenderInternals: {
452
452
  frame: number;
453
453
  serializedInputPropsWithCustomSchema: string;
454
454
  serializedResolvedPropsWithCustomSchema: string;
455
- imageFormat: "png" | "jpeg" | "pdf" | "webp";
455
+ imageFormat: "jpeg" | "png" | "webp" | "pdf";
456
456
  jpegQuality: number;
457
457
  puppeteerInstance: HeadlessBrowser | null;
458
458
  envVariables: Record<string, string>;
package/dist/index.js CHANGED
@@ -207,4 +207,4 @@ exports.RenderInternals = {
207
207
  internalEnsureBrowser: ensure_browser_2.internalEnsureBrowser,
208
208
  };
209
209
  // Warn of potential performance issues with Apple Silicon (M1 chip under Rosetta)
210
- (0, check_version_requirements_1.checkNodeVersionAndWarnAboutRosetta)('info', false);
210
+ (0, check_version_requirements_1.checkRuntimeVersion)('info', false);
package/dist/logger.d.ts CHANGED
@@ -10,9 +10,9 @@ type VerboseLogOptions = LogOptions & {
10
10
  export declare const verboseTag: (str: string) => string;
11
11
  export declare const secondverboseTag: (str: string) => string;
12
12
  export declare const Log: {
13
- verbose: (options: VerboseLogOptions, message?: any, ...optionalParams: any[]) => void;
14
- info: (options: LogOptions, message?: any, ...optionalParams: any[]) => void;
15
- warn: (options: LogOptions, message?: any, ...optionalParams: any[]) => void;
16
- error: (options: VerboseLogOptions, message?: any, ...optionalParams: any[]) => void;
13
+ verbose: (options: VerboseLogOptions, ...args: Parameters<typeof console.log>) => void;
14
+ info: (options: LogOptions, ...args: Parameters<typeof console.log>) => void;
15
+ warn: (options: LogOptions, ...args: Parameters<typeof console.log>) => void;
16
+ error: (options: VerboseLogOptions, ...args: Parameters<typeof console.log>) => void;
17
17
  };
18
18
  export {};
@@ -120,6 +120,8 @@ const internalOpenBrowser = async ({ browser, browserExecutable, chromiumOptions
120
120
  '--no-pings', // https://source.chromium.org/search?q=lang:cpp+symbol:kNoPings&ss=chromium
121
121
  '--font-render-hinting=none',
122
122
  '--no-zygote', // https://source.chromium.org/search?q=lang:cpp+symbol:kNoZygote&ss=chromium,
123
+ '--ignore-gpu-blocklist',
124
+ '--enable-unsafe-webgpu',
123
125
  typeof forceDeviceScaleFactor === 'undefined'
124
126
  ? null
125
127
  : `--force-device-scale-factor=${forceDeviceScaleFactor}`,
@@ -551,6 +551,21 @@ export declare const allOptions: {
551
551
  getValue: () => never;
552
552
  setConfig: () => never;
553
553
  };
554
+ throwIfSiteExistsOption: {
555
+ cliFlag: string;
556
+ description: () => string;
557
+ docLink: string;
558
+ getValue: ({ commandLine }: {
559
+ commandLine: Record<string, unknown>;
560
+ }) => {
561
+ source: string;
562
+ value: boolean;
563
+ };
564
+ name: string;
565
+ setConfig: () => never;
566
+ ssrName: string;
567
+ type: boolean;
568
+ };
554
569
  };
555
570
  export type AvailableOptions = keyof typeof allOptions;
556
571
  export type TypeOfOption<Type> = Type extends AnyRemotionOption<infer X> ? X : never;
@@ -30,6 +30,7 @@ const public_path_1 = require("./public-path");
30
30
  const repro_1 = require("./repro");
31
31
  const scale_1 = require("./scale");
32
32
  const separate_audio_1 = require("./separate-audio");
33
+ const throw_if_site_exists_1 = require("./throw-if-site-exists");
33
34
  const timeout_1 = require("./timeout");
34
35
  const video_bitrate_1 = require("./video-bitrate");
35
36
  const video_codec_1 = require("./video-codec");
@@ -70,4 +71,5 @@ exports.allOptions = {
70
71
  publicPathOption: public_path_1.publicPathOption,
71
72
  publicDirOption: public_dir_1.publicDirOption,
72
73
  onBrowserDownloadOption: on_browser_download_1.onBrowserDownloadOption,
74
+ throwIfSiteExistsOption: throw_if_site_exists_1.throwIfSiteExistsOption,
73
75
  };
@@ -1424,4 +1424,36 @@ export declare const optionsMap: {
1424
1424
  setConfig: () => never;
1425
1425
  };
1426
1426
  };
1427
+ readonly deploySiteLambda: {
1428
+ readonly logLevel: {
1429
+ cliFlag: "log";
1430
+ name: string;
1431
+ ssrName: string;
1432
+ description: () => import("react/jsx-runtime").JSX.Element;
1433
+ docLink: string;
1434
+ getValue: ({ commandLine }: {
1435
+ commandLine: Record<string, unknown>;
1436
+ }) => {
1437
+ value: "verbose" | "info" | "warn" | "error";
1438
+ source: string;
1439
+ };
1440
+ setConfig: (newLogLevel: "verbose" | "info" | "warn" | "error") => void;
1441
+ type: "verbose" | "info" | "warn" | "error";
1442
+ };
1443
+ readonly throwIfSiteExists: {
1444
+ cliFlag: string;
1445
+ description: () => string;
1446
+ docLink: string;
1447
+ getValue: ({ commandLine }: {
1448
+ commandLine: Record<string, unknown>;
1449
+ }) => {
1450
+ source: string;
1451
+ value: boolean;
1452
+ };
1453
+ name: string;
1454
+ setConfig: () => never;
1455
+ ssrName: string;
1456
+ type: boolean;
1457
+ };
1458
+ };
1427
1459
  };
@@ -21,6 +21,7 @@ const prefer_lossless_1 = require("./prefer-lossless");
21
21
  const repro_1 = require("./repro");
22
22
  const scale_1 = require("./scale");
23
23
  const separate_audio_1 = require("./separate-audio");
24
+ const throw_if_site_exists_1 = require("./throw-if-site-exists");
24
25
  const timeout_1 = require("./timeout");
25
26
  const video_bitrate_1 = require("./video-bitrate");
26
27
  const video_codec_1 = require("./video-codec");
@@ -138,4 +139,8 @@ exports.optionsMap = {
138
139
  logLevel: log_level_1.logLevelOption,
139
140
  onBrowserDownload: on_browser_download_1.onBrowserDownloadOption,
140
141
  },
142
+ deploySiteLambda: {
143
+ logLevel: log_level_1.logLevelOption,
144
+ throwIfSiteExists: throw_if_site_exists_1.throwIfSiteExistsOption,
145
+ },
141
146
  };
@@ -1,8 +1,4 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
- /// <reference types="node" />
5
- /// <reference types="node" />
6
2
  import type { NetworkInterfaceInfo } from 'os';
7
3
  import os from 'os';
8
4
  type PortConfig = {
@@ -31,6 +31,8 @@ const preprocessAudioTrackUnlimited = async ({ outName, asset, fps, downloadMap,
31
31
  trimRightOffset,
32
32
  forSeamlessAacConcatenation,
33
33
  volume: (0, flatten_volume_array_1.flattenVolumeArray)(asset.volume),
34
+ indent,
35
+ logLevel,
34
36
  });
35
37
  if (filter === null) {
36
38
  return null;
package/dist/repro.d.ts CHANGED
@@ -13,7 +13,7 @@ type ReproWriter = {
13
13
  }) => Promise<void>;
14
14
  };
15
15
  export declare const getReproWriter: () => ReproWriter;
16
- export declare const writeInRepro: (level: string, message?: any, ...optionalParams: any[]) => void;
16
+ export declare const writeInRepro: (level: string, ...args: Parameters<typeof console.log>) => void;
17
17
  export declare const enableRepro: ({ serveUrl, compositionName, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, }: {
18
18
  serveUrl: string;
19
19
  compositionName: string;
@@ -6,6 +6,7 @@ import type { ChromiumOptions } from './open-browser';
6
6
  import type { ToOptions } from './options/option';
7
7
  import type { optionsMap } from './options/options-map';
8
8
  import type { RemotionServer } from './prepare-server';
9
+ import type { RequiredInputPropsInV5 } from './v5-required-input-props';
9
10
  type InternalSelectCompositionsConfig = {
10
11
  serializedInputPropsWithCustomSchema: string;
11
12
  envVariables: Record<string, string>;
@@ -19,8 +20,7 @@ type InternalSelectCompositionsConfig = {
19
20
  serveUrl: string;
20
21
  id: string;
21
22
  } & ToOptions<typeof optionsMap.selectComposition>;
22
- export type SelectCompositionOptions = {
23
- inputProps?: Record<string, unknown> | null;
23
+ export type SelectCompositionOptions = RequiredInputPropsInV5 & {
24
24
  envVariables?: Record<string, string>;
25
25
  puppeteerInstance?: HeadlessBrowser;
26
26
  onBrowserLog?: (log: BrowserLog) => void;
@@ -143,7 +143,7 @@ const innerSetPropsAndEnv = async ({ serializedInputPropsWithCustomSchema, envVa
143
143
  page,
144
144
  timeoutInMilliseconds: actualTimeout,
145
145
  });
146
- const requiredVersion = '10';
146
+ const requiredVersion = '11';
147
147
  if (siteVersion !== requiredVersion) {
148
148
  throw new Error([
149
149
  `Incompatible site: When visiting ${urlToVisit}, a bundle was found, but one that is not compatible with this version of Remotion. Found version: ${siteVersion} - Required version: ${requiredVersion}. To resolve this error:`,
@@ -1,4 +1,5 @@
1
1
  import type { AssetVolume, MediaAsset } from './assets/types';
2
+ import type { LogLevel } from './log-level';
2
3
  export type FilterWithoutPaddingApplied = ProcessedTrack & {
3
4
  filter: string;
4
5
  };
@@ -6,12 +7,13 @@ export type ProcessedTrack = {
6
7
  pad_start: string | null;
7
8
  pad_end: string | null;
8
9
  };
9
- export declare const getActualTrimLeft: ({ asset, fps, trimLeftOffset, }: {
10
+ export declare const getActualTrimLeft: ({ asset, fps, trimLeftOffset, seamless, }: {
10
11
  asset: MediaAsset;
11
12
  fps: number;
12
13
  trimLeftOffset: number;
14
+ seamless: boolean;
13
15
  }) => number;
14
- export declare const stringifyFfmpegFilter: ({ channels, volume, fps, assetDuration, chunkLengthInSeconds, forSeamlessAacConcatenation, trimLeftOffset, trimRightOffset, asset, }: {
16
+ export declare const stringifyFfmpegFilter: ({ channels, volume, fps, assetDuration, chunkLengthInSeconds, forSeamlessAacConcatenation, trimLeftOffset, trimRightOffset, asset, indent, logLevel, }: {
15
17
  channels: number;
16
18
  volume: AssetVolume;
17
19
  fps: number;
@@ -21,4 +23,6 @@ export declare const stringifyFfmpegFilter: ({ channels, volume, fps, assetDurat
21
23
  trimLeftOffset: number;
22
24
  trimRightOffset: number;
23
25
  asset: MediaAsset;
26
+ indent: boolean;
27
+ logLevel: LogLevel;
24
28
  }) => FilterWithoutPaddingApplied | null;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stringifyFfmpegFilter = exports.getActualTrimLeft = void 0;
4
4
  const calculate_atempo_1 = require("./assets/calculate-atempo");
5
5
  const ffmpeg_volume_expression_1 = require("./assets/ffmpeg-volume-expression");
6
+ const logger_1 = require("./logger");
6
7
  const sample_rate_1 = require("./sample-rate");
7
8
  const truthy_1 = require("./truthy");
8
9
  const stringifyTrim = (trim) => {
@@ -14,46 +15,69 @@ const stringifyTrim = (trim) => {
14
15
  }
15
16
  return asString;
16
17
  };
17
- const getActualTrimLeft = ({ asset, fps, trimLeftOffset, }) => asset.trimLeft / fps + trimLeftOffset;
18
+ const getActualTrimLeft = ({ asset, fps, trimLeftOffset, seamless, }) => {
19
+ const sinceStart = asset.trimLeft - asset.audioStartFrame;
20
+ if (!seamless) {
21
+ return (asset.audioStartFrame / fps +
22
+ (sinceStart / fps) * asset.playbackRate +
23
+ trimLeftOffset);
24
+ }
25
+ if (seamless) {
26
+ return (asset.audioStartFrame / fps / asset.playbackRate +
27
+ sinceStart / fps +
28
+ trimLeftOffset);
29
+ }
30
+ throw new Error('This should never happen');
31
+ };
18
32
  exports.getActualTrimLeft = getActualTrimLeft;
19
- const trimAndSetTempo = ({ forSeamlessAacConcatenation, assetDuration, asset, trimLeftOffset, trimRightOffset, fps, }) => {
33
+ const trimAndSetTempo = ({ forSeamlessAacConcatenation, assetDuration, asset, trimLeftOffset, trimRightOffset, fps, indent, logLevel, }) => {
20
34
  // If we need seamless AAC stitching, we need to apply the tempo filter first
21
35
  // because the atempo filter is not frame-perfect. It creates a small offset
22
36
  // and the offset needs to be the same for all audio tracks, before processing it further.
23
37
  // This also affects the trimLeft and trimRight values, as they need to be adjusted.
24
38
  if (forSeamlessAacConcatenation) {
25
- const trimLeft = (0, exports.getActualTrimLeft)({ asset, fps, trimLeftOffset });
26
- const trimRight = trimLeft + (asset.duration / fps + trimRightOffset);
27
- const trimRightOrAssetDuration = assetDuration
39
+ const trimLeft = (0, exports.getActualTrimLeft)({
40
+ asset,
41
+ fps,
42
+ trimLeftOffset,
43
+ seamless: true,
44
+ });
45
+ const trimRight = trimLeft + asset.duration / fps - trimLeftOffset + trimRightOffset;
46
+ let trimRightOrAssetDuration = assetDuration
28
47
  ? Math.min(trimRight, assetDuration / asset.playbackRate)
29
48
  : trimRight;
30
49
  if (trimRightOrAssetDuration < trimLeft) {
31
- throw new Error('trimRightOrAssetDuration < trimLeft: ' +
50
+ logger_1.Log.warn({ indent, logLevel }, 'trimRightOrAssetDuration < trimLeft: ' +
32
51
  JSON.stringify({
33
52
  trimRight,
34
53
  trimLeft,
35
54
  assetDuration,
36
55
  assetTrimLeft: asset.trimLeft,
37
56
  }));
57
+ trimRightOrAssetDuration = trimLeft;
38
58
  }
39
59
  return {
40
60
  filter: [
41
61
  (0, calculate_atempo_1.calculateATempo)(asset.playbackRate),
42
- `atrim=${stringifyTrim(trimLeft)}:${stringifyTrim(trimRight)}`,
62
+ `atrim=${stringifyTrim(trimLeft)}:${stringifyTrim(trimRightOrAssetDuration)}`,
43
63
  ],
44
64
  actualTrimLeft: trimLeft,
45
- audibleDuration: trimRight - trimLeft,
65
+ audibleDuration: trimRightOrAssetDuration - trimLeft,
46
66
  };
47
67
  }
48
68
  // Otherwise, we first trim and then apply playback rate, as then the atempo
49
69
  // filter needs to do less work.
50
70
  if (!forSeamlessAacConcatenation) {
51
- const trimLeft = (0, exports.getActualTrimLeft)({ asset, fps, trimLeftOffset });
52
- const trimRight = (trimLeft + asset.duration / fps) * asset.playbackRate;
71
+ const actualTrimLeft = (0, exports.getActualTrimLeft)({
72
+ asset,
73
+ fps,
74
+ trimLeftOffset,
75
+ seamless: false,
76
+ });
77
+ const trimRight = actualTrimLeft + (asset.duration / fps) * asset.playbackRate;
53
78
  const trimRightOrAssetDuration = assetDuration
54
79
  ? Math.min(trimRight, assetDuration)
55
80
  : trimRight;
56
- const actualTrimLeft = trimLeft * asset.playbackRate;
57
81
  return {
58
82
  filter: [
59
83
  `atrim=${stringifyTrim(actualTrimLeft)}:${stringifyTrim(trimRightOrAssetDuration)}`,
@@ -65,14 +89,19 @@ const trimAndSetTempo = ({ forSeamlessAacConcatenation, assetDuration, asset, tr
65
89
  }
66
90
  throw new Error('This should never happen');
67
91
  };
68
- const stringifyFfmpegFilter = ({ channels, volume, fps, assetDuration, chunkLengthInSeconds, forSeamlessAacConcatenation, trimLeftOffset, trimRightOffset, asset, }) => {
92
+ const stringifyFfmpegFilter = ({ channels, volume, fps, assetDuration, chunkLengthInSeconds, forSeamlessAacConcatenation, trimLeftOffset, trimRightOffset, asset, indent, logLevel, }) => {
69
93
  if (channels === 0) {
70
94
  return null;
71
95
  }
72
96
  const { toneFrequency, startInVideo, playbackRate } = asset;
73
97
  const startInVideoSeconds = startInVideo / fps;
74
98
  if (assetDuration &&
75
- (0, exports.getActualTrimLeft)({ asset, fps, trimLeftOffset }) >=
99
+ (0, exports.getActualTrimLeft)({
100
+ asset,
101
+ fps,
102
+ trimLeftOffset,
103
+ seamless: forSeamlessAacConcatenation,
104
+ }) >=
76
105
  assetDuration / playbackRate) {
77
106
  return null;
78
107
  }
@@ -86,6 +115,8 @@ const stringifyFfmpegFilter = ({ channels, volume, fps, assetDuration, chunkLeng
86
115
  trimRightOffset,
87
116
  asset,
88
117
  fps,
118
+ indent,
119
+ logLevel,
89
120
  });
90
121
  const volumeFilter = (0, ffmpeg_volume_expression_1.ffmpegVolumeExpression)({
91
122
  volume,
@@ -0,0 +1,6 @@
1
+ import type { NoReactInternals } from 'remotion/no-react';
2
+ export type RequiredInputPropsInV5 = typeof NoReactInternals.ENABLE_V5_BREAKING_CHANGES extends true ? {
3
+ inputProps: Record<string, unknown>;
4
+ } : {
5
+ inputProps?: Record<string, unknown>;
6
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "4.0.140",
3
+ "version": "4.0.142",
4
4
  "description": "Renderer for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "extract-zip": "2.0.1",
19
19
  "source-map": "^0.8.0-beta.0",
20
20
  "ws": "8.7.0",
21
- "remotion": "4.0.140"
21
+ "remotion": "4.0.142"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": ">=16.8.0",
@@ -30,6 +30,7 @@
30
30
  "@testing-library/react": "13.3.0",
31
31
  "@types/node": "18.14.6",
32
32
  "@types/progress": "2.0.5",
33
+ "@types/bun": "1.0.12",
33
34
  "@types/react": "18.2.48",
34
35
  "@types/react-dom": "18.2.18",
35
36
  "eslint": "8.56.0",
@@ -41,13 +42,13 @@
41
42
  "@types/ws": "8.5.10"
42
43
  },
43
44
  "optionalDependencies": {
44
- "@remotion/compositor-darwin-arm64": "4.0.140",
45
- "@remotion/compositor-linux-arm64-musl": "4.0.140",
46
- "@remotion/compositor-linux-arm64-gnu": "4.0.140",
47
- "@remotion/compositor-linux-x64-gnu": "4.0.140",
48
- "@remotion/compositor-linux-x64-musl": "4.0.140",
49
- "@remotion/compositor-win32-x64-msvc": "4.0.140",
50
- "@remotion/compositor-darwin-x64": "4.0.140"
45
+ "@remotion/compositor-darwin-arm64": "4.0.142",
46
+ "@remotion/compositor-darwin-x64": "4.0.142",
47
+ "@remotion/compositor-linux-arm64-gnu": "4.0.142",
48
+ "@remotion/compositor-linux-arm64-musl": "4.0.142",
49
+ "@remotion/compositor-linux-x64-gnu": "4.0.142",
50
+ "@remotion/compositor-linux-x64-musl": "4.0.142",
51
+ "@remotion/compositor-win32-x64-msvc": "4.0.142"
51
52
  },
52
53
  "keywords": [
53
54
  "remotion",