@remotion/renderer 4.0.312 → 4.0.313

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.
@@ -17524,11 +17524,12 @@ var getExtraFramesToCapture = ({
17524
17524
  };
17525
17525
 
17526
17526
  // src/get-frame-padded-index.ts
17527
- var padIndex = ({
17528
- num,
17529
- filePadLength
17527
+ var getFrameOutputFileNameFromPattern = ({
17528
+ pattern,
17529
+ frame,
17530
+ ext
17530
17531
  }) => {
17531
- return String(num).padStart(filePadLength, "0");
17532
+ return pattern.replace(/\[frame\]/g, frame).replace(/\[ext\]/g, ext);
17532
17533
  };
17533
17534
  var getFrameOutputFileName = ({
17534
17535
  index,
@@ -17536,17 +17537,24 @@ var getFrameOutputFileName = ({
17536
17537
  imageFormat,
17537
17538
  countType,
17538
17539
  lastFrame,
17539
- totalFrames
17540
+ totalFrames,
17541
+ imageSequencePattern
17540
17542
  }) => {
17541
17543
  const filePadLength = getFilePadLength({ lastFrame, countType, totalFrames });
17544
+ const frameStr = countType === "actual-frames" ? String(frame).padStart(filePadLength, "0") : String(index).padStart(filePadLength, "0");
17545
+ if (imageSequencePattern) {
17546
+ return getFrameOutputFileNameFromPattern({
17547
+ pattern: imageSequencePattern,
17548
+ frame: frameStr,
17549
+ ext: imageFormat
17550
+ });
17551
+ }
17542
17552
  const prefix = "element";
17543
17553
  if (countType === "actual-frames") {
17544
- const paddedIndex = padIndex({ filePadLength, num: frame });
17545
- return `${prefix}-${paddedIndex}.${imageFormat}`;
17554
+ return `${prefix}-${frameStr}.${imageFormat}`;
17546
17555
  }
17547
17556
  if (countType === "from-zero") {
17548
- const paddedIndex = padIndex({ filePadLength, num: index });
17549
- return `${prefix}-${paddedIndex}.${imageFormat}`;
17557
+ return `${prefix}-${frameStr}.${imageFormat}`;
17550
17558
  }
17551
17559
  throw new TypeError("Unknown count type");
17552
17560
  };
@@ -18076,7 +18084,8 @@ var renderFrameWithOptionToReject = async ({
18076
18084
  framesRenderedObj,
18077
18085
  onFrameUpdate,
18078
18086
  frame,
18079
- page
18087
+ page,
18088
+ imageSequencePattern
18080
18089
  }) => {
18081
18090
  const startTime = performance.now();
18082
18091
  const index = framesToRender.indexOf(frame);
@@ -18124,7 +18133,8 @@ var renderFrameWithOptionToReject = async ({
18124
18133
  index,
18125
18134
  countType,
18126
18135
  lastFrame,
18127
- totalFrames: framesToRender.length
18136
+ totalFrames: framesToRender.length,
18137
+ imageSequencePattern
18128
18138
  })),
18129
18139
  jpegQuality,
18130
18140
  width,
@@ -18217,7 +18227,8 @@ var renderFrame = ({
18217
18227
  onFrameUpdate,
18218
18228
  framesRenderedObj,
18219
18229
  frame,
18220
- page
18230
+ page,
18231
+ imageSequencePattern
18221
18232
  }) => {
18222
18233
  return new Promise((resolve2, reject) => {
18223
18234
  renderFrameWithOptionToReject({
@@ -18249,7 +18260,8 @@ var renderFrame = ({
18249
18260
  framesRenderedObj,
18250
18261
  onFrameUpdate,
18251
18262
  frame,
18252
- page
18263
+ page,
18264
+ imageSequencePattern
18253
18265
  }).then(() => {
18254
18266
  resolve2();
18255
18267
  }).catch((err) => {
@@ -18290,7 +18302,8 @@ var renderFrameAndRetryTargetClose = async ({
18290
18302
  lastFrame,
18291
18303
  onFrameBuffer,
18292
18304
  onFrameUpdate,
18293
- nextFrameToRender
18305
+ nextFrameToRender,
18306
+ imageSequencePattern
18294
18307
  }) => {
18295
18308
  const currentPool = await poolPromise;
18296
18309
  if (stoppedSignal.stopped) {
@@ -18327,7 +18340,8 @@ var renderFrameAndRetryTargetClose = async ({
18327
18340
  timeoutInMilliseconds,
18328
18341
  nextFrameToRender,
18329
18342
  frame,
18330
- page: freePage
18343
+ page: freePage,
18344
+ imageSequencePattern
18331
18345
  }),
18332
18346
  new Promise((_, reject) => {
18333
18347
  cancelSignal?.(() => {
@@ -18394,7 +18408,8 @@ var renderFrameAndRetryTargetClose = async ({
18394
18408
  lastFrame,
18395
18409
  onFrameBuffer,
18396
18410
  onFrameUpdate,
18397
- nextFrameToRender
18411
+ nextFrameToRender,
18412
+ imageSequencePattern
18398
18413
  });
18399
18414
  }
18400
18415
  Log.warn({ indent, logLevel }, `The browser crashed while rendering frame ${frame}, retrying ${retriesLeft} more times. Learn more about this error under https://www.remotion.dev/docs/target-closed`);
@@ -18438,7 +18453,8 @@ var renderFrameAndRetryTargetClose = async ({
18438
18453
  lastFrame,
18439
18454
  onFrameBuffer,
18440
18455
  onFrameUpdate,
18441
- nextFrameToRender
18456
+ nextFrameToRender,
18457
+ imageSequencePattern
18442
18458
  });
18443
18459
  }
18444
18460
  };
@@ -18545,7 +18561,8 @@ var innerRenderFrames = async ({
18545
18561
  compositionStart,
18546
18562
  forSeamlessAacConcatenation,
18547
18563
  onArtifact,
18548
- binariesDirectory
18564
+ binariesDirectory,
18565
+ imageSequencePattern
18549
18566
  }) => {
18550
18567
  if (outputDir) {
18551
18568
  if (!fs13.existsSync(outputDir)) {
@@ -18636,6 +18653,8 @@ var innerRenderFrames = async ({
18636
18653
  allFramesAndExtraFrames,
18637
18654
  concurrencyOrFramesToRender
18638
18655
  });
18656
+ const pattern = imageSequencePattern || `element-[frame].[ext]`;
18657
+ const imageSequenceName = pattern.replace(/\[frame\]/g, `%0${filePadLength}d`).replace(/\[ext\]/g, imageFormat);
18639
18658
  await Promise.all(allFramesAndExtraFrames.map(() => {
18640
18659
  return renderFrameAndRetryTargetClose({
18641
18660
  retriesLeft: MAX_RETRIES_PER_FRAME,
@@ -18668,7 +18687,8 @@ var innerRenderFrames = async ({
18668
18687
  makeNewPage,
18669
18688
  onFrameBuffer,
18670
18689
  onFrameUpdate,
18671
- nextFrameToRender
18690
+ nextFrameToRender,
18691
+ imageSequencePattern: pattern
18672
18692
  });
18673
18693
  }));
18674
18694
  const firstFrameIndex = countType === "from-zero" ? 0 : framesToRender[0];
@@ -18678,7 +18698,7 @@ var innerRenderFrames = async ({
18678
18698
  assets: assets.sort((a, b) => {
18679
18699
  return a.frame - b.frame;
18680
18700
  }),
18681
- imageSequenceName: path20.join(frameDir, `element-%0${filePadLength}d.${imageFormat}`),
18701
+ imageSequenceName: path20.join(frameDir, imageSequenceName),
18682
18702
  firstFrameIndex,
18683
18703
  downloadMap,
18684
18704
  trimLeftOffset,
@@ -18725,7 +18745,8 @@ var internalRenderFramesRaw = ({
18725
18745
  onBrowserDownload,
18726
18746
  onArtifact,
18727
18747
  chromeMode,
18728
- offthreadVideoThreads
18748
+ offthreadVideoThreads,
18749
+ imageSequencePattern
18729
18750
  }) => {
18730
18751
  validateDimension(composition.height, "height", "in the `config` object passed to `renderFrames()`");
18731
18752
  validateDimension(composition.width, "width", "in the `config` object passed to `renderFrames()`");
@@ -18827,7 +18848,8 @@ var internalRenderFramesRaw = ({
18827
18848
  onBrowserDownload,
18828
18849
  onArtifact,
18829
18850
  chromeMode,
18830
- offthreadVideoThreads
18851
+ offthreadVideoThreads,
18852
+ imageSequencePattern
18831
18853
  });
18832
18854
  })
18833
18855
  ]).then((res) => {
@@ -18895,7 +18917,8 @@ var renderFrames = (options) => {
18895
18917
  onBrowserDownload,
18896
18918
  onArtifact,
18897
18919
  chromeMode,
18898
- offthreadVideoThreads
18920
+ offthreadVideoThreads,
18921
+ imageSequencePattern
18899
18922
  } = options;
18900
18923
  if (!composition) {
18901
18924
  throw new Error("No `composition` option has been specified for renderFrames()");
@@ -18952,7 +18975,8 @@ var renderFrames = (options) => {
18952
18975
  onBrowserDownload: onBrowserDownload ?? defaultBrowserDownloadProgress({ indent, logLevel, api: "renderFrames()" }),
18953
18976
  onArtifact: onArtifact ?? null,
18954
18977
  chromeMode: chromeMode ?? "headless-shell",
18955
- offthreadVideoThreads: offthreadVideoThreads ?? null
18978
+ offthreadVideoThreads: offthreadVideoThreads ?? null,
18979
+ imageSequencePattern: imageSequencePattern ?? null
18956
18980
  });
18957
18981
  };
18958
18982
 
@@ -21336,7 +21360,8 @@ var internalRenderMediaRaw = ({
21336
21360
  forSeamlessAacConcatenation,
21337
21361
  onBrowserDownload,
21338
21362
  onArtifact,
21339
- chromeMode
21363
+ chromeMode,
21364
+ imageSequencePattern: null
21340
21365
  });
21341
21366
  return renderFramesProc;
21342
21367
  }).then((renderFramesReturn) => {
@@ -1,12 +1,18 @@
1
1
  import type { VideoImageFormat } from './image-format';
2
2
  export type CountType = 'from-zero' | 'actual-frames';
3
- export declare const getFrameOutputFileName: ({ index, frame, imageFormat, countType, lastFrame, totalFrames, }: {
3
+ export declare const getFrameOutputFileNameFromPattern: ({ pattern, frame, ext, }: {
4
+ pattern: string;
5
+ frame: string;
6
+ ext: string;
7
+ }) => string;
8
+ export declare const getFrameOutputFileName: ({ index, frame, imageFormat, countType, lastFrame, totalFrames, imageSequencePattern, }: {
4
9
  index: number;
5
10
  frame: number;
6
11
  imageFormat: VideoImageFormat;
7
12
  countType: CountType;
8
13
  lastFrame: number;
9
14
  totalFrames: number;
15
+ imageSequencePattern: string | null;
10
16
  }) => string;
11
17
  export declare const getFilePadLength: ({ lastFrame, totalFrames, countType, }: {
12
18
  lastFrame: number;
@@ -4,20 +4,29 @@
4
4
  // - If `--every-nth-frame` is passed, only frames 0, 2, 4 are rendered
5
5
  // - If an image sequence is created, the filenames should correspond to the frame numbers: element-099.jpg, element-100.jpg
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.getFilePadLength = exports.getFrameOutputFileName = void 0;
8
- const padIndex = ({ num, filePadLength, }) => {
9
- return String(num).padStart(filePadLength, '0');
7
+ exports.getFilePadLength = exports.getFrameOutputFileName = exports.getFrameOutputFileNameFromPattern = void 0;
8
+ const getFrameOutputFileNameFromPattern = ({ pattern, frame, ext, }) => {
9
+ return pattern.replace(/\[frame\]/g, frame).replace(/\[ext\]/g, ext);
10
10
  };
11
- const getFrameOutputFileName = ({ index, frame, imageFormat, countType, lastFrame, totalFrames, }) => {
11
+ exports.getFrameOutputFileNameFromPattern = getFrameOutputFileNameFromPattern;
12
+ const getFrameOutputFileName = ({ index, frame, imageFormat, countType, lastFrame, totalFrames, imageSequencePattern, }) => {
12
13
  const filePadLength = (0, exports.getFilePadLength)({ lastFrame, countType, totalFrames });
14
+ const frameStr = countType === 'actual-frames'
15
+ ? String(frame).padStart(filePadLength, '0')
16
+ : String(index).padStart(filePadLength, '0');
17
+ if (imageSequencePattern) {
18
+ return (0, exports.getFrameOutputFileNameFromPattern)({
19
+ pattern: imageSequencePattern,
20
+ frame: frameStr,
21
+ ext: imageFormat,
22
+ });
23
+ }
13
24
  const prefix = 'element';
14
25
  if (countType === 'actual-frames') {
15
- const paddedIndex = padIndex({ filePadLength, num: frame });
16
- return `${prefix}-${paddedIndex}.${imageFormat}`;
26
+ return `${prefix}-${frameStr}.${imageFormat}`;
17
27
  }
18
28
  if (countType === 'from-zero') {
19
- const paddedIndex = padIndex({ filePadLength, num: index });
20
- return `${prefix}-${paddedIndex}.${imageFormat}`;
29
+ return `${prefix}-${frameStr}.${imageFormat}`;
21
30
  }
22
31
  throw new TypeError('Unknown count type');
23
32
  };
package/dist/index.d.ts CHANGED
@@ -1041,6 +1041,21 @@ export declare const RenderInternals: {
1041
1041
  setConfig: (newChromeMode: import("./options/chrome-mode").ChromeMode) => void;
1042
1042
  type: import("./options/chrome-mode").ChromeMode;
1043
1043
  };
1044
+ readonly imageSequencePattern: {
1045
+ name: string;
1046
+ cliFlag: "image-sequence-pattern";
1047
+ ssrName: string;
1048
+ description: () => import("react/jsx-runtime").JSX.Element;
1049
+ docLink: null;
1050
+ type: string | null;
1051
+ getValue: ({ commandLine }: {
1052
+ commandLine: Record<string, unknown>;
1053
+ }) => {
1054
+ value: string;
1055
+ source: string;
1056
+ };
1057
+ setConfig: (pattern: string | null) => void;
1058
+ };
1044
1059
  }>) => Promise<import("./types").RenderFramesOutput>;
1045
1060
  internalRenderMedia: (args_0: import("./render-media").InternalRenderMediaOptions) => Promise<{
1046
1061
  buffer: Buffer | null;
@@ -0,0 +1,15 @@
1
+ export declare const imageSequencePatternOption: {
2
+ name: string;
3
+ cliFlag: "image-sequence-pattern";
4
+ ssrName: string;
5
+ description: () => import("react/jsx-runtime").JSX.Element;
6
+ docLink: null;
7
+ type: string | null;
8
+ getValue: ({ commandLine }: {
9
+ commandLine: Record<string, unknown>;
10
+ }) => {
11
+ value: string;
12
+ source: string;
13
+ };
14
+ setConfig: (pattern: string | null) => void;
15
+ };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.imageSequencePatternOption = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const cliFlag = 'image-sequence-pattern';
6
+ let currentImageSequencePattern = null;
7
+ // Option for --image-sequence-pattern
8
+ exports.imageSequencePatternOption = {
9
+ name: 'Image Sequence Pattern',
10
+ cliFlag,
11
+ ssrName: 'imageSequencePattern',
12
+ description: () => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Pattern for naming image sequence files. Supports ", (0, jsx_runtime_1.jsx)("code", { children: "[frame]" }), " for the zero-padded frame number and ", (0, jsx_runtime_1.jsx)("code", { children: "[ext]" }), " for the file extension."] })),
13
+ docLink: null,
14
+ type: 'string',
15
+ getValue: ({ commandLine }) => {
16
+ if (currentImageSequencePattern !== null) {
17
+ return {
18
+ value: currentImageSequencePattern,
19
+ source: 'config',
20
+ };
21
+ }
22
+ return {
23
+ value: commandLine[cliFlag],
24
+ source: 'cli',
25
+ };
26
+ },
27
+ setConfig: (pattern) => {
28
+ currentImageSequencePattern = pattern;
29
+ },
30
+ };
@@ -694,6 +694,21 @@ export declare const allOptions: {
694
694
  };
695
695
  setConfig(value: boolean): void;
696
696
  };
697
+ imageSequencePatternOption: {
698
+ name: string;
699
+ cliFlag: "image-sequence-pattern";
700
+ ssrName: string;
701
+ description: () => import("react/jsx-runtime").JSX.Element;
702
+ docLink: null;
703
+ type: string | null;
704
+ getValue: ({ commandLine }: {
705
+ commandLine: Record<string, unknown>;
706
+ }) => {
707
+ value: string;
708
+ source: string;
709
+ };
710
+ setConfig: (pattern: string | null) => void;
711
+ };
697
712
  };
698
713
  export type AvailableOptions = keyof typeof allOptions;
699
714
  export type TypeOfOption<Type> = Type extends AnyRemotionOption<infer X> ? X : never;
@@ -22,6 +22,7 @@ const for_seamless_aac_concatenation_1 = require("./for-seamless-aac-concatenati
22
22
  const gl_1 = require("./gl");
23
23
  const hardware_acceleration_1 = require("./hardware-acceleration");
24
24
  const headless_1 = require("./headless");
25
+ const image_sequence_pattern_1 = require("./image-sequence-pattern");
25
26
  const jpeg_quality_1 = require("./jpeg-quality");
26
27
  const latency_hint_1 = require("./latency-hint");
27
28
  const log_level_1 = require("./log-level");
@@ -88,4 +89,5 @@ exports.allOptions = {
88
89
  apiKeyOption: api_key_1.apiKeyOption,
89
90
  audioLatencyHintOption: latency_hint_1.audioLatencyHintOption,
90
91
  enableCrossSiteIsolationOption: cross_site_isolation_1.enableCrossSiteIsolationOption,
92
+ imageSequencePatternOption: image_sequence_pattern_1.imageSequencePatternOption,
91
93
  };
@@ -876,6 +876,21 @@ export declare const optionsMap: {
876
876
  setConfig: (newChromeMode: import("./chrome-mode").ChromeMode) => void;
877
877
  type: import("./chrome-mode").ChromeMode;
878
878
  };
879
+ readonly imageSequencePattern: {
880
+ name: string;
881
+ cliFlag: "image-sequence-pattern";
882
+ ssrName: string;
883
+ description: () => import("react/jsx-runtime").JSX.Element;
884
+ docLink: null;
885
+ type: string | null;
886
+ getValue: ({ commandLine }: {
887
+ commandLine: Record<string, unknown>;
888
+ }) => {
889
+ value: string;
890
+ source: string;
891
+ };
892
+ setConfig: (pattern: string | null) => void;
893
+ };
879
894
  };
880
895
  readonly renderMediaOnLambda: {
881
896
  readonly offthreadVideoCacheSizeInBytes: {
@@ -14,6 +14,7 @@ const encoding_max_rate_1 = require("./encoding-max-rate");
14
14
  const enforce_audio_1 = require("./enforce-audio");
15
15
  const for_seamless_aac_concatenation_1 = require("./for-seamless-aac-concatenation");
16
16
  const hardware_acceleration_1 = require("./hardware-acceleration");
17
+ const image_sequence_pattern_1 = require("./image-sequence-pattern");
17
18
  const jpeg_quality_1 = require("./jpeg-quality");
18
19
  const log_level_1 = require("./log-level");
19
20
  const mute_1 = require("./mute");
@@ -97,6 +98,7 @@ exports.optionsMap = {
97
98
  binariesDirectory: binaries_directory_1.binariesDirectoryOption,
98
99
  onBrowserDownload: on_browser_download_1.onBrowserDownloadOption,
99
100
  chromeMode: chrome_mode_1.chromeModeOption,
101
+ imageSequencePattern: image_sequence_pattern_1.imageSequencePatternOption,
100
102
  },
101
103
  renderMediaOnLambda: {
102
104
  offthreadVideoCacheSizeInBytes: offthreadvideo_cache_size_1.offthreadVideoCacheSizeInBytesOption,
@@ -11,7 +11,7 @@ import type { NextFrameToRender } from './next-frame-to-render';
11
11
  import type { Pool } from './pool';
12
12
  import type { FrameAndAssets, OnArtifact } from './render-frames';
13
13
  import type { BrowserReplacer } from './replace-browser';
14
- export declare const renderFrameAndRetryTargetClose: ({ retriesLeft, attempt, assets, imageFormat, binariesDirectory, cancelSignal, composition, countType, downloadMap, frameDir, framesToRender, jpegQuality, onArtifact, onDownload, onError, outputDir, poolPromise, scale, stoppedSignal, timeoutInMilliseconds, indent, logLevel, makeBrowser, makeNewPage, browserReplacer, concurrencyOrFramesToRender, framesRenderedObj, lastFrame, onFrameBuffer, onFrameUpdate, nextFrameToRender, }: {
14
+ export declare const renderFrameAndRetryTargetClose: ({ retriesLeft, attempt, assets, imageFormat, binariesDirectory, cancelSignal, composition, countType, downloadMap, frameDir, framesToRender, jpegQuality, onArtifact, onDownload, onError, outputDir, poolPromise, scale, stoppedSignal, timeoutInMilliseconds, indent, logLevel, makeBrowser, makeNewPage, browserReplacer, concurrencyOrFramesToRender, framesRenderedObj, lastFrame, onFrameBuffer, onFrameUpdate, nextFrameToRender, imageSequencePattern, }: {
15
15
  retriesLeft: number;
16
16
  attempt: number;
17
17
  imageFormat: VideoImageFormat;
@@ -47,4 +47,5 @@ export declare const renderFrameAndRetryTargetClose: ({ retriesLeft, attempt, as
47
47
  onFrameBuffer: null | ((buffer: Buffer, frame: number) => void) | undefined;
48
48
  onFrameUpdate: null | ((framesRendered: number, frameIndex: number, timeToRenderInMilliseconds: number) => void);
49
49
  nextFrameToRender: NextFrameToRender;
50
+ imageSequencePattern: string | null;
50
51
  }) => Promise<void>;
@@ -7,7 +7,7 @@ const is_delay_render_error_with_retry_1 = require("./is-delay-render-error-with
7
7
  const logger_1 = require("./logger");
8
8
  const make_cancel_signal_1 = require("./make-cancel-signal");
9
9
  const render_frame_1 = require("./render-frame");
10
- const renderFrameAndRetryTargetClose = async ({ retriesLeft, attempt, assets, imageFormat, binariesDirectory, cancelSignal, composition, countType, downloadMap, frameDir, framesToRender, jpegQuality, onArtifact, onDownload, onError, outputDir, poolPromise, scale, stoppedSignal, timeoutInMilliseconds, indent, logLevel, makeBrowser, makeNewPage, browserReplacer, concurrencyOrFramesToRender, framesRenderedObj, lastFrame, onFrameBuffer, onFrameUpdate, nextFrameToRender, }) => {
10
+ const renderFrameAndRetryTargetClose = async ({ retriesLeft, attempt, assets, imageFormat, binariesDirectory, cancelSignal, composition, countType, downloadMap, frameDir, framesToRender, jpegQuality, onArtifact, onDownload, onError, outputDir, poolPromise, scale, stoppedSignal, timeoutInMilliseconds, indent, logLevel, makeBrowser, makeNewPage, browserReplacer, concurrencyOrFramesToRender, framesRenderedObj, lastFrame, onFrameBuffer, onFrameUpdate, nextFrameToRender, imageSequencePattern, }) => {
11
11
  var _a;
12
12
  const currentPool = await poolPromise;
13
13
  if (stoppedSignal.stopped) {
@@ -45,6 +45,7 @@ const renderFrameAndRetryTargetClose = async ({ retriesLeft, attempt, assets, im
45
45
  nextFrameToRender,
46
46
  frame,
47
47
  page: freePage,
48
+ imageSequencePattern,
48
49
  }),
49
50
  new Promise((_, reject) => {
50
51
  cancelSignal === null || cancelSignal === void 0 ? void 0 : cancelSignal(() => {
@@ -114,6 +115,7 @@ const renderFrameAndRetryTargetClose = async ({ retriesLeft, attempt, assets, im
114
115
  onFrameBuffer,
115
116
  onFrameUpdate,
116
117
  nextFrameToRender,
118
+ imageSequencePattern,
117
119
  });
118
120
  }
119
121
  logger_1.Log.warn({ indent, logLevel }, `The browser crashed while rendering frame ${frame}, retrying ${retriesLeft} more times. Learn more about this error under https://www.remotion.dev/docs/target-closed`);
@@ -161,6 +163,7 @@ const renderFrameAndRetryTargetClose = async ({ retriesLeft, attempt, assets, im
161
163
  onFrameBuffer,
162
164
  onFrameUpdate,
163
165
  nextFrameToRender,
166
+ imageSequencePattern,
164
167
  });
165
168
  }
166
169
  };
@@ -6,7 +6,7 @@ import type { VideoImageFormat } from './image-format';
6
6
  import type { LogLevel } from './log-level';
7
7
  import type { CancelSignal } from './make-cancel-signal';
8
8
  import type { FrameAndAssets, OnArtifact } from './render-frames';
9
- export declare const renderFrameWithOptionToReject: ({ reject, width, height, compId, attempt, stoppedSignal, indent, logLevel, timeoutInMilliseconds, outputDir, onFrameBuffer, imageFormat, onError, lastFrame, jpegQuality, frameDir, scale, countType, assets, framesToRender, onArtifact, onDownload, downloadMap, binariesDirectory, cancelSignal, framesRenderedObj, onFrameUpdate, frame, page, }: {
9
+ export declare const renderFrameWithOptionToReject: ({ reject, width, height, compId, attempt, stoppedSignal, indent, logLevel, timeoutInMilliseconds, outputDir, onFrameBuffer, imageFormat, onError, lastFrame, jpegQuality, frameDir, scale, countType, assets, framesToRender, onArtifact, onDownload, downloadMap, binariesDirectory, cancelSignal, framesRenderedObj, onFrameUpdate, frame, page, imageSequencePattern, }: {
10
10
  reject: (err: Error) => void;
11
11
  width: number;
12
12
  height: number;
@@ -40,4 +40,5 @@ export declare const renderFrameWithOptionToReject: ({ reject, width, height, co
40
40
  onFrameUpdate: null | ((framesRendered: number, frameIndex: number, timeToRenderInMilliseconds: number) => void);
41
41
  frame: number;
42
42
  page: Page;
43
+ imageSequencePattern: string | null;
43
44
  }) => Promise<undefined>;
@@ -14,7 +14,7 @@ const logger_1 = require("./logger");
14
14
  const seek_to_frame_1 = require("./seek-to-frame");
15
15
  const take_frame_1 = require("./take-frame");
16
16
  const truthy_1 = require("./truthy");
17
- const renderFrameWithOptionToReject = async ({ reject, width, height, compId, attempt, stoppedSignal, indent, logLevel, timeoutInMilliseconds, outputDir, onFrameBuffer, imageFormat, onError, lastFrame, jpegQuality, frameDir, scale, countType, assets, framesToRender, onArtifact, onDownload, downloadMap, binariesDirectory, cancelSignal, framesRenderedObj, onFrameUpdate, frame, page, }) => {
17
+ const renderFrameWithOptionToReject = async ({ reject, width, height, compId, attempt, stoppedSignal, indent, logLevel, timeoutInMilliseconds, outputDir, onFrameBuffer, imageFormat, onError, lastFrame, jpegQuality, frameDir, scale, countType, assets, framesToRender, onArtifact, onDownload, downloadMap, binariesDirectory, cancelSignal, framesRenderedObj, onFrameUpdate, frame, page, imageSequencePattern, }) => {
18
18
  const startTime = performance.now();
19
19
  const index = framesToRender.indexOf(frame);
20
20
  const assetsOnly = index === -1;
@@ -64,6 +64,7 @@ const renderFrameWithOptionToReject = async ({ reject, width, height, compId, at
64
64
  countType,
65
65
  lastFrame,
66
66
  totalFrames: framesToRender.length,
67
+ imageSequencePattern,
67
68
  })),
68
69
  jpegQuality,
69
70
  width,
@@ -8,7 +8,7 @@ import type { LogLevel } from './log-level';
8
8
  import type { CancelSignal } from './make-cancel-signal';
9
9
  import type { NextFrameToRender } from './next-frame-to-render';
10
10
  import type { FrameAndAssets, OnArtifact } from './render-frames';
11
- export declare const renderFrame: ({ attempt, binariesDirectory, cancelSignal, imageFormat, indent, logLevel, assets, countType, downloadMap, frameDir, framesToRender, jpegQuality, onArtifact, onDownload, scale, composition, onError, outputDir, stoppedSignal, timeoutInMilliseconds, lastFrame, onFrameBuffer, onFrameUpdate, framesRenderedObj, frame, page, }: {
11
+ export declare const renderFrame: ({ attempt, binariesDirectory, cancelSignal, imageFormat, indent, logLevel, assets, countType, downloadMap, frameDir, framesToRender, jpegQuality, onArtifact, onDownload, scale, composition, onError, outputDir, stoppedSignal, timeoutInMilliseconds, lastFrame, onFrameBuffer, onFrameUpdate, framesRenderedObj, frame, page, imageSequencePattern, }: {
12
12
  attempt: number;
13
13
  indent: boolean;
14
14
  logLevel: LogLevel;
@@ -40,4 +40,5 @@ export declare const renderFrame: ({ attempt, binariesDirectory, cancelSignal, i
40
40
  nextFrameToRender: NextFrameToRender;
41
41
  frame: number;
42
42
  page: Page;
43
+ imageSequencePattern: string | null;
43
44
  }) => Promise<void>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.renderFrame = void 0;
4
4
  const render_frame_with_option_to_reject_1 = require("./render-frame-with-option-to-reject");
5
- const renderFrame = ({ attempt, binariesDirectory, cancelSignal, imageFormat, indent, logLevel, assets, countType, downloadMap, frameDir, framesToRender, jpegQuality, onArtifact, onDownload, scale, composition, onError, outputDir, stoppedSignal, timeoutInMilliseconds, lastFrame, onFrameBuffer, onFrameUpdate, framesRenderedObj, frame, page, }) => {
5
+ const renderFrame = ({ attempt, binariesDirectory, cancelSignal, imageFormat, indent, logLevel, assets, countType, downloadMap, frameDir, framesToRender, jpegQuality, onArtifact, onDownload, scale, composition, onError, outputDir, stoppedSignal, timeoutInMilliseconds, lastFrame, onFrameBuffer, onFrameUpdate, framesRenderedObj, frame, page, imageSequencePattern, }) => {
6
6
  return new Promise((resolve, reject) => {
7
7
  (0, render_frame_with_option_to_reject_1.renderFrameWithOptionToReject)({
8
8
  reject,
@@ -34,6 +34,7 @@ const renderFrame = ({ attempt, binariesDirectory, cancelSignal, imageFormat, in
34
34
  onFrameUpdate,
35
35
  frame,
36
36
  page,
37
+ imageSequencePattern,
37
38
  })
38
39
  .then(() => {
39
40
  resolve();
@@ -34,7 +34,7 @@ const validate_1 = require("./validate");
34
34
  const validate_scale_1 = require("./validate-scale");
35
35
  const wrap_with_error_handling_1 = require("./wrap-with-error-handling");
36
36
  const MAX_RETRIES_PER_FRAME = 1;
37
- const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, jpegQuality, imageFormat, frameRange, onError, envVariables, onBrowserLog, onFrameBuffer, onDownload, pagesArray, serveUrl, composition, timeoutInMilliseconds, scale, resolvedConcurrency, everyNthFrame, proxyPort, cancelSignal, downloadMap, muted, makeBrowser, browserReplacer, sourceMapGetter, logLevel, indent, parallelEncodingEnabled, compositionStart, forSeamlessAacConcatenation, onArtifact, binariesDirectory, }) => {
37
+ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, jpegQuality, imageFormat, frameRange, onError, envVariables, onBrowserLog, onFrameBuffer, onDownload, pagesArray, serveUrl, composition, timeoutInMilliseconds, scale, resolvedConcurrency, everyNthFrame, proxyPort, cancelSignal, downloadMap, muted, makeBrowser, browserReplacer, sourceMapGetter, logLevel, indent, parallelEncodingEnabled, compositionStart, forSeamlessAacConcatenation, onArtifact, binariesDirectory, imageSequencePattern, }) => {
38
38
  if (outputDir) {
39
39
  if (!node_fs_1.default.existsSync(outputDir)) {
40
40
  node_fs_1.default.mkdirSync(outputDir, {
@@ -130,6 +130,10 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serialized
130
130
  allFramesAndExtraFrames,
131
131
  concurrencyOrFramesToRender,
132
132
  });
133
+ const pattern = imageSequencePattern || `element-[frame].[ext]`;
134
+ const imageSequenceName = pattern
135
+ .replace(/\[frame\]/g, `%0${filePadLength}d`)
136
+ .replace(/\[ext\]/g, imageFormat);
133
137
  await Promise.all(allFramesAndExtraFrames.map(() => {
134
138
  return (0, render_frame_and_retry_target_close_1.renderFrameAndRetryTargetClose)({
135
139
  retriesLeft: MAX_RETRIES_PER_FRAME,
@@ -163,6 +167,7 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serialized
163
167
  onFrameBuffer,
164
168
  onFrameUpdate,
165
169
  nextFrameToRender,
170
+ imageSequencePattern: pattern,
166
171
  });
167
172
  }));
168
173
  const firstFrameIndex = countType === 'from-zero' ? 0 : framesToRender[0];
@@ -172,7 +177,7 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serialized
172
177
  assets: assets.sort((a, b) => {
173
178
  return a.frame - b.frame;
174
179
  }),
175
- imageSequenceName: node_path_1.default.join(frameDir, `element-%0${filePadLength}d.${imageFormat}`),
180
+ imageSequenceName: node_path_1.default.join(frameDir, imageSequenceName),
176
181
  firstFrameIndex,
177
182
  downloadMap,
178
183
  trimLeftOffset,
@@ -183,7 +188,7 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serialized
183
188
  frameCount: framesToRender.length,
184
189
  };
185
190
  };
186
- const internalRenderFramesRaw = ({ browserExecutable, cancelSignal, chromiumOptions, composition, concurrency, envVariables, everyNthFrame, frameRange, imageFormat, indent, jpegQuality, muted, onBrowserLog, onDownload, onFrameBuffer, onFrameUpdate, onStart, outputDir, port, puppeteerInstance, scale, server, timeoutInMilliseconds, logLevel, webpackBundleOrServeUrl, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, offthreadVideoCacheSizeInBytes, parallelEncodingEnabled, binariesDirectory, forSeamlessAacConcatenation, compositionStart, onBrowserDownload, onArtifact, chromeMode, offthreadVideoThreads, }) => {
191
+ const internalRenderFramesRaw = ({ browserExecutable, cancelSignal, chromiumOptions, composition, concurrency, envVariables, everyNthFrame, frameRange, imageFormat, indent, jpegQuality, muted, onBrowserLog, onDownload, onFrameBuffer, onFrameUpdate, onStart, outputDir, port, puppeteerInstance, scale, server, timeoutInMilliseconds, logLevel, webpackBundleOrServeUrl, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, offthreadVideoCacheSizeInBytes, parallelEncodingEnabled, binariesDirectory, forSeamlessAacConcatenation, compositionStart, onBrowserDownload, onArtifact, chromeMode, offthreadVideoThreads, imageSequencePattern, }) => {
187
192
  (0, validate_1.validateDimension)(composition.height, 'height', 'in the `config` object passed to `renderFrames()`');
188
193
  (0, validate_1.validateDimension)(composition.width, 'width', 'in the `config` object passed to `renderFrames()`');
189
194
  (0, validate_1.validateFps)(composition.fps, 'in the `config` object of `renderFrames()`', false);
@@ -285,6 +290,7 @@ const internalRenderFramesRaw = ({ browserExecutable, cancelSignal, chromiumOpti
285
290
  onArtifact,
286
291
  chromeMode,
287
292
  offthreadVideoThreads,
293
+ imageSequencePattern,
288
294
  });
289
295
  }),
290
296
  ])
@@ -333,7 +339,7 @@ exports.internalRenderFrames = (0, wrap_with_error_handling_1.wrapWithErrorHandl
333
339
  * @see [Documentation](https://www.remotion.dev/docs/renderer/render-frames)
334
340
  */
335
341
  const renderFrames = (options) => {
336
- const { composition, inputProps, onFrameUpdate, onStart, outputDir, serveUrl, browserExecutable, cancelSignal, chromiumOptions, concurrency, dumpBrowserLogs, envVariables, everyNthFrame, frameRange, imageFormat, jpegQuality, muted, onBrowserLog, onDownload, onFrameBuffer, port, puppeteerInstance, scale, timeoutInMilliseconds, verbose, quality, logLevel: passedLogLevel, offthreadVideoCacheSizeInBytes, binariesDirectory, onBrowserDownload, onArtifact, chromeMode, offthreadVideoThreads, } = options;
342
+ const { composition, inputProps, onFrameUpdate, onStart, outputDir, serveUrl, browserExecutable, cancelSignal, chromiumOptions, concurrency, dumpBrowserLogs, envVariables, everyNthFrame, frameRange, imageFormat, jpegQuality, muted, onBrowserLog, onDownload, onFrameBuffer, port, puppeteerInstance, scale, timeoutInMilliseconds, verbose, quality, logLevel: passedLogLevel, offthreadVideoCacheSizeInBytes, binariesDirectory, onBrowserDownload, onArtifact, chromeMode, offthreadVideoThreads, imageSequencePattern, } = options;
337
343
  if (!composition) {
338
344
  throw new Error('No `composition` option has been specified for renderFrames()');
339
345
  }
@@ -390,6 +396,7 @@ const renderFrames = (options) => {
390
396
  onArtifact: onArtifact !== null && onArtifact !== void 0 ? onArtifact : null,
391
397
  chromeMode: chromeMode !== null && chromeMode !== void 0 ? chromeMode : 'headless-shell',
392
398
  offthreadVideoThreads: offthreadVideoThreads !== null && offthreadVideoThreads !== void 0 ? offthreadVideoThreads : null,
399
+ imageSequencePattern: imageSequencePattern !== null && imageSequencePattern !== void 0 ? imageSequencePattern : null,
393
400
  });
394
401
  };
395
402
  exports.renderFrames = renderFrames;
@@ -366,6 +366,7 @@ const internalRenderMediaRaw = ({ proResProfile, x264Preset, crf, composition, s
366
366
  onBrowserDownload,
367
367
  onArtifact,
368
368
  chromeMode,
369
+ imageSequencePattern: null,
369
370
  });
370
371
  return renderFramesProc;
371
372
  })