@remotion/renderer 4.0.0-alpha.217 → 4.0.0-alpha10

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.
Files changed (126) hide show
  1. package/README.md +5 -37
  2. package/dist/assets/download-and-map-assets-to-file.js +6 -6
  3. package/dist/assets/download-file.d.ts +3 -2
  4. package/dist/assets/download-file.js +18 -3
  5. package/dist/assets/download-map.d.ts +0 -26
  6. package/dist/assets/download-map.js +7 -12
  7. package/dist/assets/get-video-stream-duration.d.ts +5 -2
  8. package/dist/assets/get-video-stream-duration.js +12 -6
  9. package/dist/assets/read-file.d.ts +1 -1
  10. package/dist/assets/read-file.js +2 -2
  11. package/dist/assets/sanitize-filepath.js +2 -2
  12. package/dist/browser/Browser.d.ts +4 -4
  13. package/dist/browser/Browser.js +38 -38
  14. package/dist/browser/BrowserFetcher.d.ts +15 -63
  15. package/dist/browser/BrowserFetcher.js +138 -226
  16. package/dist/browser/BrowserPage.d.ts +4 -4
  17. package/dist/browser/BrowserRunner.d.ts +1 -1
  18. package/dist/browser/BrowserRunner.js +9 -22
  19. package/dist/browser/DOMWorld.d.ts +3 -3
  20. package/dist/browser/LaunchOptions.d.ts +1 -2
  21. package/dist/browser/Launcher.d.ts +3 -3
  22. package/dist/browser/Launcher.js +10 -23
  23. package/dist/browser/NodeWebSocketTransport.js +4 -4
  24. package/dist/browser/PuppeteerNode.d.ts +2 -5
  25. package/dist/browser/PuppeteerNode.js +0 -5
  26. package/dist/browser/Target.d.ts +2 -2
  27. package/dist/browser/create-browser-fetcher.js +34 -48
  28. package/dist/browser/get-download-destination.js +8 -8
  29. package/dist/browser/util.d.ts +2 -2
  30. package/dist/call-ffmpeg.d.ts +4 -7
  31. package/dist/call-ffmpeg.js +24 -16
  32. package/dist/chalk/index.d.ts +54 -0
  33. package/dist/chalk/index.js +135 -0
  34. package/dist/chalk/is-color-supported.d.ts +1 -0
  35. package/dist/chalk/is-color-supported.js +37 -0
  36. package/dist/client.d.ts +1 -0
  37. package/dist/client.js +1 -0
  38. package/dist/codec-supports-media.d.ts +1 -0
  39. package/dist/codec-supports-media.js +20 -5
  40. package/dist/combine-videos.js +6 -6
  41. package/dist/compositor/compose.d.ts +6 -2
  42. package/dist/compositor/compose.js +43 -20
  43. package/dist/compositor/compositor.d.ts +4 -8
  44. package/dist/compositor/compositor.js +67 -53
  45. package/dist/compositor/get-executable-path.js +3 -0
  46. package/dist/compositor/payloads.d.ts +34 -7
  47. package/dist/crf.js +8 -2
  48. package/dist/delete-directory.js +3 -3
  49. package/dist/does-have-m2-bug.js +2 -2
  50. package/dist/ensure-output-directory.js +5 -5
  51. package/dist/ensure-presentation-timestamp.d.ts +9 -2
  52. package/dist/ensure-presentation-timestamp.js +13 -5
  53. package/dist/extract-frame-from-video.d.ts +3 -1
  54. package/dist/extract-frame-from-video.js +29 -7
  55. package/dist/ffmpeg-filter-file.js +7 -7
  56. package/dist/find-closest-package-json.js +6 -6
  57. package/dist/get-browser-instance.d.ts +2 -2
  58. package/dist/get-can-extract-frames-fast.d.ts +4 -1
  59. package/dist/get-can-extract-frames-fast.js +12 -1
  60. package/dist/get-compositions.d.ts +8 -3
  61. package/dist/get-compositions.js +6 -2
  62. package/dist/get-concurrency.js +3 -3
  63. package/dist/get-extension-of-filename.js +2 -2
  64. package/dist/get-frame-of-video-slow.d.ts +8 -3
  65. package/dist/get-frame-of-video-slow.js +11 -3
  66. package/dist/get-local-browser-executable.js +6 -15
  67. package/dist/get-video-info.d.ts +5 -2
  68. package/dist/get-video-info.js +12 -6
  69. package/dist/get-video-threads-flag.js +3 -3
  70. package/dist/index.d.ts +92 -16
  71. package/dist/index.js +15 -6
  72. package/dist/last-frame-from-video-cache.d.ts +4 -1
  73. package/dist/last-frame-from-video-cache.js +1 -0
  74. package/dist/logger.d.ts +22 -0
  75. package/dist/logger.js +61 -0
  76. package/dist/merge-audio-track.js +2 -2
  77. package/dist/mime-types.js +2 -2
  78. package/dist/offthread-video-server.d.ts +12 -6
  79. package/dist/offthread-video-server.js +66 -56
  80. package/dist/open-browser.d.ts +3 -3
  81. package/dist/open-browser.js +1 -1
  82. package/dist/options/jpeg-quality.js +1 -1
  83. package/dist/options/video-codec.js +1 -1
  84. package/dist/prepare-server.d.ts +6 -1
  85. package/dist/prepare-server.js +15 -7
  86. package/dist/prespawn-ffmpeg.d.ts +1 -0
  87. package/dist/prespawn-ffmpeg.js +37 -14
  88. package/dist/prestitcher-memory-usage.js +2 -2
  89. package/dist/puppeteer-evaluate.js +2 -2
  90. package/dist/puppeteer-screenshot.js +1 -1
  91. package/dist/render-frames.d.ts +9 -4
  92. package/dist/render-frames.js +28 -12
  93. package/dist/render-media.d.ts +7 -4
  94. package/dist/render-media.js +49 -26
  95. package/dist/render-still.d.ts +10 -3
  96. package/dist/render-still.js +26 -9
  97. package/dist/replace-browser.d.ts +4 -4
  98. package/dist/resolve-asset-src.js +2 -2
  99. package/dist/screenshot-task.js +2 -2
  100. package/dist/select-composition.d.ts +33 -0
  101. package/dist/select-composition.js +119 -0
  102. package/dist/serve-handler/index.d.ts +1 -1
  103. package/dist/serve-handler/index.js +15 -15
  104. package/dist/serve-handler/is-path-inside.js +3 -3
  105. package/dist/serve-static.d.ts +5 -0
  106. package/dist/serve-static.js +25 -20
  107. package/dist/set-props-and-env.d.ts +5 -3
  108. package/dist/set-props-and-env.js +13 -3
  109. package/dist/stitch-frames-to-video.d.ts +1 -0
  110. package/dist/stitch-frames-to-video.js +76 -53
  111. package/dist/take-frame-and-compose.d.ts +3 -1
  112. package/dist/take-frame-and-compose.js +8 -7
  113. package/dist/tmp-dir.js +7 -7
  114. package/dist/try-to-extract-frame-of-video-fast.d.ts +4 -2
  115. package/dist/try-to-extract-frame-of-video-fast.js +7 -3
  116. package/install-toolchain.mjs +3 -9
  117. package/package.json +70 -71
  118. package/types/ws/index.d.ts +5 -5
  119. package/ffmpeg/SOURCE.md +0 -1
  120. package/ffmpeg/linux-arm-musl.gz +0 -0
  121. package/ffmpeg/linux-arm.gz +0 -0
  122. package/ffmpeg/linux-x64-musl.gz +0 -0
  123. package/ffmpeg/linux-x64.gz +0 -0
  124. package/ffmpeg/macos-arm.gz +0 -0
  125. package/ffmpeg/macos-x64.gz +0 -0
  126. package/ffmpeg/windows.gz +0 -0
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import execa from 'execa';
3
+ import { HeadlessBrowser } from './browser/Browser';
3
4
  import { SymbolicateableError } from './error-handling/symbolicateable-error';
