@remotion/renderer 3.2.16 → 3.2.20

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.
@@ -0,0 +1 @@
1
+ export declare type FfmpegArgsHook = (args: string[]) => string[];
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import execa from 'execa';
3
2
  import { SymbolicateableError } from './error-handling/symbolicateable-error';
4
3
  import { mimeContentType, mimeLookup } from './mime-types';
@@ -68,7 +67,7 @@ export declare const RenderInternals: {
68
67
  task: Promise<Buffer | null>;
69
68
  getLogs: () => string;
70
69
  }>;
71
- getFileExtensionFromCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif", type: "chunk" | "final") => "mp3" | "aac" | "wav" | "gif" | "webm" | "mp4" | "mov" | "mkv";
70
+ getFileExtensionFromCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif", type: "chunk" | "final") => "mp3" | "aac" | "wav" | "gif" | "mp4" | "mkv" | "mov" | "webm";
72
71
  tmpDir: (str: string) => string;
73
72
  deleteDirectory: (directory: string) => Promise<void>;
74
73
  isServeUrl: (potentialUrl: string) => boolean;
@@ -123,8 +122,8 @@ export declare const RenderInternals: {
123
122
  validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
124
123
  DEFAULT_BROWSER: import("./browser").Browser;
125
124
  validateFrameRange: (frameRange: import("./frame-range").FrameRange | null) => void;
126
- DEFAULT_OPENGL_RENDERER: "angle" | "swangle" | "egl" | "swiftshader" | null;
127
- validateOpenGlRenderer: (option: "angle" | "swangle" | "egl" | "swiftshader" | null) => "angle" | "swangle" | "egl" | "swiftshader" | null;
125
+ DEFAULT_OPENGL_RENDERER: "swangle" | "angle" | "egl" | "swiftshader" | null;
126
+ validateOpenGlRenderer: (option: "swangle" | "angle" | "egl" | "swiftshader" | null) => "swangle" | "angle" | "egl" | "swiftshader" | null;
128
127
  getDefaultCrfForCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => number;
129
128
  validateSelectedCrfAndCodecCombination: (crf: unknown, codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => void;
130
129
  validImageFormats: readonly ["png", "jpeg", "none"];
@@ -136,12 +135,12 @@ export declare const RenderInternals: {
136
135
  DEFAULT_TIMEOUT: number;
137
136
  getValidCrfRanges: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => [number, number];
138
137
  validateSelectedPixelFormatAndCodecCombination: (pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le", codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => void;
139
- validateSelectedCodecAndProResCombination: (actualCodec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif", actualProResProfile: "proxy" | "4444-xq" | "4444" | "hq" | "standard" | "light" | undefined) => void;
140
- validateSelectedPixelFormatAndImageFormatCombination: (pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le", imageFormat: "jpeg" | "png" | "none") => "none" | "valid";
138
+ validateSelectedCodecAndProResCombination: (actualCodec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif", actualProResProfile: "4444-xq" | "4444" | "hq" | "standard" | "light" | "proxy" | undefined) => void;
139
+ validateSelectedPixelFormatAndImageFormatCombination: (pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le", imageFormat: "png" | "jpeg" | "none") => "none" | "valid";
141
140
  DEFAULT_CODEC: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
142
141
  isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif" | undefined) => boolean;
143
142
  logLevels: readonly ["verbose", "info", "warn", "error"];
144
- isEqualOrBelowLogLevel: (currentLevel: "error" | "verbose" | "info" | "warn", level: "error" | "verbose" | "info" | "warn") => boolean;
143
+ isEqualOrBelowLogLevel: (currentLevel: "verbose" | "error" | "info" | "warn", level: "verbose" | "error" | "info" | "warn") => boolean;
145
144
  isValidLogLevel: (level: string) => boolean;
146
145
  validateEveryNthFrame: (everyNthFrame: unknown) => void;
147
146
  perf: typeof perf;
@@ -0,0 +1 @@
1
+ export declare const makeAssetsDownloadTmpDir: () => string;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeAssetsDownloadTmpDir = void 0;
4
+ const tmp_dir_1 = require("./tmp-dir");
5
+ let dir = null;
6
+ const makeAssetsDownloadTmpDir = () => {
7
+ if (dir) {
8
+ return dir;
9
+ }
10
+ dir = (0, tmp_dir_1.tmpDir)('remotion-assets-dir');
11
+ return dir;
12
+ };
13
+ exports.makeAssetsDownloadTmpDir = makeAssetsDownloadTmpDir;
@@ -20,6 +20,14 @@ declare type ConfigOrComposition = {
20
20
  } | {
21
21
  composition: SmallTCompMetadata;
22
22
  };
23
+ declare type ConcurrencyOrParallelism = {
24
+ concurrency: number | null;
25
+ } | {
26
+ /**
27
+ * @deprecated This field has been renamed to `concurrency`
28
+ */
29
+ parallelism: number | null;
30
+ };
23
31
  declare type RenderFramesOptions = {
24
32
  onStart: (data: OnStartData) => void;
25
33
  onFrameUpdate: (framesRendered: number, frameIndex: number) => void;
@@ -27,7 +35,6 @@ declare type RenderFramesOptions = {
27
35
  inputProps: unknown;
28
36
  envVariables?: Record<string, string>;
29
37
  imageFormat: ImageFormat;
30
- parallelism?: number | null;
31
38
  quality?: number;
32
39
  frameRange?: FrameRange | null;
33
40
  everyNthFrame?: number;
@@ -49,6 +56,6 @@ declare type RenderFramesOptions = {
49
56
  */
50
57
  downloadMap?: DownloadMap;
51
58
  muted?: boolean;
52
- } & ConfigOrComposition & ServeUrlOrWebpackBundle;
59
+ } & ConfigOrComposition & ConcurrencyOrParallelism & ServeUrlOrWebpackBundle;
53
60
  export declare const renderFrames: (options: RenderFramesOptions) => Promise<RenderFramesOutput>;
54
61
  export {};
@@ -39,12 +39,21 @@ const getComposition = (others) => {
39
39
  }
40
40
  return undefined;
41
41
  };
42
+ const getConcurrency = (others) => {
43
+ if ('concurrency' in others) {
44
+ return others.concurrency;
45
+ }
46
+ if ('parallelism' in others) {
47
+ return others.parallelism;
48
+ }
49
+ return undefined;
50
+ };
42
51
  const getPool = async (pages) => {
43
52
  const puppeteerPages = await Promise.all(pages);
44
53
  const pool = new pool_1.Pool(puppeteerPages);
45
54
  return pool;
46
55
  };
47
- const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, quality, imageFormat = image_format_1.DEFAULT_IMAGE_FORMAT, frameRange, puppeteerInstance, onError, envVariables, onBrowserLog, onFrameBuffer, onDownload, pagesArray, serveUrl, composition, timeoutInMilliseconds, scale, actualParallelism, everyNthFrame = 1, proxyPort, cancelSignal, downloadMap, muted, }) => {
56
+ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, quality, imageFormat = image_format_1.DEFAULT_IMAGE_FORMAT, frameRange, puppeteerInstance, onError, envVariables, onBrowserLog, onFrameBuffer, onDownload, pagesArray, serveUrl, composition, timeoutInMilliseconds, scale, actualConcurrency, everyNthFrame = 1, proxyPort, cancelSignal, downloadMap, muted, }) => {
48
57
  if (!puppeteerInstance) {
49
58
  throw new Error('no puppeteer instance passed to innerRenderFrames - internal error');
50
59
  }
@@ -59,7 +68,7 @@ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, qual
59
68
  const realFrameRange = (0, get_frame_to_render_1.getRealFrameRange)(composition.durationInFrames, frameRange !== null && frameRange !== void 0 ? frameRange : null);
60
69
  const framesToRender = (0, get_duration_from_frame_range_1.getFramesToRender)(realFrameRange, everyNthFrame);
61
70
  const lastFrame = framesToRender[framesToRender.length - 1];
62
- const pages = new Array(actualParallelism).fill(true).map(async () => {
71
+ const pages = new Array(actualConcurrency).fill(true).map(async () => {
63
72
  const page = await puppeteerInstance.newPage();
64
73
  pagesArray.push(page);
65
74
  await page.setViewport({
@@ -234,8 +243,9 @@ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, qual
234
243
  .then(() => happyPath);
235
244
  };
236
245
  const renderFrames = (options) => {
237
- var _a, _b, _c, _d, _e;
246
+ var _a, _b, _c, _d;
238
247
  const composition = getComposition(options);
248
+ const concurrency = getConcurrency(options);
239
249
  if (!composition) {
240
250
  throw new Error('No `composition` option has been specified for renderFrames()');
241
251
  }
@@ -257,7 +267,7 @@ const renderFrames = (options) => {
257
267
  });
258
268
  const downloadMap = (_c = options.downloadMap) !== null && _c !== void 0 ? _c : (0, download_map_1.makeDownloadMap)();
259
269
  const onDownload = (_d = options.onDownload) !== null && _d !== void 0 ? _d : (() => () => undefined);
260
- const actualParallelism = (0, get_concurrency_1.getActualConcurrency)((_e = options.parallelism) !== null && _e !== void 0 ? _e : null);
270
+ const actualConcurrency = (0, get_concurrency_1.getActualConcurrency)(concurrency !== null && concurrency !== void 0 ? concurrency : null);
261
271
  const openedPages = [];
262
272
  return new Promise((resolve, reject) => {
263
273
  var _a, _b, _c;
@@ -284,7 +294,7 @@ const renderFrames = (options) => {
284
294
  }),
285
295
  browserInstance,
286
296
  ]).then(([{ serveUrl, closeServer, offthreadPort }, puppeteerInstance]) => {
287
- const { stopCycling } = (0, cycle_browser_tabs_1.cycleBrowserTabs)(puppeteerInstance, actualParallelism);
297
+ const { stopCycling } = (0, cycle_browser_tabs_1.cycleBrowserTabs)(puppeteerInstance, actualConcurrency);
288
298
  cleanup.push(stopCycling);
289
299
  cleanup.push(closeServer);
290
300
  return innerRenderFrames({
@@ -294,7 +304,7 @@ const renderFrames = (options) => {
294
304
  pagesArray: openedPages,
295
305
  serveUrl,
296
306
  composition,
297
- actualParallelism,
307
+ actualConcurrency,
298
308
  onDownload,
299
309
  proxyPort: offthreadPort,
300
310
  downloadMap,
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { SmallTCompMetadata } from 'remotion';
3
2
  import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
4
3
  import type { DownloadMap } from './assets/download-map';
@@ -20,6 +19,7 @@ export declare type RenderMediaOnProgress = (progress: {
20
19
  encodedFrames: number;
21
20
  encodedDoneIn: number | null;
22
21
  renderedDoneIn: number | null;
22
+ progress: number;
23
23
  stitchStage: StitchingState;
24
24
  }) => void;
25
25
  export declare type RenderMediaOptions = {
@@ -27,7 +27,6 @@ export declare type RenderMediaOptions = {
27
27
  codec: Codec;
28
28
  composition: SmallTCompMetadata;
29
29
  inputProps?: unknown;
30
- parallelism?: number | null;
31
30
  crf?: number | null;
32
31
  imageFormat?: 'png' | 'jpeg' | 'none';
33
32
  ffmpegExecutable?: FfmpegExecutable;
@@ -59,10 +58,19 @@ export declare type RenderMediaOptions = {
59
58
  downloadMap?: DownloadMap;
60
59
  muted?: boolean;
61
60
  enforceAudioTrack?: boolean;
62
- } & ServeUrlOrWebpackBundle;
61
+ } & ServeUrlOrWebpackBundle & ConcurrencyOrParallelism;
62
+ declare type ConcurrencyOrParallelism = {
63
+ concurrency: number | null;
64
+ } | {
65
+ /**
66
+ * @deprecated This field has been renamed to `concurrency`
67
+ */
68
+ parallelism: number | null;
69
+ };
63
70
  /**
64
71
  *
65
72
  * @description Render a video from a composition
66
73
  * @link https://www.remotion.dev/docs/renderer/render-media
67
74
  */
68
- export declare const renderMedia: ({ parallelism, proResProfile, crf, composition, ffmpegExecutable, ffprobeExecutable, inputProps, pixelFormat, codec, envVariables, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, dumpBrowserLogs, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ...options }: RenderMediaOptions) => Promise<Buffer | null>;
75
+ export declare const renderMedia: ({ proResProfile, crf, composition, ffmpegExecutable, ffprobeExecutable, inputProps, pixelFormat, codec, envVariables, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, dumpBrowserLogs, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ...options }: RenderMediaOptions) => Promise<Buffer | null>;
76
+ export {};
@@ -32,12 +32,21 @@ const stitch_frames_to_video_1 = require("./stitch-frames-to-video");
32
32
  const validate_even_dimensions_with_codec_1 = require("./validate-even-dimensions-with-codec");
33
33
  const validate_output_filename_1 = require("./validate-output-filename");
34
34
  const validate_scale_1 = require("./validate-scale");
35
+ const getConcurrency = (others) => {
36
+ if ('concurrency' in others) {
37
+ return others.concurrency;
38
+ }
39
+ if ('parallelism' in others) {
40
+ return others.parallelism;
41
+ }
42
+ return null;
43
+ };
35
44
  /**
36
45
  *
37
46
  * @description Render a video from a composition
38
47
  * @link https://www.remotion.dev/docs/renderer/render-media
39
48
  */
40
- const renderMedia = ({ parallelism, proResProfile, crf, composition, ffmpegExecutable, ffprobeExecutable, inputProps, pixelFormat, codec, envVariables, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, dumpBrowserLogs, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ...options }) => {
49
+ const renderMedia = ({ proResProfile, crf, composition, ffmpegExecutable, ffprobeExecutable, inputProps, pixelFormat, codec, envVariables, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, dumpBrowserLogs, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ...options }) => {
41
50
  var _a, _b, _c, _d;
42
51
  (0, quality_1.validateQuality)(options.quality);
43
52
  if (typeof crf !== 'undefined' && crf !== null) {
@@ -50,6 +59,7 @@ const renderMedia = ({ parallelism, proResProfile, crf, composition, ffmpegExecu
50
59
  ? path_1.default.resolve(process.cwd(), outputLocation)
51
60
  : null;
52
61
  (0, validate_scale_1.validateScale)(scale);
62
+ const concurrency = getConcurrency(options);
53
63
  const everyNthFrame = (_a = options.everyNthFrame) !== null && _a !== void 0 ? _a : 1;
54
64
  const numberOfGifLoops = (_b = options.numberOfGifLoops) !== null && _b !== void 0 ? _b : null;
55
65
  const serveUrl = (0, legacy_webpack_config_1.getServeUrlWithFallback)(options);
@@ -101,6 +111,9 @@ const renderMedia = ({ parallelism, proResProfile, crf, composition, ffmpegExecu
101
111
  renderedDoneIn,
102
112
  renderedFrames,
103
113
  stitchStage,
114
+ progress: Math.round(((0.7 * renderedFrames + 0.3 * encodedFrames) /
115
+ composition.durationInFrames) *
116
+ 100) / 100,
104
117
  });
105
118
  };
106
119
  const realFrameRange = (0, get_frame_to_render_1.getRealFrameRange)(composition.durationInFrames, frameRange !== null && frameRange !== void 0 ? frameRange : null);
@@ -160,7 +173,7 @@ const renderMedia = ({ parallelism, proResProfile, crf, composition, ffmpegExecu
160
173
  renderedFrames = frame;
161
174
  callUpdate();
162
175
  },
163
- parallelism,
176
+ concurrency,
164
177
  outputDir,
165
178
  onStart: (data) => {
166
179
  renderedFrames = 0;
@@ -0,0 +1,2 @@
1
+ import type { FfmpegArgsHook } from './ffmpeg-args-hook';
2
+ export declare const validateFfmpegArgsHook: (ffmpegArgsHook?: FfmpegArgsHook) => void;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateFfmpegArgsHook = void 0;
4
+ const validateFfmpegArgsHook = (ffmpegArgsHook) => {
5
+ if (ffmpegArgsHook && typeof ffmpegArgsHook !== 'function') {
6
+ throw new TypeError(`Argument passed for "ffmpegArgsHook" is not a function: ${ffmpegArgsHook}`);
7
+ }
8
+ };
9
+ exports.validateFfmpegArgsHook = validateFfmpegArgsHook;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "3.2.16",
3
+ "version": "3.2.20",
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.2.16",
25
+ "remotion": "3.2.20",
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": "3c64e274a2c74e1b791d4a24b3af2ae456c0fd9e"
60
+ "gitHead": "640f36c0c2d9fb1b7768925bf9d64840cbc31bc6"
61
61
  }