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

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 (142) hide show
  1. package/README.md +18 -12
  2. package/dist/assets/get-audio-channels.d.ts +2 -1
  3. package/dist/assets/get-audio-channels.js +9 -5
  4. package/dist/assets/get-video-stream-duration.d.ts +5 -2
  5. package/dist/assets/get-video-stream-duration.js +12 -6
  6. package/dist/audio-codec.d.ts +3 -4
  7. package/dist/audio-codec.js +9 -3
  8. package/dist/browser/BrowserFetcher.d.ts +16 -63
  9. package/dist/browser/BrowserFetcher.js +126 -213
  10. package/dist/browser/BrowserRunner.js +2 -8
  11. package/dist/browser/FrameManager.js +3 -2
  12. package/dist/browser/LaunchOptions.d.ts +0 -1
  13. package/dist/browser/Launcher.js +3 -9
  14. package/dist/browser/PuppeteerNode.d.ts +0 -3
  15. package/dist/browser/PuppeteerNode.js +0 -5
  16. package/dist/browser/create-browser-fetcher.js +34 -48
  17. package/dist/browser/devtools-commands.d.ts +1 -5
  18. package/dist/browser/devtools-types.d.ts +0 -78
  19. package/dist/check-apple-silicon.js +45 -2
  20. package/dist/client.d.ts +5 -29
  21. package/dist/client.js +1 -26
  22. package/dist/codec-supports-media.d.ts +1 -1
  23. package/dist/codec-supports-media.js +1 -1
  24. package/dist/combine-videos.d.ts +3 -0
  25. package/dist/combine-videos.js +9 -5
  26. package/dist/compositor/compose.js +2 -3
  27. package/dist/compositor/get-executable-path.d.ts +1 -1
  28. package/dist/compositor/get-executable-path.js +8 -15
  29. package/dist/create-ffmpeg-complex-filter.d.ts +4 -1
  30. package/dist/create-ffmpeg-complex-filter.js +4 -2
  31. package/dist/create-ffmpeg-merge-filter.d.ts +5 -2
  32. package/dist/create-ffmpeg-merge-filter.js +10 -2
  33. package/dist/create-silent-audio.d.ts +4 -1
  34. package/dist/create-silent-audio.js +7 -3
  35. package/dist/delete-directory.js +16 -16
  36. package/dist/ensure-presentation-timestamp.d.ts +9 -2
  37. package/dist/ensure-presentation-timestamp.js +13 -5
  38. package/dist/extract-frame-from-video.d.ts +3 -0
  39. package/dist/extract-frame-from-video.js +29 -7
  40. package/dist/file-extensions.d.ts +12 -1
  41. package/dist/file-extensions.js +13 -1
  42. package/dist/get-can-extract-frames-fast.d.ts +4 -1
  43. package/dist/get-can-extract-frames-fast.js +12 -1
  44. package/dist/get-compositions.d.ts +5 -2
  45. package/dist/get-compositions.js +11 -6
  46. package/dist/get-frame-of-video-slow.d.ts +4 -1
  47. package/dist/get-frame-of-video-slow.js +11 -3
  48. package/dist/get-frame-padded-index.d.ts +1 -2
  49. package/dist/get-local-browser-executable.js +3 -12
  50. package/dist/get-video-info.d.ts +5 -2
  51. package/dist/get-video-info.js +12 -6
  52. package/dist/guess-extension-for-media.d.ts +3 -1
  53. package/dist/guess-extension-for-media.js +8 -4
  54. package/dist/image-format.d.ts +6 -12
  55. package/dist/image-format.js +13 -16
  56. package/dist/index.d.ts +25 -36
  57. package/dist/index.js +15 -17
  58. package/dist/last-frame-from-video-cache.d.ts +4 -0
  59. package/dist/last-frame-from-video-cache.js +1 -0
  60. package/dist/merge-audio-track.d.ts +2 -0
  61. package/dist/merge-audio-track.js +10 -3
  62. package/dist/offthread-video-server.d.ts +4 -1
  63. package/dist/offthread-video-server.js +3 -1
  64. package/dist/open-browser.d.ts +0 -1
  65. package/dist/open-browser.js +6 -7
  66. package/dist/perf.d.ts +1 -1
  67. package/dist/perf.js +7 -9
  68. package/dist/prepare-server.d.ts +4 -1
  69. package/dist/prepare-server.js +5 -1
  70. package/dist/preprocess-audio-track.d.ts +4 -0
  71. package/dist/preprocess-audio-track.js +8 -4
  72. package/dist/prespawn-ffmpeg.d.ts +9 -6
  73. package/dist/prespawn-ffmpeg.js +12 -7
  74. package/dist/prestitcher-memory-usage.d.ts +4 -0
  75. package/dist/prestitcher-memory-usage.js +3 -2
  76. package/dist/prores-profile.d.ts +2 -1
  77. package/dist/prores-profile.js +4 -4
  78. package/dist/provide-screenshot.d.ts +4 -4
  79. package/dist/provide-screenshot.js +2 -2
  80. package/dist/puppeteer-screenshot.d.ts +2 -3
  81. package/dist/puppeteer-screenshot.js +32 -9
  82. package/dist/render-frames.d.ts +25 -12
  83. package/dist/render-frames.js +40 -27
  84. package/dist/render-media.d.ts +18 -16
  85. package/dist/render-media.js +43 -31
  86. package/dist/render-still.d.ts +8 -9
  87. package/dist/render-still.js +13 -12
  88. package/dist/screenshot-dom-element.d.ts +4 -4
  89. package/dist/screenshot-dom-element.js +3 -6
  90. package/dist/screenshot-task.d.ts +2 -2
  91. package/dist/screenshot-task.js +23 -38
  92. package/dist/serve-handler/index.js +4 -6
  93. package/dist/serve-static.d.ts +3 -0
  94. package/dist/serve-static.js +3 -3
  95. package/dist/stitch-frames-to-video.d.ts +11 -2
  96. package/dist/stitch-frames-to-video.js +33 -24
  97. package/dist/take-frame-and-compose.d.ts +4 -4
  98. package/dist/take-frame-and-compose.js +6 -12
  99. package/dist/tmp-dir.js +2 -1
  100. package/dist/try-to-extract-frame-of-video-fast.d.ts +4 -1
  101. package/dist/try-to-extract-frame-of-video-fast.js +7 -3
  102. package/dist/validate-concurrency.d.ts +0 -2
  103. package/dist/validate-concurrency.js +5 -11
  104. package/dist/validate-puppeteer-timeout.js +0 -1
  105. package/package.json +68 -71
  106. package/dist/browser/is-target-closed-err.d.ts +0 -1
  107. package/dist/browser/is-target-closed-err.js +0 -9
  108. package/dist/call-ffmpeg.d.ts +0 -17
  109. package/dist/call-ffmpeg.js +0 -34
  110. package/dist/compositor/compositor.d.ts +0 -15
  111. package/dist/compositor/compositor.js +0 -193
  112. package/dist/compositor/make-nonce.d.ts +0 -1
  113. package/dist/compositor/make-nonce.js +0 -8
  114. package/dist/jpeg-quality.d.ts +0 -1
  115. package/dist/jpeg-quality.js +0 -21
  116. package/dist/options/audio-bitrate.d.ts +0 -2
  117. package/dist/options/audio-bitrate.js +0 -11
  118. package/dist/options/crf.d.ts +0 -2
  119. package/dist/options/crf.js +0 -11
  120. package/dist/options/enforce-audio.d.ts +0 -2
  121. package/dist/options/enforce-audio.js +0 -11
  122. package/dist/options/jpeg-quality.d.ts +0 -2
  123. package/dist/options/jpeg-quality.js +0 -11
  124. package/dist/options/mute.d.ts +0 -2
  125. package/dist/options/mute.js +0 -11
  126. package/dist/options/option.d.ts +0 -8
  127. package/dist/options/option.js +0 -2
  128. package/dist/options/scale.d.ts +0 -2
  129. package/dist/options/scale.js +0 -11
  130. package/dist/options/video-bitrate.d.ts +0 -2
  131. package/dist/options/video-bitrate.js +0 -11
  132. package/dist/options/video-codec.d.ts +0 -2
  133. package/dist/options/video-codec.js +0 -11
  134. package/ffmpeg/SOURCE.md +0 -1
  135. package/ffmpeg/linux-arm-musl.gz +0 -0
  136. package/ffmpeg/linux-arm.gz +0 -0
  137. package/ffmpeg/linux-x64-musl.gz +0 -0
  138. package/ffmpeg/linux-x64.gz +0 -0
  139. package/ffmpeg/macos-arm.gz +0 -0
  140. package/ffmpeg/macos-x64.gz +0 -0
  141. package/ffmpeg/windows.gz +0 -0
  142. package/install-toolchain.mjs +0 -42