4
5
  import { mimeContentType, mimeLookup } from './mime-types';
5
6
  import * as perf from './perf';
@@ -9,15 +10,14 @@ export { AudioCodec } from './audio-codec';
9
10
  export { Browser } from './browser';
10
11
  export { BrowserExecutable } from './browser-executable';
11
12
  export { BrowserLog } from './browser-log';
13
+ export type { HeadlessBrowser } from './browser/Browser';
12
14
  export { Codec, CodecOrUndefined } from './codec';
13
15
  export { Crf } from './crf';
14
16
  export { ErrorWithStackFrame } from './error-handling/handle-javascript-exception';
15
17
  export type { FfmpegOverrideFn } from './ffmpeg-override';
16
18
  export { FileExtension } from './file-extensions';
17
19
  export { FrameRange } from './frame-range';
18
- export { getCanExtractFramesFast } from './get-can-extract-frames-fast';
19
20
  export { getCompositions } from './get-compositions';
20
- export { getActualConcurrency } from './get-concurrency';
21
21
  export { ImageFormat, StillImageFormat, validateSelectedPixelFormatAndImageFormatCombination, VideoImageFormat, } from './image-format';
22
22
  export type { LogLevel } from './log-level';
23
23
  export { CancelSignal, makeCancelSignal } from './make-cancel-signal';
@@ -29,6 +29,7 @@ export { ProResProfile } from './prores-profile';
29
29
  export { renderFrames } from './render-frames';
30
30
  export { renderMedia, RenderMediaOnProgress, RenderMediaOptions, SlowFrame, StitchingState, } from './render-media';
31
31
  export { renderStill, RenderStillOptions } from './render-still';
32
+ export { selectComposition } from './select-composition';
32
33
  export { StitcherOptions, stitchFramesToVideo } from './stitch-frames-to-video';
33
34
  export { SymbolicatedStackFrame } from './symbolicate-stacktrace';
34
35
  export { OnStartData, RenderFramesOutput } from './types';
@@ -43,9 +44,13 @@ export declare const RenderInternals: {
43
44
  onError: (err: Error) => void;
44
45
  downloadMap: import("./assets/download-map").DownloadMap;
45
46
  remotionRoot: string;
47
+ concurrency: number;
48
+ verbose: boolean;
49
+ indent: boolean;
46
50
  }) => Promise<{
47
51
  port: number;
48
52
  close: () => Promise<void>;
53
+ compositor: import("./compositor/compositor").Compositor;
49
54
  }>;
50
55
  validateEvenDimensionsWithCodec: ({ width, height, codec, scale, }: {
51
56
  width: number;
@@ -60,7 +65,7 @@ export declare const RenderInternals: {
60
65
  ensureOutputDirectory: (outputLocation: string) => void;
61
66
  getRealFrameRange: (durationInFrames: number, frameRange: import("./frame-range").FrameRange | null) => [number, number];
62
67
  validatePuppeteerTimeout: (timeoutInMilliseconds: unknown) => void;
63
- downloadFile: ({ onProgress, url, to: toFn, }: {
68
+ downloadFile: (options: {
64
69
  url: string;
65
70
  to: (contentDisposition: string | null, contentType: string | null) => string;
66
71
  onProgress: ((progress: {
@@ -68,7 +73,7 @@ export declare const RenderInternals: {
68
73
  downloaded: number;
69
74
  totalSize: number | null;
70
75
  }) => void) | undefined;
71
- }) => Promise<{
76
+ }, retries?: number) => Promise<{
72
77
  sizeInBytes: number;
73
78
  to: string;
74
79
  }>;
@@ -110,8 +115,8 @@ export declare const RenderInternals: {
110
115
  validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
111
116
  DEFAULT_BROWSER: import("./browser").Browser;
112
117
  validateFrameRange: (frameRange: import("./frame-range").FrameRange | null) => void;
113
- DEFAULT_OPENGL_RENDERER: "angle" | "swangle" | "egl" | "swiftshader" | null;
114
- validateOpenGlRenderer: (option: "angle" | "swangle" | "egl" | "swiftshader" | null) => "angle" | "swangle" | "egl" | "swiftshader" | null;
118
+ DEFAULT_OPENGL_RENDERER: "swangle" | "angle" | "egl" | "swiftshader" | null;
119
+ validateOpenGlRenderer: (option: "swangle" | "angle" | "egl" | "swiftshader" | null) => "swangle" | "angle" | "egl" | "swiftshader" | null;
115
120
  validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "gif"];
116
121
  DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
117
122
  validateJpegQuality: (q: number | undefined) => void;
@@ -119,7 +124,7 @@ export declare const RenderInternals: {
119
124
  DEFAULT_CODEC: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
120
125
  isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif" | undefined) => boolean;
121
126
  logLevels: readonly ["verbose", "info", "warn", "error"];
122
- isEqualOrBelowLogLevel: (currentLevel: "error" | "verbose" | "info" | "warn", level: "error" | "verbose" | "info" | "warn") => boolean;
127
+ isEqualOrBelowLogLevel: (currentLevel: "verbose" | "error" | "info" | "warn", level: "verbose" | "error" | "info" | "warn") => boolean;
123
128
  isValidLogLevel: (level: string) => boolean;
124
129
  perf: typeof perf;
125
130
  makeDownloadMap: () => import("./assets/download-map").DownloadMap;
@@ -284,23 +289,94 @@ export declare const RenderInternals: {
284
289
  defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif">;
285
290
  getExecutablePath: (type: "compositor" | "ffmpeg" | "ffprobe" | "ffmpeg-cwd") => string;
286
291
  callFf: (bin: "ffmpeg" | "ffprobe", args: (string | null)[], options?: execa.Options<string> | undefined) => execa.ExecaChildProcess<string>;
287
- callFfExtraOptions: () => {
292
+ dynamicLibraryPathOptions: () => {
288
293
  env: {
289
294
  DYLD_LIBRARY_PATH: string;
290
- PATH?: undefined;
291
- LD_LIBRARY_PATH?: undefined;
295
+ RUST_BACKTRACE: string;
292
296
  } | {
293
297
  PATH: string;
294
- DYLD_LIBRARY_PATH?: undefined;
295
- LD_LIBRARY_PATH?: undefined;
298
+ RUST_BACKTRACE: string;
296
299
  } | {
297
300
  LD_LIBRARY_PATH: string;
298
- DYLD_LIBRARY_PATH?: undefined;
299
- PATH?: undefined;
301
+ RUST_BACKTRACE: string;
300
302
  };
301
303
  };
302
304
  validStillImageFormats: readonly ["png", "jpeg", "pdf", "webp"];
303
305
  validVideoImageFormats: readonly ["png", "jpeg", "none"];
304
- DEFAULT_STILL_IMAGE_FORMAT: "jpeg" | "png" | "webp" | "pdf";
305
- DEFAULT_VIDEO_IMAGE_FORMAT: "jpeg" | "png" | "none";
306
+ DEFAULT_STILL_IMAGE_FORMAT: "png" | "jpeg" | "pdf" | "webp";
307
+ DEFAULT_VIDEO_IMAGE_FORMAT: "none" | "png" | "jpeg";
308
+ chalk: {
309
+ enabled: boolean;
310
+ visible: boolean;
311
+ styles: Record<string, {
312
+ codes: [number, number];
313
+ name: string;
314
+ wrap?: ((input: string, newline: boolean) => string) | undefined;
315
+ }>;
316
+ keys: Record<string, string[]>;
317
+ alias?: ((name: string, col: string) => void) | undefined;
318
+ } & {
319
+ reset: (str: string) => string;
320
+ bold: (str: string) => string;
321
+ dim: (str: string) => string;
322
+ italic: (str: string) => string;
323
+ underline: (str: string) => string;
324
+ inverse: (str: string) => string;
325
+ hidden: (str: string) => string;
326
+ strikethrough: (str: string) => string;
327
+ black: (str: string) => string;
328
+ red: (str: string) => string;
329
+ green: (str: string) => string;
330
+ yellow: (str: string) => string;
331
+ blue: (str: string) => string;
332
+ magenta: (str: string) => string;
333
+ white: (str: string) => string;
334
+ gray: (str: string) => string;
335
+ bgBlack: (str: string) => string;
336
+ bgRed: (str: string) => string;
337
+ bgGreen: (str: string) => string;
338
+ bgYellow: (str: string) => string;
339
+ bgBlue: (str: string) => string;
340
+ bgMagenta: (str: string) => string;
341
+ bgWhite: (str: string) => string;
342
+ blackBright: (str: string) => string;
343
+ redBright: (str: string) => string;
344
+ greenBright: (str: string) => string;
345
+ yellowBright: (str: string) => string;
346
+ blueBright: (str: string) => string;
347
+ magentaBright: (str: string) => string;
348
+ whiteBright: (str: string) => string;
349
+ bgBlackBright: (str: string) => string;
350
+ bgRedBright: (str: string) => string;
351
+ bgGreenBright: (str: string) => string;
352
+ bgYellowBright: (str: string) => string;
353
+ bgBlueBright: (str: string) => string;
354
+ bgMagentaBright: (str: string) => string;
355
+ bgWhiteBright: (str: string) => string;
356
+ };
357
+ Log: {
358
+ verbose: (message?: any, ...optionalParams: any[]) => void;
359
+ verboseAdvanced: (options: {
360
+ indent: boolean;
361
+ logLevel: "verbose" | "error" | "info" | "warn";
362
+ } & {
363
+ tag?: string | undefined;
364
+ }, message?: any, ...optionalParams: any[]) => void;
365
+ info: (message?: any, ...optionalParams: any[]) => void;
366
+ infoAdvanced: (options: {
367
+ indent: boolean;
368
+ logLevel: "verbose" | "error" | "info" | "warn";
369
+ }, message?: any, ...optionalParams: any[]) => void;
370
+ warn: (message?: any, ...optionalParams: any[]) => void;
371
+ warnAdvanced: (options: {
372
+ indent: boolean;
373
+ logLevel: "verbose" | "error" | "info" | "warn";
374
+ }, message?: any, ...optionalParams: any[]) => void;
375
+ error: (message?: any, ...optionalParams: any[]) => void;
376
+ };
377
+ getLogLevel: () => "verbose" | "error" | "info" | "warn";
378
+ setLogLevel: (newLogLevel: "verbose" | "error" | "info" | "warn") => void;
379
+ INDENT_TOKEN: string;
380
+ isColorSupported: boolean;
381
+ HeadlessBrowser: typeof HeadlessBrowser;
306
382
  };
package/dist/index.js CHANGED
@@ -26,15 +26,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.RenderInternals = exports.validateOutputFilename = exports.stitchFramesToVideo = exports.renderStill = exports.renderMedia = exports.renderFrames = exports.openBrowser = exports.makeCancelSignal = exports.validateSelectedPixelFormatAndImageFormatCombination = exports.getActualConcurrency = exports.getCompositions = exports.getCanExtractFramesFast = exports.ErrorWithStackFrame = void 0;
29
+ exports.RenderInternals = exports.validateOutputFilename = exports.stitchFramesToVideo = exports.selectComposition = exports.renderStill = exports.renderMedia = exports.renderFrames = exports.openBrowser = exports.makeCancelSignal = exports.validateSelectedPixelFormatAndImageFormatCombination = exports.getCompositions = exports.ErrorWithStackFrame = void 0;
30
30
  const execa_1 = __importDefault(require("execa"));
31
31
  const download_file_1 = require("./assets/download-file");
32
32
  const download_map_1 = require("./assets/download-map");
33
33
  const audio_codec_1 = require("./audio-codec");
34
34
  const browser_1 = require("./browser");
35
+ const Browser_1 = require("./browser/Browser");
35
36
  const TimeoutSettings_1 = require("./browser/TimeoutSettings");
36
37
  const call_ffmpeg_1 = require("./call-ffmpeg");
37
38
  const can_use_parallel_encoding_1 = require("./can-use-parallel-encoding");
39
+ const chalk_1 = require("./chalk");
40
+ const is_color_supported_1 = require("./chalk/is-color-supported");
38
41
  const check_apple_silicon_1 = require("./check-apple-silicon");
39
42
  const codec_1 = require("./codec");
40
43
  const combine_videos_1 = require("./combine-videos");
@@ -59,6 +62,7 @@ const is_audio_codec_1 = require("./is-audio-codec");
59
62
  const is_serve_url_1 = require("./is-serve-url");
60
63
  const jpeg_quality_1 = require("./jpeg-quality");
61
64
  const log_level_1 = require("./log-level");
65
+ const logger_1 = require("./logger");
62
66
  const mime_types_1 = require("./mime-types");
63
67
  const open_browser_1 = require("./open-browser");
64
68
  const parse_browser_error_stack_1 = require("./parse-browser-error-stack");
@@ -75,12 +79,8 @@ const validate_videobitrate_1 = require("./validate-videobitrate");
75
79
  const wait_for_symbolication_error_to_be_done_1 = require("./wait-for-symbolication-error-to-be-done");
76
80
  var handle_javascript_exception_1 = require("./error-handling/handle-javascript-exception");
77
81
  Object.defineProperty(exports, "ErrorWithStackFrame", { enumerable: true, get: function () { return handle_javascript_exception_1.ErrorWithStackFrame; } });
78
- var get_can_extract_frames_fast_1 = require("./get-can-extract-frames-fast");
79
- Object.defineProperty(exports, "getCanExtractFramesFast", { enumerable: true, get: function () { return get_can_extract_frames_fast_1.getCanExtractFramesFast; } });
80
82
  var get_compositions_1 = require("./get-compositions");
81
83
  Object.defineProperty(exports, "getCompositions", { enumerable: true, get: function () { return get_compositions_1.getCompositions; } });
82
- var get_concurrency_2 = require("./get-concurrency");
83
- Object.defineProperty(exports, "getActualConcurrency", { enumerable: true, get: function () { return get_concurrency_2.getActualConcurrency; } });
84
84
  var image_format_2 = require("./image-format");
85
85
  Object.defineProperty(exports, "validateSelectedPixelFormatAndImageFormatCombination", { enumerable: true, get: function () { return image_format_2.validateSelectedPixelFormatAndImageFormatCombination; } });
86
86
  var make_cancel_signal_1 = require("./make-cancel-signal");
@@ -93,6 +93,8 @@ var render_media_1 = require("./render-media");
93
93
  Object.defineProperty(exports, "renderMedia", { enumerable: true, get: function () { return render_media_1.renderMedia; } });
94
94
  var render_still_1 = require("./render-still");
95
95
  Object.defineProperty(exports, "renderStill", { enumerable: true, get: function () { return render_still_1.renderStill; } });
96
+ var select_composition_1 = require("./select-composition");
97
+ Object.defineProperty(exports, "selectComposition", { enumerable: true, get: function () { return select_composition_1.selectComposition; } });
96
98
  var stitch_frames_to_video_1 = require("./stitch-frames-to-video");
97
99
  Object.defineProperty(exports, "stitchFramesToVideo", { enumerable: true, get: function () { return stitch_frames_to_video_1.stitchFramesToVideo; } });
98
100
  var validate_output_filename_1 = require("./validate-output-filename");
@@ -156,11 +158,18 @@ exports.RenderInternals = {
156
158
  defaultCodecsForFileExtension: get_extension_from_codec_1.defaultCodecsForFileExtension,
157
159
  getExecutablePath: get_executable_path_1.getExecutablePath,
158
160
  callFf: call_ffmpeg_1.callFf,
159
- callFfExtraOptions: call_ffmpeg_1.callFfExtraOptions,
161
+ dynamicLibraryPathOptions: call_ffmpeg_1.dynamicLibraryPathOptions,
160
162
  validStillImageFormats: image_format_1.validStillImageFormats,
161
163
  validVideoImageFormats: image_format_1.validVideoImageFormats,
162
164
  DEFAULT_STILL_IMAGE_FORMAT: image_format_1.DEFAULT_STILL_IMAGE_FORMAT,
163
165
  DEFAULT_VIDEO_IMAGE_FORMAT: image_format_1.DEFAULT_VIDEO_IMAGE_FORMAT,
166
+ chalk: chalk_1.chalk,
167
+ Log: logger_1.Log,
168
+ getLogLevel: logger_1.getLogLevel,
169
+ setLogLevel: logger_1.setLogLevel,
170
+ INDENT_TOKEN: logger_1.INDENT_TOKEN,
171
+ isColorSupported: is_color_supported_1.isColorSupported,
172
+ HeadlessBrowser: Browser_1.HeadlessBrowser,
164
173
  };
165
174
  // Warn of potential performance issues with Apple Silicon (M1 chip under Rosetta)
166
175
  (0, check_apple_silicon_1.checkNodeVersionAndWarnAboutRosetta)();
@@ -1,13 +1,16 @@
1
- /// <reference types="node" />
2
1
  import type { OffthreadVideoImageFormat } from 'remotion';
3
2
  import type { DownloadMap, SpecialVCodecForTransparency } from './assets/download-map';
3
+ import type { FfmpegExecutable } from './ffmpeg-executable';
4
4
  export declare type LastFrameOptions = {
5
+ ffmpegExecutable: FfmpegExecutable;
6
+ ffprobeExecutable: FfmpegExecutable;
5
7
  offset: number;
6
8
  src: string;
7
9
  specialVCodecForTransparency: SpecialVCodecForTransparency;
8
10
  imageFormat: OffthreadVideoImageFormat;
9
11
  needsResize: [number, number] | null;
10
12
  downloadMap: DownloadMap;
13
+ remotionRoot: string;
11
14
  };
12
15
  export declare const setLastFrameInCache: (options: LastFrameOptions, data: Buffer) => void;
13
16
  export declare const getLastFrameFromCache: (options: LastFrameOptions) => Buffer | null;
@@ -6,6 +6,7 @@ const MAX_CACHE_SIZE = 50 * 1024 * 1024; // 50MB
6
6
  let bufferSize = 0;
7
7
  const makeLastFrameCacheKey = (options) => {
8
8
  return [
9
+ options.ffmpegExecutable,
9
10
  options.offset,
10
11
  options.src,
11
12
  options.imageFormat,
@@ -0,0 +1,22 @@
1
+ import type { LogLevel } from './log-level';
2
+ export declare const INDENT_TOKEN: string;
3
+ declare type LogOptions = {
4
+ indent: boolean;
5
+ logLevel: LogLevel;
6
+ };
7
+ declare type VerboseLogOptions = LogOptions & {
8
+ tag?: string;
9
+ };
10
+ export declare const verboseTag: (str: string) => string;
11
+ export declare const Log: {
12
+ verbose: (message?: any, ...optionalParams: any[]) => void;
13
+ verboseAdvanced: (options: VerboseLogOptions, message?: any, ...optionalParams: any[]) => void;
14
+ info: (message?: any, ...optionalParams: any[]) => void;
15
+ infoAdvanced: (options: LogOptions, message?: any, ...optionalParams: any[]) => void;
16
+ warn: (message?: any, ...optionalParams: any[]) => void;
17
+ warnAdvanced: (options: LogOptions, message?: any, ...optionalParams: any[]) => void;
18
+ error: (message?: any, ...optionalParams: any[]) => void;
19
+ };
20
+ export declare const getLogLevel: () => "verbose" | "error" | "info" | "warn";
21
+ export declare const setLogLevel: (newLogLevel: LogLevel) => void;
22
+ export {};
package/dist/logger.js ADDED
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setLogLevel = exports.getLogLevel = exports.Log = exports.verboseTag = exports.INDENT_TOKEN = void 0;
4
+ const chalk_1 = require("./chalk");
5
+ const is_color_supported_1 = require("./chalk/is-color-supported");
6
+ const log_level_1 = require("./log-level");
7
+ const truthy_1 = require("./truthy");
8
+ exports.INDENT_TOKEN = chalk_1.chalk.gray('│');
9
+ const verboseTag = (str) => {
10
+ return is_color_supported_1.isColorSupported
11
+ ? chalk_1.chalk.bgBlack(` ${str.toUpperCase()} `)
12
+ : `[${str.toUpperCase()}]`;
13
+ };
14
+ exports.verboseTag = verboseTag;
15
+ exports.Log = {
16
+ verbose: (...args) => {
17
+ exports.Log.verboseAdvanced({ indent: false, logLevel: (0, exports.getLogLevel)() }, ...args);
18
+ },
19
+ verboseAdvanced: (options, ...args) => {
20
+ if ((0, log_level_1.isEqualOrBelowLogLevel)(options.logLevel, 'verbose')) {
21
+ return console.log(...[
22
+ options.indent ? exports.INDENT_TOKEN : null,
23
+ options.tag ? (0, exports.verboseTag)(options.tag) : null,
24
+ ...args.map((a) => chalk_1.chalk.gray(a)),
25
+ ].filter(truthy_1.truthy));
26
+ }
27
+ },
28
+ info: (...args) => {
29
+ exports.Log.infoAdvanced({ indent: false, logLevel: (0, exports.getLogLevel)() }, ...args);
30
+ },
31
+ infoAdvanced: (options, ...args) => {
32
+ if ((0, log_level_1.isEqualOrBelowLogLevel)(options.logLevel, 'info')) {
33
+ return console.log(...[options.indent ? exports.INDENT_TOKEN : null, ...args].filter(truthy_1.truthy));
34
+ }
35
+ },
36
+ warn: (...args) => {
37
+ exports.Log.warnAdvanced({ indent: false, logLevel: (0, exports.getLogLevel)() }, ...args);
38
+ },
39
+ warnAdvanced: (options, ...args) => {
40
+ if ((0, log_level_1.isEqualOrBelowLogLevel)(options.logLevel, 'warn')) {
41
+ return console.warn(...[
42
+ options.indent ? chalk_1.chalk.yellow(exports.INDENT_TOKEN) : null,
43
+ ...args.map((a) => chalk_1.chalk.yellow(a)),
44
+ ].filter(truthy_1.truthy));
45
+ }
46
+ },
47
+ error: (...args) => {
48
+ if ((0, log_level_1.isEqualOrBelowLogLevel)((0, exports.getLogLevel)(), 'error')) {
49
+ return console.error(...args.map((a) => chalk_1.chalk.red(a)));
50
+ }
51
+ },
52
+ };
53
+ let logLevel = 'info';
54
+ const getLogLevel = () => {
55
+ return logLevel;
56
+ };
57
+ exports.getLogLevel = getLogLevel;
58
+ const setLogLevel = (newLogLevel) => {
59
+ logLevel = newLogLevel;
60
+ };
61
+ exports.setLogLevel = setLogLevel;
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.mergeAudioTrack = void 0;
7
- const path_1 = __importDefault(require("path"));
7
+ const node_path_1 = __importDefault(require("node:path"));
8
8
  const call_ffmpeg_1 = require("./call-ffmpeg");
9
9
  const chunk_1 = require("./chunk");
10
10
  const create_ffmpeg_complex_filter_1 = require("./create-ffmpeg-complex-filter");
@@ -29,7 +29,7 @@ const mergeAudioTrackUnlimited = async ({ outName, files, numberOfSeconds, downl
29
29
  const tempPath = (0, tmp_dir_1.tmpDir)('remotion-large-audio-mixing');
30
30
  try {
31
31
  const chunkNames = await Promise.all(chunked.map(async (chunkFiles, i) => {
32
- const chunkOutname = path_1.default.join(tempPath, `chunk-${i}.wav`);
32
+ const chunkOutname = node_path_1.default.join(tempPath, `chunk-${i}.wav`);
33
33
  await (0, exports.mergeAudioTrack)({
34
34
  files: chunkFiles,
35
35
  numberOfSeconds,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.mimeContentType = exports.mimeLookup = exports.getExt = void 0;
4
- const path_1 = require("path");
4
+ const node_path_1 = require("node:path");
5
5
  const mime_db_1 = require("./mime-db");
6
6
  const extensions = {};
7
7
  const types = {};
@@ -17,7 +17,7 @@ function mimeLookup(path) {
17
17
  return false;
18
18
  }
19
19
  // get the extension ("ext" or ".ext" or full path)
20
- const ext = (0, path_1.extname)('.' + path)
20
+ const ext = (0, node_path_1.extname)('.' + path)
21
21
  .toLowerCase()
22
22
  .substr(1);
23
23
  if (!ext) {
@@ -1,15 +1,21 @@
1
- import type { RequestListener } from 'http';
2
- import type { OffthreadVideoImageFormat } from 'remotion';
1
+ import type { RequestListener } from 'node:http';
3
2
  import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
4
3
  import type { DownloadMap } from './assets/download-map';
4
+ import type { Compositor } from './compositor/compositor';
5
5
  export declare const extractUrlAndSourceFromUrl: (url: string) => {
6
6
  src: string;
7
7
  time: number;
8
- imageFormat: OffthreadVideoImageFormat;
8
+ transparent: boolean;
9
9
  };
10
- export declare const startOffthreadVideoServer: ({ onDownload, onError, downloadMap, remotionRoot, }: {
10
+ export declare const startOffthreadVideoServer: ({ onDownload, onError, downloadMap, concurrency, verbose, indent, }: {
11
11
  onDownload: RenderMediaOnDownload;
12
12
  onError: (err: Error) => void;
13
13
  downloadMap: DownloadMap;
14
- remotionRoot: string;
15
- }) => RequestListener;
14
+ concurrency: number;
15
+ verbose: boolean;
16
+ indent: boolean;
17
+ }) => {
18
+ listener: RequestListener;
19
+ close: () => Promise<void>;
20
+ compositor: Compositor;
21
+ };
@@ -1,17 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.startOffthreadVideoServer = exports.extractUrlAndSourceFromUrl = void 0;
4
- const remotion_1 = require("remotion");
5
- const url_1 = require("url");
4
+ const node_url_1 = require("node:url");
6
5
  const download_and_map_assets_to_file_1 = require("./assets/download-and-map-assets-to-file");
7
- const extract_frame_from_video_1 = require("./extract-frame-from-video");
6
+ const compositor_1 = require("./compositor/compositor");
8
7
  const extractUrlAndSourceFromUrl = (url) => {
9
8
  const parsed = new URL(url, 'http://localhost');
10
9
  const query = parsed.search;
11
10
  if (!query.trim()) {
12
11
  throw new Error('Expected query from ' + url);
13
12
  }
14
- const params = new url_1.URLSearchParams(query);
13
+ const params = new node_url_1.URLSearchParams(query);
15
14
  const src = params.get('src');
16
15
  if (!src) {
17
16
  throw new Error('Did not pass `src` parameter');
@@ -20,66 +19,77 @@ const extractUrlAndSourceFromUrl = (url) => {
20
19
  if (!time) {
21
20
  throw new Error('Did not get `time` parameter');
22
21
  }
23
- const imageFormat = params.get('imageFormat');
24
- if (!imageFormat) {
25
- throw new TypeError('Did not get `imageFormat` parameter');
26
- }
27
- remotion_1.Internals.validateOffthreadVideoImageFormat(imageFormat);
22
+ const transparent = params.get('transparent');
28
23
  return {
29
24
  src,
30
25
  time: parseFloat(time),
31
- imageFormat: imageFormat,
26
+ transparent: transparent === 'true',
32
27
  };
33
28
  };
34
29
  exports.extractUrlAndSourceFromUrl = extractUrlAndSourceFromUrl;
35
- const startOffthreadVideoServer = ({ onDownload, onError, downloadMap, remotionRoot, }) => {
36
- return (req, res) => {
37
- if (!req.url) {
38
- throw new Error('Request came in without URL');
39
- }
40
- if (!req.url.startsWith('/proxy')) {
41
- res.writeHead(404);
42
- res.end();
43
- return;
44
- }
45
- const { src, time, imageFormat } = (0, exports.extractUrlAndSourceFromUrl)(req.url);
46
- res.setHeader('access-control-allow-origin', '*');
47
- res.setHeader('content-type', `image/${imageFormat === 'jpeg' ? 'jpg' : 'png'}`);
48
- // Handling this case on Lambda:
49
- // https://support.google.com/chrome/a/answer/7679408?hl=en
50
- // Chrome sends Private Network Access preflights for subresources
51
- if (req.method === 'OPTIONS') {
52
- res.statusCode = 200;
53
- if (req.headers['access-control-request-private-network']) {
54
- res.setHeader('Access-Control-Allow-Private-Network', 'true');
30
+ const startOffthreadVideoServer = ({ onDownload, onError, downloadMap, concurrency, verbose, indent, }) => {
31
+ const compositor = (0, compositor_1.startCompositor)('StartLongRunningProcess', {
32
+ concurrency,
33
+ maximum_frame_cache_items: (0, compositor_1.getIdealMaximumFrameCacheItems)(),
34
+ verbose,
35
+ }, indent);
36
+ return {
37
+ close: () => {
38
+ compositor.finishCommands();
39
+ return compositor.waitForDone();
40
+ },
41
+ listener: (req, res) => {
42
+ if (!req.url) {
43
+ throw new Error('Request came in without URL');
55
44
  }
56
- res.end();
57
- return;
58
- }
59
- (0, download_and_map_assets_to_file_1.downloadAsset)({ src, onDownload, downloadMap })
60
- .then((to) => {
61
- return (0, extract_frame_from_video_1.extractFrameFromVideo)({
62
- time,
63
- src: to,
64
- imageFormat,
65
- downloadMap,
66
- remotionRoot,
67
- });
68
- })
69
- .then((readable) => {
70
- if (!readable) {
71
- throw new Error('no readable from ffmpeg');
45
+ if (!req.url.startsWith('/proxy')) {
46
+ res.writeHead(404);
47
+ res.end();
48
+ return;
49
+ }
50
+ const { src, time, transparent } = (0, exports.extractUrlAndSourceFromUrl)(req.url);
51
+ res.setHeader('access-control-allow-origin', '*');
52
+ if (transparent) {
53
+ res.setHeader('content-type', `image/png`);
72
54
  }
73
- res.writeHead(200);
74
- res.write(readable);
75
- res.end();
76
- })
77
- .catch((err) => {
78
- res.writeHead(500);
79
- res.end();
80
- onError(err);
81
- console.log('Error occurred', err);
82
- });
55
+ else {
56
+ res.setHeader('content-type', `image/bmp`);
57
+ }
58
+ // Handling this case on Lambda:
59
+ // https://support.google.com/chrome/a/answer/7679408?hl=en
60
+ // Chrome sends Private Network Access preflights for subresources
61
+ if (req.method === 'OPTIONS') {
62
+ res.statusCode = 200;
63
+ if (req.headers['access-control-request-private-network']) {
64
+ res.setHeader('Access-Control-Allow-Private-Network', 'true');
65
+ }
66
+ res.end();
67
+ return;
68
+ }
69
+ (0, download_and_map_assets_to_file_1.downloadAsset)({ src, onDownload, downloadMap })
70
+ .then((to) => {
71
+ return compositor.executeCommand('ExtractFrame', {
72
+ input: to,
73
+ time,
74
+ transparent,
75
+ });
76
+ })
77
+ .then((readable) => {
78
+ if (!readable) {
79
+ throw new Error('no readable from ffmpeg');
80
+ }
81
+ res.writeHead(200);
82
+ res.write(readable);
83
+ res.end();
84
+ })
85
+ .catch((err) => {
86
+ res.writeHead(500);
87
+ res.end();
88
+ onError(err);
89
+ console.log('Error occurred', err);
90
+ });
91
+ },
92
+ compositor,
83
93
  };
84
94
  };
85
95
  exports.startOffthreadVideoServer = startOffthreadVideoServer;
@@ -1,5 +1,5 @@
1
1
  import type { Browser } from './browser';
2
- import type { Browser as PuppeteerBrowser } from './browser/Browser';
2
+ import type { HeadlessBrowser } from './browser/Browser';
3
3
  import type { Viewport } from './browser/PuppeteerViewport';
4
4
  declare const validRenderers: readonly ["swangle", "angle", "egl", "swiftshader"];
5
5
  declare type OpenGlRenderer = typeof validRenderers[number];
@@ -21,6 +21,6 @@ export declare const openBrowser: (browser: Browser, options?: {
21
21
  chromiumOptions?: ChromiumOptions;
22
22
  forceDeviceScaleFactor?: number;
23
23
  viewport?: Viewport;
24
- indentationString?: string;
25
- }) => Promise<PuppeteerBrowser>;
24
+ indent?: boolean;
25
+ }) => Promise<HeadlessBrowser>;
26
26
  export {};
@@ -43,7 +43,7 @@ const openBrowser = async (browser, options) => {
43
43
  executablePath,
44
44
  product: browser,
45
45
  dumpio: (_e = options === null || options === void 0 ? void 0 : options.shouldDumpIo) !== null && _e !== void 0 ? _e : false,
46
- indentationString: (_f = options === null || options === void 0 ? void 0 : options.indentationString) !== null && _f !== void 0 ? _f : '',
46
+ indent: (_f = options === null || options === void 0 ? void 0 : options.indent) !== null && _f !== void 0 ? _f : false,
47
47
  args: [
48
48
  'about:blank',
49
49
  '--allow-pre-commit-input',
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  exports.jpegQualityOption = {
6
6
  name: 'JPEG Quality',
7
7
  cliFlag: '--jpeg-quality',
8
- description: ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Sets the quality of the generated JPEG images. Must be an integer between 0 and 100. Default is to leave it up to the browser, current default is 80." })),
8
+ description: ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Sets the quality of the generated JPEG images. Must be an integer between 0 and 100. Default: 80." })),
9
9
  ssrName: 'jpegQuality',
10
10
  docLink: 'https://www.remotion.dev/docs/renderer/render-media#jpeg-quality',
11
11
  };
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  exports.videoCodecOption = {
6
6
  name: 'Codec',
7
7
  cliFlag: '--codec',
8
- description: ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Remotion supports 5 video codecs: h264 (default), h265, vp8, vp9 and prores. While H264 will work well in most cases, sometimes it's worth going for a different codec. Follow the link below for an overview." })),
8
+ description: ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "H264 works well in most cases, sometimes it's worth going for a different codec. WebM achieves higher compression but is slower to render. WebM and ProRes support transparency." })),
9
9
  ssrName: 'codec',
10
10
  docLink: 'https://www.remotion.dev/docs/encoding/#choosing-a-codec',
11
11
  };