@@ -4,12 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ensurePresentationTimestamps = exports.ensurePresentationTimestampWithoutCache = void 0;
7
+ const execa_1 = __importDefault(require("execa"));
7
8
  const path_1 = __importDefault(require("path"));
8
- const call_ffmpeg_1 = require("./call-ffmpeg");
9
+ const ffmpeg_flags_1 = require("./ffmpeg-flags");
9
10
  const guess_extension_for_media_1 = require("./guess-extension-for-media");
10
11
  const truthy_1 = require("./truthy");
11
12
  let callbacks = [];
12
- const getTemporaryOutputName = async ({ src }) => {
13
+ const getTemporaryOutputName = async ({ src, remotionRoot, ffprobeBinary, }) => {
13
14
  const parts = src.split(path_1.default.sep);
14
15
  // If there is no file extension for the video, then we need to temporarily add an extension
15
16
  const lastPart = parts[parts.length - 1];
@@ -17,6 +18,8 @@ const getTemporaryOutputName = async ({ src }) => {
17
18
  ? null
18
19
  : await (0, guess_extension_for_media_1.guessExtensionForVideo)({
19
20
  src,
21
+ remotionRoot,
22
+ ffprobeBinary,
20
23
  });
21
24
  return parts
22
25
  .map((p, i) => {
@@ -27,12 +30,14 @@ const getTemporaryOutputName = async ({ src }) => {
27
30
  })
28
31
  .join(path_1.default.sep);
29
32
  };
30
- const ensurePresentationTimestampWithoutCache = async ({ src, }) => {
33
+ const ensurePresentationTimestampWithoutCache = async ({ src, remotionRoot, ffmpegExecutable, ffprobeExecutable, }) => {
31
34
  // If there is no file extension for the video, then we need to tempoa
32
35
  const output = await getTemporaryOutputName({
33
36
  src,
37
+ remotionRoot,
38
+ ffprobeBinary: ffprobeExecutable,
34
39
  });
35
- await (0, call_ffmpeg_1.callFf)('ffmpeg', [
40
+ await (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffmpegExecutable, remotionRoot, 'ffmpeg'), [
36
41
  '-i',
37
42
  src,
38
43
  '-fflags',
@@ -47,7 +52,7 @@ const ensurePresentationTimestampWithoutCache = async ({ src, }) => {
47
52
  return output;
48
53
  };
49
54
  exports.ensurePresentationTimestampWithoutCache = ensurePresentationTimestampWithoutCache;
50
- const ensurePresentationTimestamps = async ({ downloadMap, src, }) => {
55
+ const ensurePresentationTimestamps = async ({ downloadMap, src, remotionRoot, ffmpegExecutable, ffprobeExecutable, }) => {
51
56
  const elem = downloadMap.ensureFileHasPresentationTimestamp[src];
52
57
  if ((elem === null || elem === void 0 ? void 0 : elem.type) === 'encoding') {
53
58
  return new Promise((resolve) => {
@@ -62,6 +67,9 @@ const ensurePresentationTimestamps = async ({ downloadMap, src, }) => {
62
67
  }
63
68
  downloadMap.ensureFileHasPresentationTimestamp[src] = { type: 'encoding' };
64
69
  const output = await (0, exports.ensurePresentationTimestampWithoutCache)({
70
+ ffmpegExecutable,
71
+ ffprobeExecutable,
72
+ remotionRoot,
65
73
  src,
66
74
  });
67
75
  callbacks = callbacks.filter((c) => {
@@ -1,11 +1,14 @@
1
1
  /// <reference types="node" />
2
2
  import type { OffthreadVideoImageFormat } from 'remotion';
3
3
  import type { DownloadMap } from './assets/download-map';
4
+ import type { FfmpegExecutable } from './ffmpeg-executable';
4
5
  import type { LastFrameOptions } from './last-frame-from-video-cache';
5
6
  export declare const getLastFrameOfVideo: (options: LastFrameOptions) => Promise<Buffer>;
6
7
  declare type Options = {
7
8
  time: number;
8
9
  src: string;
10
+ ffmpegExecutable: FfmpegExecutable;
11
+ ffprobeExecutable: FfmpegExecutable;
9
12
  imageFormat: OffthreadVideoImageFormat;
10
13
  downloadMap: DownloadMap;
11
14
  remotionRoot: string;
@@ -1,11 +1,15 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.extractFrameFromVideo = exports.getLastFrameOfVideo = void 0;
7
+ const execa_1 = __importDefault(require("execa"));
4
8
  const get_video_stream_duration_1 = require("./assets/get-video-stream-duration");
5
- const call_ffmpeg_1 = require("./call-ffmpeg");
6
9
  const determine_resize_params_1 = require("./determine-resize-params");
7
10
  const determine_vcodec_ffmpeg_flags_1 = require("./determine-vcodec-ffmpeg-flags");
8
11
  const ensure_presentation_timestamp_1 = require("./ensure-presentation-timestamp");
12
+ const ffmpeg_flags_1 = require("./ffmpeg-flags");
9
13
  const frame_to_ffmpeg_timestamp_1 = require("./frame-to-ffmpeg-timestamp");
10
14
  const get_can_extract_frames_fast_1 = require("./get-can-extract-frames-fast");
11
15
  const get_frame_of_video_slow_1 = require("./get-frame-of-video-slow");
@@ -19,12 +23,12 @@ const try_to_extract_frame_of_video_fast_1 = require("./try-to-extract-frame-of-
19
23
  const lastFrameLimit = (0, p_limit_1.pLimit)(1);
20
24
  const mainLimit = (0, p_limit_1.pLimit)(5);
21
25
  const getLastFrameOfVideoFastUnlimited = async (options) => {
22
- const { offset, src, downloadMap } = options;
26
+ const { ffmpegExecutable, ffprobeExecutable, offset, src, downloadMap } = options;
23
27
  const fromCache = (0, last_frame_from_video_cache_1.getLastFrameFromCache)({ ...options, offset: 0 });
24
28
  if (fromCache) {
25
29
  return fromCache;
26
30
  }
27
- const { duration, fps } = await (0, get_video_stream_duration_1.getVideoStreamDuration)(downloadMap, src);
31
+ const { duration, fps } = await (0, get_video_stream_duration_1.getVideoStreamDuration)(downloadMap, src, ffprobeExecutable, options.remotionRoot);
28
32
  if (duration === null) {
29
33
  throw new Error(`Could not determine the duration of ${src} using FFMPEG. The file is not supported.`);
30
34
  }
@@ -32,33 +36,40 @@ const getLastFrameOfVideoFastUnlimited = async (options) => {
32
36
  offset > get_can_extract_frames_fast_1.ACCEPTABLE_OFFSET_THRESHOLD) {
33
37
  const last = await (0, get_frame_of_video_slow_1.getFrameOfVideoSlow)({
34
38
  duration,
39
+ ffmpegExecutable,
35
40
  src,
36
41
  imageFormat: options.imageFormat,
37
42
  specialVCodecForTransparency: options.specialVCodecForTransparency,
38
43
  needsResize: options.needsResize,
39
44
  offset: offset - 1000 / (fps === null ? 10 : fps),
40
45
  fps,
46
+ remotionRoot: options.remotionRoot,
41
47
  });
42
48
  return last;
43
49
  }
44
50
  const actualOffset = `${duration * 1000 - offset}ms`;
45
51
  const [stdErr, stdoutBuffer] = await (0, try_to_extract_frame_of_video_fast_1.tryToExtractFrameOfVideoFast)({
46
52
  actualOffset,
53
+ ffmpegExecutable,
47
54
  imageFormat: options.imageFormat,
48
55
  needsResize: options.needsResize,
56
+ remotionRoot: options.remotionRoot,
49
57
  specialVCodecForTransparency: options.specialVCodecForTransparency,
50
58
  src,
51
59
  });
52
60
  const isEmpty = stdErr.includes('Output file is empty');
53
61
  if (isEmpty) {
54
62
  const unlimited = await getLastFrameOfVideoFastUnlimited({
63
+ ffmpegExecutable,
55
64
  // Decrement in 10ms increments, or 1 frame (e.g. fps = 25 --> 40ms)
56
65
  offset: offset + (fps === null ? 10 : 1000 / fps),
57
66
  src,
67
+ ffprobeExecutable,
58
68
  imageFormat: options.imageFormat,
59
69
  specialVCodecForTransparency: options.specialVCodecForTransparency,
60
70
  needsResize: options.needsResize,
61
71
  downloadMap: options.downloadMap,
72
+ remotionRoot: options.remotionRoot,
62
73
  });
63
74
  return unlimited;
64
75
  }
@@ -70,17 +81,21 @@ const getLastFrameOfVideo = async (options) => {
70
81
  return result;
71
82
  };
72
83
  exports.getLastFrameOfVideo = getLastFrameOfVideo;
73
- const extractFrameFromVideoFn = async ({ time, imageFormat, downloadMap, remotionRoot, ...options }) => {
84
+ const extractFrameFromVideoFn = async ({ time, ffmpegExecutable, ffprobeExecutable, imageFormat, downloadMap, remotionRoot, ...options }) => {
74
85
  // We make a new copy of the video only for video because the conversion may affect
75
86
  // audio rendering, so we work with 2 different files
76
87
  const src = await (0, ensure_presentation_timestamp_1.ensurePresentationTimestamps)({
77
88
  downloadMap,
78
89
  src: options.src,
90
+ remotionRoot,
91
+ ffmpegExecutable,
92
+ ffprobeExecutable,
79
93
  });
80
- const { specialVcodecForTransparency: specialVcodec, needsResize } = await (0, get_video_info_1.getVideoInfo)(downloadMap, src);
94
+ const { specialVcodecForTransparency: specialVcodec, needsResize } = await (0, get_video_info_1.getVideoInfo)(downloadMap, src, ffprobeExecutable, remotionRoot);
81
95
  if (specialVcodec === 'vp8') {
82
- const { fps } = await (0, get_video_stream_duration_1.getVideoStreamDuration)(downloadMap, src);
96
+ const { fps } = await (0, get_video_stream_duration_1.getVideoStreamDuration)(downloadMap, src, ffprobeExecutable, remotionRoot);
83
97
  return (0, get_frame_of_video_slow_1.getFrameOfVideoSlow)({
98
+ ffmpegExecutable,
84
99
  imageFormat,
85
100
  specialVCodecForTransparency: specialVcodec,
86
101
  src,
@@ -88,21 +103,25 @@ const extractFrameFromVideoFn = async ({ time, imageFormat, downloadMap, remotio
88
103
  needsResize,
89
104
  offset: 0,
90
105
  fps,
106
+ remotionRoot,
91
107
  });
92
108
  }
93
109
  if ((0, is_beyond_last_frame_1.isBeyondLastFrame)(downloadMap, src, time)) {
94
110
  const lastFrame = await (0, exports.getLastFrameOfVideo)({
111
+ ffmpegExecutable,
112
+ ffprobeExecutable,
95
113
  offset: 0,
96
114
  src,
97
115
  imageFormat,
98
116
  specialVCodecForTransparency: specialVcodec,
99
117
  needsResize,
100
118
  downloadMap,
119
+ remotionRoot,
101
120
  });
102
121
  return lastFrame;
103
122
  }
104
123
  const ffmpegTimestamp = (0, frame_to_ffmpeg_timestamp_1.frameToFfmpegTimestamp)(time);
105
- const { stdout, stderr } = (0, call_ffmpeg_1.callFf)('ffmpeg', [
124
+ const { stdout, stderr } = (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffmpegExecutable, remotionRoot, 'ffmpeg'), [
106
125
  '-ss',
107
126
  ffmpegTimestamp,
108
127
  ...(0, determine_vcodec_ffmpeg_flags_1.determineVcodecFfmpegFlags)(specialVcodec),
@@ -144,12 +163,15 @@ const extractFrameFromVideoFn = async ({ time, imageFormat, downloadMap, remotio
144
163
  if (stderrStr.includes('Output file is empty')) {
145
164
  (0, is_beyond_last_frame_1.markAsBeyondLastFrame)(downloadMap, src, time);
146
165
  const last = await (0, exports.getLastFrameOfVideo)({
166
+ ffmpegExecutable,
167
+ ffprobeExecutable,
147
168
  offset: 0,
148
169
  src,
149
170
  imageFormat,
150
171
  specialVCodecForTransparency: specialVcodec,
151
172
  needsResize,
152
173
  downloadMap,
174
+ remotionRoot,
153
175
  });
154
176
  return last;
155
177
  }
@@ -1,5 +1,16 @@
1
- import type { supportedAudioCodecs } from './audio-codec';
2
1
  import type { Codec } from './codec';
2
+ export declare const supportedAudioCodecs: {
3
+ readonly h264: readonly ["aac", "pcm-16"];
4
+ readonly 'h264-mkv': readonly ["pcm-16"];
5
+ readonly aac: readonly ["aac", "pcm-16"];
6
+ readonly gif: readonly [];
7
+ readonly h265: readonly ["aac", "pcm-16"];
8
+ readonly mp3: readonly ["mp3", "pcm-16"];
9
+ readonly prores: readonly ["pcm-16", "aac"];
10
+ readonly vp8: readonly ["opus", "pcm-16"];
11
+ readonly vp9: readonly ["opus", "pcm-16"];
12
+ readonly wav: readonly ["pcm-16"];
13
+ };
3
14
  export declare type FileExtension = 'aac' | '3gp' | 'm4a' | 'm4b' | 'mpg' | 'mpeg' | 'mkv' | 'mp4' | 'gif' | 'hevc' | 'mp3' | 'mov' | 'mxf' | 'wav' | 'webm';
4
15
  export declare const defaultFileExtensionMap: {
5
16
  [key in Codec]: {
@@ -1,6 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultFileExtensionMap = void 0;
3
+ exports.defaultFileExtensionMap = exports.supportedAudioCodecs = void 0;
4
+ exports.supportedAudioCodecs = {
5
+ h264: ['aac', 'pcm-16'],
6
+ 'h264-mkv': ['pcm-16'],
7
+ aac: ['aac', 'pcm-16'],
8
+ gif: [],
9
+ h265: ['aac', 'pcm-16'],
10
+ mp3: ['mp3', 'pcm-16'],
11
+ prores: ['pcm-16', 'aac'],
12
+ vp8: ['opus', 'pcm-16'],
13
+ vp9: ['opus', 'pcm-16'],
14
+ wav: ['pcm-16'],
15
+ };
4
16
  exports.defaultFileExtensionMap = {
5
17
  'h264-mkv': {
6
18
  default: 'mkv',
@@ -1,10 +1,13 @@
1
+ import type { FfmpegExecutable } from './ffmpeg-executable';
1
2
  export declare const ACCEPTABLE_OFFSET_THRESHOLD = 50;
2
3
  /**
3
4
  * @description Probes whether frames of a video can be efficiently extracted when using <OffthreadVideo>.
4
5
  * @see [Documentation](https://www.remotion.dev/docs/renderer/get-can-extract-frames-fast)
5
6
  */
6
- export declare const getCanExtractFramesFast: ({ src, }: {
7
+ export declare const getCanExtractFramesFast: ({ src, ffmpegExecutable, ffprobeExecutable, }: {
7
8
  src: string;
9
+ ffmpegExecutable?: FfmpegExecutable | undefined;
10
+ ffprobeExecutable?: FfmpegExecutable | undefined;
8
11
  }) => Promise<{
9
12
  canExtractFramesFast: boolean;
10
13
  shouldReencode: boolean;
@@ -7,6 +7,7 @@ exports.getCanExtractFramesFast = exports.ACCEPTABLE_OFFSET_THRESHOLD = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const get_video_stream_duration_1 = require("./assets/get-video-stream-duration");
9
9
  const ensure_presentation_timestamp_1 = require("./ensure-presentation-timestamp");
10
+ const find_closest_package_json_1 = require("./find-closest-package-json");
10
11
  const get_video_info_1 = require("./get-video-info");
11
12
  const try_to_extract_frame_of_video_fast_1 = require("./try-to-extract-frame-of-video-fast");
12
13
  exports.ACCEPTABLE_OFFSET_THRESHOLD = 50;
@@ -14,12 +15,18 @@ exports.ACCEPTABLE_OFFSET_THRESHOLD = 50;
14
15
  * @description Probes whether frames of a video can be efficiently extracted when using <OffthreadVideo>.
15
16
  * @see [Documentation](https://www.remotion.dev/docs/renderer/get-can-extract-frames-fast)
16
17
  */
17
- const getCanExtractFramesFast = async ({ src, }) => {
18
+ const getCanExtractFramesFast = async ({ src, ffmpegExecutable, ffprobeExecutable, }) => {
19
+ const remotionRoot = (0, find_closest_package_json_1.findRemotionRoot)();
18
20
  const out = await (0, ensure_presentation_timestamp_1.ensurePresentationTimestampWithoutCache)({
21
+ ffmpegExecutable: ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : null,
22
+ ffprobeExecutable: ffprobeExecutable !== null && ffprobeExecutable !== void 0 ? ffprobeExecutable : null,
23
+ remotionRoot,
19
24
  src,
20
25
  });
21
26
  const { specialVcodecForTransparency: specialVcodec } = await (0, get_video_info_1.getVideoInfoUncached)({
22
27
  src: out,
28
+ ffprobeExecutable: ffprobeExecutable !== null && ffprobeExecutable !== void 0 ? ffprobeExecutable : null,
29
+ remotionRoot,
23
30
  });
24
31
  if (specialVcodec === 'vp8') {
25
32
  fs_1.default.unlinkSync(out);
@@ -29,6 +36,8 @@ const getCanExtractFramesFast = async ({ src, }) => {
29
36
  };
30
37
  }
31
38
  const { duration } = await (0, get_video_stream_duration_1.getVideoStreamDurationwithoutCache)({
39
+ ffprobeExecutable: ffprobeExecutable !== null && ffprobeExecutable !== void 0 ? ffprobeExecutable : null,
40
+ remotionRoot,
32
41
  src: out,
33
42
  });
34
43
  if (duration === null) {
@@ -38,9 +47,11 @@ const getCanExtractFramesFast = async ({ src, }) => {
38
47
  const actualOffset = `${duration * 1000 - exports.ACCEPTABLE_OFFSET_THRESHOLD}ms`;
39
48
  const [stdErr] = await (0, try_to_extract_frame_of_video_fast_1.tryToExtractFrameOfVideoFast)({
40
49
  actualOffset,
50
+ ffmpegExecutable: ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : null,
41
51
  imageFormat: 'jpeg',
42
52
  // Intentionally leaving needsResize as null, because we don't need to resize
43
53
  needsResize: null,
54
+ remotionRoot,
44
55
  specialVCodecForTransparency: specialVcodec,
45
56
  src: out,
46
57
  });
@@ -1,8 +1,9 @@
1
- import type { AnyCompMetadata } from 'remotion';
1
+ import type { TCompMetadata } from 'remotion';
2
2
  import type { DownloadMap } from './assets/download-map';
3
3
  import type { BrowserExecutable } from './browser-executable';
4
4
  import type { BrowserLog } from './browser-log';
5
5
  import type { Browser } from './browser/Browser';
6
+ import type { FfmpegExecutable } from './ffmpeg-executable';
6
7
  import type { ChromiumOptions } from './open-browser';
7
8
  declare type GetCompositionsConfig = {
8
9
  inputProps?: object | null;
@@ -12,6 +13,8 @@ declare type GetCompositionsConfig = {
12
13
  browserExecutable?: BrowserExecutable;
13
14
  timeoutInMilliseconds?: number;
14
15
  chromiumOptions?: ChromiumOptions;
16
+ ffmpegExecutable?: FfmpegExecutable;
17
+ ffprobeExecutable?: FfmpegExecutable;
15
18
  port?: number | null;
16
19
  /**
17
20
  * @deprecated Only for Remotion internal usage
@@ -22,5 +25,5 @@ declare type GetCompositionsConfig = {
22
25
  * @description Gets the compositions defined in a Remotion project based on a Webpack bundle.
23
26
  * @see [Documentation](https://www.remotion.dev/docs/renderer/get-compositions)
24
27
  */
25
- export declare const getCompositions: (serveUrlOrWebpackUrl: string, config?: GetCompositionsConfig) => Promise<AnyCompMetadata[]>;
28
+ export declare const getCompositions: (serveUrlOrWebpackUrl: string, config?: GetCompositionsConfig) => Promise<TCompMetadata[]>;
26
29
  export {};
@@ -9,6 +9,7 @@ const prepare_server_1 = require("./prepare-server");
9
9
  const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
10
10
  const seek_to_frame_1 = require("./seek-to-frame");
11
11
  const set_props_and_env_1 = require("./set-props-and-env");
12
+ const validate_ffmpeg_1 = require("./validate-ffmpeg");
12
13
  const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
13
14
  const innerGetCompositions = async (serveUrl, page, config, proxyPort) => {
14
15
  if (config === null || config === void 0 ? void 0 : config.onBrowserLog) {
@@ -60,15 +61,17 @@ const innerGetCompositions = async (serveUrl, page, config, proxyPort) => {
60
61
  * @see [Documentation](https://www.remotion.dev/docs/renderer/get-compositions)
61
62
  */
62
63
  const getCompositions = async (serveUrlOrWebpackUrl, config) => {
63
- var _a, _b, _c;
64
- const downloadMap = (_a = config === null || config === void 0 ? void 0 : config.downloadMap) !== null && _a !== void 0 ? _a : (0, download_map_1.makeDownloadMap)();
64
+ var _a, _b, _c, _d, _e;
65
+ await (0, validate_ffmpeg_1.validateFfmpeg)((_a = config === null || config === void 0 ? void 0 : config.ffmpegExecutable) !== null && _a !== void 0 ? _a : null, (0, find_closest_package_json_1.findRemotionRoot)(), 'ffmpeg');
66
+ await (0, validate_ffmpeg_1.validateFfmpeg)((_b = config === null || config === void 0 ? void 0 : config.ffprobeExecutable) !== null && _b !== void 0 ? _b : null, (0, find_closest_package_json_1.findRemotionRoot)(), 'ffprobe');
67
+ const downloadMap = (_c = config === null || config === void 0 ? void 0 : config.downloadMap) !== null && _c !== void 0 ? _c : (0, download_map_1.makeDownloadMap)();
65
68
  const { page, cleanup } = await (0, get_browser_instance_1.getPageAndCleanupFn)({
66
69
  passedInInstance: config === null || config === void 0 ? void 0 : config.puppeteerInstance,
67
- browserExecutable: (_b = config === null || config === void 0 ? void 0 : config.browserExecutable) !== null && _b !== void 0 ? _b : null,
68
- chromiumOptions: (_c = config === null || config === void 0 ? void 0 : config.chromiumOptions) !== null && _c !== void 0 ? _c : {},
70
+ browserExecutable: (_d = config === null || config === void 0 ? void 0 : config.browserExecutable) !== null && _d !== void 0 ? _d : null,
71
+ chromiumOptions: (_e = config === null || config === void 0 ? void 0 : config.chromiumOptions) !== null && _e !== void 0 ? _e : {},
69
72
  });
70
73
  return new Promise((resolve, reject) => {
71
- var _a;
74
+ var _a, _b, _c;
72
75
  const onError = (err) => reject(err);
73
76
  const cleanupPageError = (0, handle_javascript_exception_1.handleJavascriptException)({
74
77
  page,
@@ -80,7 +83,9 @@ const getCompositions = async (serveUrlOrWebpackUrl, config) => {
80
83
  webpackConfigOrServeUrl: serveUrlOrWebpackUrl,
81
84
  onDownload: () => undefined,
82
85
  onError,
83
- port: (_a = config === null || config === void 0 ? void 0 : config.port) !== null && _a !== void 0 ? _a : null,
86
+ ffmpegExecutable: (_a = config === null || config === void 0 ? void 0 : config.ffmpegExecutable) !== null && _a !== void 0 ? _a : null,
87
+ ffprobeExecutable: (_b = config === null || config === void 0 ? void 0 : config.ffprobeExecutable) !== null && _b !== void 0 ? _b : null,
88
+ port: (_c = config === null || config === void 0 ? void 0 : config.port) !== null && _c !== void 0 ? _c : null,
84
89
  downloadMap,
85
90
  remotionRoot: (0, find_closest_package_json_1.findRemotionRoot)(),
86
91
  })
@@ -1,7 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  import type { OffthreadVideoImageFormat } from 'remotion';
3
3
  import type { SpecialVCodecForTransparency } from './assets/download-map';
4
- export declare const getFrameOfVideoSlow: ({ src, duration, imageFormat, specialVCodecForTransparency, needsResize, offset, fps, }: {
4
+ import type { FfmpegExecutable } from './ffmpeg-executable';
5
+ export declare const getFrameOfVideoSlow: ({ src, duration, ffmpegExecutable, imageFormat, specialVCodecForTransparency, needsResize, offset, fps, remotionRoot, }: {
6
+ ffmpegExecutable: FfmpegExecutable;
5
7
  src: string;
6
8
  duration: number;
7
9
  imageFormat: OffthreadVideoImageFormat;
@@ -9,4 +11,5 @@ export declare const getFrameOfVideoSlow: ({ src, duration, imageFormat, special
9
11
  needsResize: [number, number] | null;
10
12
  offset: number;
11
13
  fps: number | null;
14
+ remotionRoot: string;
12
15
  }) => Promise<Buffer>;
@@ -1,11 +1,17 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.getFrameOfVideoSlow = void 0;
4
- const call_ffmpeg_1 = require("./call-ffmpeg");
7
+ // Uses no seeking, therefore the whole video has to be decoded. This is a last resort and should only happen
8
+ // if the video is corrupted
9
+ const execa_1 = __importDefault(require("execa"));
5
10
  const determine_resize_params_1 = require("./determine-resize-params");
6
11
  const determine_vcodec_ffmpeg_flags_1 = require("./determine-vcodec-ffmpeg-flags");
12
+ const ffmpeg_flags_1 = require("./ffmpeg-flags");
7
13
  const truthy_1 = require("./truthy");
8
- const getFrameOfVideoSlow = async ({ src, duration, imageFormat, specialVCodecForTransparency, needsResize, offset, fps, }) => {
14
+ const getFrameOfVideoSlow = async ({ src, duration, ffmpegExecutable, imageFormat, specialVCodecForTransparency, needsResize, offset, fps, remotionRoot, }) => {
9
15
  console.warn(`\nUsing a slow method to extract the frame at ${duration}ms of ${src}. See https://remotion.dev/docs/slow-method-to-extract-frame for advice`);
10
16
  const actualOffset = `-${duration * 1000 - offset}ms`;
11
17
  const command = [
@@ -23,7 +29,7 @@ const getFrameOfVideoSlow = async ({ src, duration, imageFormat, specialVCodecFo
23
29
  ...(0, determine_resize_params_1.determineResizeParams)(needsResize),
24
30
  '-',
25
31
  ].filter(truthy_1.truthy);
26
- const { stdout, stderr } = (0, call_ffmpeg_1.callFf)('ffmpeg', command);
32
+ const { stdout, stderr } = (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffmpegExecutable, remotionRoot, 'ffmpeg'), command);
27
33
  if (!stderr) {
28
34
  throw new Error('unexpectedly did not get stderr');
29
35
  }
@@ -49,6 +55,7 @@ const getFrameOfVideoSlow = async ({ src, duration, imageFormat, specialVCodecFo
49
55
  throw new Error(`Could not get last frame of ${src}. Tried to seek to the end using the command "ffmpeg ${command.join(' ')}" but got no frame. Most likely this video is corrupted.`);
50
56
  }
51
57
  return (0, exports.getFrameOfVideoSlow)({
58
+ ffmpegExecutable,
52
59
  duration,
53
60
  // Decrement in 10ms increments, or 1 frame (e.g. fps = 25 --> 40ms)
54
61
  offset: offset + (fps === null ? 10 : 1000 / fps),
@@ -57,6 +64,7 @@ const getFrameOfVideoSlow = async ({ src, duration, imageFormat, specialVCodecFo
57
64
  specialVCodecForTransparency,
58
65
  needsResize,
59
66
  fps,
67
+ remotionRoot,
60
68
  });
61
69
  }
62
70
  return stdoutBuffer;
@@ -1,9 +1,8 @@
1
- import type { VideoImageFormat } from './image-format';
2
1
  export declare type CountType = 'from-zero' | 'actual-frames';
3
2
  export declare const getFrameOutputFileName: ({ index, frame, imageFormat, countType, lastFrame, totalFrames, }: {
4
3
  index: number;
5
4
  frame: number;
6
- imageFormat: VideoImageFormat;
5
+ imageFormat: 'png' | 'jpeg' | 'none';
7
6
  countType: CountType;
8
7
  lastFrame: number;
9
8
  totalFrames: number;
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getLocalBrowserExecutable = exports.ensureLocalBrowser = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
+ const BrowserFetcher_1 = require("./browser/BrowserFetcher");
8
9
  const create_browser_fetcher_1 = require("./browser/create-browser-fetcher");
9
- const node_1 = require("./browser/node");
10
10
  const revisions_1 = require("./browser/revisions");
11
11
  const getSearchPathsForProduct = (product) => {
12
12
  var _a;
@@ -44,15 +44,6 @@ const getLocalBrowser = (product) => {
44
44
  }
45
45
  return null;
46
46
  };
47
- const getBrowserRevision = (product) => {
48
- const browserFetcher = node_1.puppeteer.createBrowserFetcher({
49
- product,
50
- path: null,
51
- platform: null,
52
- });
53
- const revisionInfo = browserFetcher.revisionInfo(revisions_1.PUPPETEER_REVISIONS.chromium);
54
- return revisionInfo;
55
- };
56
47
  const getBrowserStatus = (product, browserExecutablePath) => {
57
48
  if (browserExecutablePath) {
58
49
  if (!fs_1.default.existsSync(browserExecutablePath)) {
@@ -64,8 +55,8 @@ const getBrowserStatus = (product, browserExecutablePath) => {
64
55
  if (localBrowser !== null) {
65
56
  return { path: localBrowser, type: 'local-browser' };
66
57
  }
67
- const revision = getBrowserRevision(product);
68
- if (revision.local !== null && fs_1.default.existsSync(revision.executablePath)) {
58
+ const revision = (0, BrowserFetcher_1.getRevisionInfo)(revisions_1.PUPPETEER_REVISIONS.chromium, product);
59
+ if (revision.local && fs_1.default.existsSync(revision.executablePath)) {
69
60
  return { path: revision.executablePath, type: 'local-puppeteer-browser' };
70
61
  }
71
62
  return { type: 'no-browser' };
@@ -1,5 +1,8 @@
1
1
  import type { DownloadMap, Vp9Result } from './assets/download-map';
2
- export declare function getVideoInfoUncached({ src, }: {
2
+ import type { FfmpegExecutable } from './ffmpeg-executable';
3
+ export declare function getVideoInfoUncached({ src, ffprobeExecutable, remotionRoot, }: {
3
4
  src: string;
5
+ ffprobeExecutable: FfmpegExecutable;
6
+ remotionRoot: string;
4
7
  }): Promise<Vp9Result>;
5
- export declare const getVideoInfo: (downloadMap: DownloadMap, src: string) => Promise<Vp9Result>;
8
+ export declare const getVideoInfo: (downloadMap: DownloadMap, src: string, ffprobeExecutable: FfmpegExecutable, remotionRoot: string) => Promise<Vp9Result>;
@@ -1,13 +1,17 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.getVideoInfo = exports.getVideoInfoUncached = void 0;
7
+ const execa_1 = __importDefault(require("execa"));
4
8
  const calculate_sar_dar_pixels_1 = require("./calculate-sar-dar-pixels");
5
- const call_ffmpeg_1 = require("./call-ffmpeg");
9
+ const ffmpeg_flags_1 = require("./ffmpeg-flags");
6
10
  const p_limit_1 = require("./p-limit");
7
11
  const limit = (0, p_limit_1.pLimit)(1);
8
- async function getVideoInfoUncached({ src, }) {
12
+ async function getVideoInfoUncached({ src, ffprobeExecutable, remotionRoot, }) {
9
13
  var _a;
10
- const task = await (0, call_ffmpeg_1.callFf)('ffprobe', [src]);
14
+ const task = await (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffprobeExecutable, remotionRoot, 'ffprobe'), [src]);
11
15
  const isVp9 = task.stderr.includes('Video: vp9');
12
16
  const isVp8 = task.stderr.includes('Video: vp8');
13
17
  const dimensions = (_a = task.stderr
@@ -37,17 +41,19 @@ async function getVideoInfoUncached({ src, }) {
37
41
  return result;
38
42
  }
39
43
  exports.getVideoInfoUncached = getVideoInfoUncached;
40
- async function getVideoInfoUnlimited(downloadMap, src) {
44
+ async function getVideoInfoUnlimited(downloadMap, src, ffprobeExecutable, remotionRoot) {
41
45
  if (typeof downloadMap.isVp9VideoCache[src] !== 'undefined') {
42
46
  return downloadMap.isVp9VideoCache[src];
43
47
  }
44
48
  const result = await getVideoInfoUncached({
49
+ ffprobeExecutable,
50
+ remotionRoot,
45
51
  src,
46
52
  });
47
53
  downloadMap.isVp9VideoCache[src] = result;
48
54
  return downloadMap.isVp9VideoCache[src];
49
55
  }
50
- const getVideoInfo = (downloadMap, src) => {
51
- return limit(() => getVideoInfoUnlimited(downloadMap, src));
56
+ const getVideoInfo = (downloadMap, src, ffprobeExecutable, remotionRoot) => {
57
+ return limit(() => getVideoInfoUnlimited(downloadMap, src, ffprobeExecutable, remotionRoot));
52
58
  };
53
59
  exports.getVideoInfo = getVideoInfo;
@@ -1,3 +1,5 @@
1
- export declare const guessExtensionForVideo: ({ src }: {
1
+ export declare const guessExtensionForVideo: ({ src, remotionRoot, ffprobeBinary, }: {
2
2
  src: string;
3
+ remotionRoot: string;
4
+ ffprobeBinary: string | null;
3
5
  }) => Promise<"mp3" | "wav" | "mp4" | "webm">;
@@ -1,10 +1,14 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.guessExtensionForVideo = void 0;
4
- const call_ffmpeg_1 = require("./call-ffmpeg");
5
- const guessExtensionForVideo = async ({ src }) => {
6
- const { stderr } = await (0, call_ffmpeg_1.callFf)('ffprobe', [src]);
7
- if (stderr.includes('Audio: mp3,')) {
7
+ const execa_1 = __importDefault(require("execa"));
8
+ const ffmpeg_flags_1 = require("./ffmpeg-flags");
9
+ const guessExtensionForVideo = async ({ src, remotionRoot, ffprobeBinary, }) => {
10
+ const { stderr } = await (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffprobeBinary, remotionRoot, 'ffprobe'), [src]);
11
+ if (stderr.includes('mp3,')) {
8
12
  return 'mp3';
9
13
  }
10
14
  if (stderr.includes('Video: vp9')) {
@@ -1,13 +1,7 @@
1
1
  import type { PixelFormat } from './pixel-format';
2
- export declare const validVideoImageFormats: readonly ["png", "jpeg", "none"];
3
- export declare const validStillImageFormats: readonly ["png", "jpeg", "pdf", "webp"];
4
- export declare type VideoImageFormat = typeof validVideoImageFormats[number];
5
- export declare type StillImageFormat = typeof validStillImageFormats[number];
6
- /**
7
- * @deprecated Use VideoImageFormat or StillImageFormat instead
8
- */
9
- export declare type ImageFormat = 'This type is deprecated, use VideoImageFormat or StillImageFormat instead';
10
- export declare const DEFAULT_VIDEO_IMAGE_FORMAT: VideoImageFormat;
11
- export declare const DEFAULT_STILL_IMAGE_FORMAT: StillImageFormat;
12
- export declare const validateSelectedPixelFormatAndImageFormatCombination: (pixelFormat: PixelFormat | undefined, videoImageFormat: VideoImageFormat) => 'none' | 'valid';
13
- export declare const validateStillImageFormat: (imageFormat: StillImageFormat) => void;
2
+ export declare const validImageFormats: readonly ["png", "jpeg", "none"];
3
+ export declare type ImageFormat = typeof validImageFormats[number];
4
+ export declare type StillImageFormat = 'png' | 'jpeg';
5
+ export declare const DEFAULT_IMAGE_FORMAT: ImageFormat;
6
+ export declare const validateSelectedPixelFormatAndImageFormatCombination: (pixelFormat: PixelFormat | undefined, imageFormat: ImageFormat) => 'none' | 'valid';
7
+ export declare const validateNonNullImageFormat: (imageFormat: ImageFormat) => void;