@remotion/renderer 4.0.533 → 4.0.535

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 (285) hide show
  1. package/dist/aac-priming.js +6 -2
  2. package/dist/browser/BrowserFetcher.d.ts +7 -1
  3. package/dist/browser/BrowserFetcher.js +33 -13
  4. package/dist/browser/BrowserPage.js +4 -0
  5. package/dist/browser/Connection.js +5 -17
  6. package/dist/browser/DOMWorld.js +19 -13
  7. package/dist/browser/devtools-commands.d.ts +13 -1
  8. package/dist/browser/devtools-types.d.ts +62 -0
  9. package/dist/browser/get-chrome-download-url.d.ts +1 -1
  10. package/dist/browser/get-chrome-download-url.js +19 -33
  11. package/dist/can-use-parallel-encoding.d.ts +0 -1
  12. package/dist/can-use-parallel-encoding.js +10 -10
  13. package/dist/client.d.ts +402 -4
  14. package/dist/client.js +2 -0
  15. package/dist/combine-chunks.d.ts +2 -1
  16. package/dist/combine-chunks.js +81 -52
  17. package/dist/combine-video-streams.js +3 -0
  18. package/dist/compositor/get-executable-path.js +30 -15
  19. package/dist/cycle-browser-tabs.js +9 -1
  20. package/dist/ensure-browser.d.ts +3 -0
  21. package/dist/ensure-browser.js +30 -6
  22. package/dist/esm/client.mjs +1325 -954
  23. package/dist/esm/index.mjs +4465 -3324
  24. package/dist/esm/pure.mjs +36 -10
  25. package/dist/file-extensions.js +4 -1
  26. package/dist/get-mp4-brand.d.ts +1 -0
  27. package/dist/get-mp4-brand.js +21 -0
  28. package/dist/get-video-threads-flag.js +5 -1
  29. package/dist/image-format.d.ts +1 -0
  30. package/dist/image-format.js +8 -4
  31. package/dist/index.d.ts +58 -2
  32. package/dist/index.js +4 -0
  33. package/dist/memory/from-macos-sysctl.d.ts +1 -0
  34. package/dist/memory/from-macos-sysctl.js +50 -0
  35. package/dist/memory/from-proc-meminfo.d.ts +1 -1
  36. package/dist/memory/from-proc-meminfo.js +7 -4
  37. package/dist/memory/get-available-memory.js +29 -21
  38. package/dist/mux-video-and-audio.js +11 -2
  39. package/dist/next-frame-to-render.d.ts +3 -7
  40. package/dist/next-frame-to-render.js +3 -22
  41. package/dist/open-browser.js +1 -0
  42. package/dist/options/allow-html-in-canvas.d.ts +1 -0
  43. package/dist/options/allow-html-in-canvas.js +2 -1
  44. package/dist/options/api-key.d.ts +1 -0
  45. package/dist/options/api-key.js +2 -1
  46. package/dist/options/ask-ai.d.ts +1 -0
  47. package/dist/options/ask-ai.js +2 -1
  48. package/dist/options/audio-bitrate.d.ts +1 -0
  49. package/dist/options/audio-bitrate.js +2 -1
  50. package/dist/options/audio-codec.d.ts +1 -0
  51. package/dist/options/audio-codec.js +13 -6
  52. package/dist/options/beep-on-finish.d.ts +1 -0
  53. package/dist/options/beep-on-finish.js +2 -1
  54. package/dist/options/benchmark-concurrencies.d.ts +1 -0
  55. package/dist/options/benchmark-concurrencies.js +2 -1
  56. package/dist/options/binaries-directory.d.ts +1 -0
  57. package/dist/options/binaries-directory.js +2 -1
  58. package/dist/options/browser-executable.d.ts +1 -0
  59. package/dist/options/browser-executable.js +2 -1
  60. package/dist/options/browser.d.ts +1 -0
  61. package/dist/options/browser.js +2 -1
  62. package/dist/options/bundle-cache.d.ts +1 -0
  63. package/dist/options/bundle-cache.js +2 -1
  64. package/dist/options/canvas-tabs.d.ts +1 -0
  65. package/dist/options/canvas-tabs.js +2 -1
  66. package/dist/options/chrome-mode.d.ts +1 -0
  67. package/dist/options/chrome-mode.js +2 -1
  68. package/dist/options/color-space.d.ts +1 -0
  69. package/dist/options/color-space.js +2 -1
  70. package/dist/options/concurrency.d.ts +1 -0
  71. package/dist/options/concurrency.js +2 -1
  72. package/dist/options/config.d.ts +1 -0
  73. package/dist/options/config.js +2 -1
  74. package/dist/options/crf.d.ts +1 -0
  75. package/dist/options/crf.js +2 -1
  76. package/dist/options/cross-site-isolation.d.ts +1 -0
  77. package/dist/options/cross-site-isolation.js +2 -1
  78. package/dist/options/dark-mode.d.ts +1 -0
  79. package/dist/options/dark-mode.js +2 -1
  80. package/dist/options/default-coding-agent.d.ts +1 -0
  81. package/dist/options/default-coding-agent.js +2 -1
  82. package/dist/options/default-editor.d.ts +1 -0
  83. package/dist/options/default-editor.js +2 -1
  84. package/dist/options/default-premount-in-seconds.d.ts +19 -0
  85. package/dist/options/default-premount-in-seconds.js +36 -0
  86. package/dist/options/delete-after.d.ts +1 -0
  87. package/dist/options/delete-after.js +2 -1
  88. package/dist/options/disable-git-source.d.ts +1 -0
  89. package/dist/options/disable-git-source.js +2 -1
  90. package/dist/options/disable-shared-memory-capture.d.ts +17 -0
  91. package/dist/options/disable-shared-memory-capture.js +30 -0
  92. package/dist/options/disable-web-security.d.ts +1 -0
  93. package/dist/options/disable-web-security.js +2 -1
  94. package/dist/options/disallow-parallel-encoding.d.ts +1 -0
  95. package/dist/options/disallow-parallel-encoding.js +2 -1
  96. package/dist/options/enable-cancellation.d.ts +1 -0
  97. package/dist/options/enable-cancellation.js +2 -1
  98. package/dist/options/enable-lambda-insights.d.ts +1 -0
  99. package/dist/options/enable-lambda-insights.js +2 -1
  100. package/dist/options/enable-multiprocess-on-linux.d.ts +1 -0
  101. package/dist/options/enable-multiprocess-on-linux.js +2 -1
  102. package/dist/options/encoding-buffer-size.d.ts +1 -0
  103. package/dist/options/encoding-buffer-size.js +2 -1
  104. package/dist/options/encoding-max-rate.d.ts +1 -0
  105. package/dist/options/encoding-max-rate.js +2 -1
  106. package/dist/options/enforce-audio.d.ts +1 -0
  107. package/dist/options/enforce-audio.js +2 -1
  108. package/dist/options/env-file.d.ts +1 -0
  109. package/dist/options/env-file.js +2 -1
  110. package/dist/options/every-nth-frame.d.ts +1 -0
  111. package/dist/options/every-nth-frame.js +2 -1
  112. package/dist/options/experimental-keep-audio-context-alive.d.ts +1 -0
  113. package/dist/options/experimental-keep-audio-context-alive.js +2 -1
  114. package/dist/options/experimental-sequence-activity-limit.d.ts +19 -0
  115. package/dist/options/experimental-sequence-activity-limit.js +40 -0
  116. package/dist/options/experimental-sequence-activity.d.ts +19 -0
  117. package/dist/options/experimental-sequence-activity.js +38 -0
  118. package/dist/options/experimental-tracks.d.ts +19 -0
  119. package/dist/options/experimental-tracks.js +43 -0
  120. package/dist/options/folder-expiry.d.ts +1 -0
  121. package/dist/options/folder-expiry.js +2 -1
  122. package/dist/options/for-seamless-aac-concatenation.d.ts +1 -0
  123. package/dist/options/for-seamless-aac-concatenation.js +2 -1
  124. package/dist/options/force-new-studio.d.ts +1 -0
  125. package/dist/options/force-new-studio.js +2 -1
  126. package/dist/options/frames.d.ts +1 -0
  127. package/dist/options/frames.js +2 -1
  128. package/dist/options/gl.d.ts +1 -0
  129. package/dist/options/gl.js +2 -1
  130. package/dist/options/gop-size.d.ts +1 -0
  131. package/dist/options/gop-size.js +2 -1
  132. package/dist/options/hardware-acceleration.d.ts +1 -0
  133. package/dist/options/hardware-acceleration.js +2 -1
  134. package/dist/options/headless.d.ts +1 -0
  135. package/dist/options/headless.js +2 -1
  136. package/dist/options/ignore-certificate-errors.d.ts +1 -0
  137. package/dist/options/ignore-certificate-errors.js +2 -1
  138. package/dist/options/image-sequence-pattern.d.ts +2 -1
  139. package/dist/options/image-sequence-pattern.js +2 -1
  140. package/dist/options/image-sequence.d.ts +1 -0
  141. package/dist/options/image-sequence.js +2 -1
  142. package/dist/options/index.d.ts +211 -2
  143. package/dist/options/index.js +12 -0
  144. package/dist/options/interactivity.d.ts +1 -0
  145. package/dist/options/interactivity.js +2 -1
  146. package/dist/options/ipv4.d.ts +1 -0
  147. package/dist/options/ipv4.js +2 -1
  148. package/dist/options/is-production.d.ts +1 -0
  149. package/dist/options/is-production.js +2 -1
  150. package/dist/options/jpeg-quality.d.ts +1 -0
  151. package/dist/options/jpeg-quality.js +6 -2
  152. package/dist/options/keyboard-shortcuts.d.ts +1 -0
  153. package/dist/options/keyboard-shortcuts.js +2 -1
  154. package/dist/options/latency-hint.d.ts +1 -0
  155. package/dist/options/latency-hint.js +2 -1
  156. package/dist/options/license-key.d.ts +1 -0
  157. package/dist/options/license-key.js +2 -1
  158. package/dist/options/log-level.d.ts +1 -0
  159. package/dist/options/log-level.js +2 -1
  160. package/dist/options/metadata.d.ts +1 -0
  161. package/dist/options/metadata.js +2 -1
  162. package/dist/options/mute.d.ts +1 -0
  163. package/dist/options/mute.js +2 -1
  164. package/dist/options/no-open.d.ts +1 -0
  165. package/dist/options/no-open.js +2 -1
  166. package/dist/options/number-of-gif-loops.d.ts +1 -0
  167. package/dist/options/number-of-gif-loops.js +2 -1
  168. package/dist/options/number-of-shared-audio-tags.d.ts +1 -0
  169. package/dist/options/number-of-shared-audio-tags.js +2 -1
  170. package/dist/options/offthreadvideo-cache-size.d.ts +1 -0
  171. package/dist/options/offthreadvideo-cache-size.js +2 -1
  172. package/dist/options/offthreadvideo-threads.d.ts +1 -0
  173. package/dist/options/offthreadvideo-threads.js +2 -1
  174. package/dist/options/on-browser-download.d.ts +1 -0
  175. package/dist/options/on-browser-download.js +2 -1
  176. package/dist/options/option.d.ts +1 -0
  177. package/dist/options/options-map.d.ts +189 -1
  178. package/dist/options/options-map.js +4 -0
  179. package/dist/options/out-dir.d.ts +1 -0
  180. package/dist/options/out-dir.js +2 -1
  181. package/dist/options/override-duration.d.ts +1 -0
  182. package/dist/options/override-duration.js +2 -1
  183. package/dist/options/override-fps.d.ts +1 -0
  184. package/dist/options/override-fps.js +2 -1
  185. package/dist/options/override-height.d.ts +1 -0
  186. package/dist/options/override-height.js +2 -1
  187. package/dist/options/override-width.d.ts +1 -0
  188. package/dist/options/override-width.js +2 -1
  189. package/dist/options/overwrite.d.ts +1 -0
  190. package/dist/options/overwrite.js +2 -1
  191. package/dist/options/package-manager.d.ts +1 -0
  192. package/dist/options/package-manager.js +2 -1
  193. package/dist/options/pixel-format.d.ts +1 -0
  194. package/dist/options/pixel-format.js +2 -1
  195. package/dist/options/port.d.ts +1 -0
  196. package/dist/options/port.js +2 -1
  197. package/dist/options/prefer-lossless.d.ts +1 -0
  198. package/dist/options/prefer-lossless.js +2 -1
  199. package/dist/options/preview-sample-rate.d.ts +1 -0
  200. package/dist/options/preview-sample-rate.js +2 -1
  201. package/dist/options/props.d.ts +1 -0
  202. package/dist/options/props.js +2 -1
  203. package/dist/options/prores-profile.d.ts +1 -0
  204. package/dist/options/prores-profile.js +2 -1
  205. package/dist/options/public-dir.d.ts +1 -0
  206. package/dist/options/public-dir.js +2 -1
  207. package/dist/options/public-license-key.d.ts +1 -0
  208. package/dist/options/public-license-key.js +2 -1
  209. package/dist/options/public-path.d.ts +1 -0
  210. package/dist/options/public-path.js +2 -1
  211. package/dist/options/repro.d.ts +1 -0
  212. package/dist/options/repro.js +2 -1
  213. package/dist/options/rspack.d.ts +2 -1
  214. package/dist/options/rspack.js +2 -1
  215. package/dist/options/runs.d.ts +1 -0
  216. package/dist/options/runs.js +2 -1
  217. package/dist/options/sample-rate.d.ts +1 -0
  218. package/dist/options/sample-rate.js +2 -1
  219. package/dist/options/scale.d.ts +1 -0
  220. package/dist/options/scale.js +2 -1
  221. package/dist/options/separate-audio.d.ts +1 -0
  222. package/dist/options/separate-audio.js +3 -2
  223. package/dist/options/show-premounting.d.ts +19 -0
  224. package/dist/options/show-premounting.js +33 -0
  225. package/dist/options/skip-skills.d.ts +1 -0
  226. package/dist/options/skip-skills.js +2 -1
  227. package/dist/options/still-frame.d.ts +1 -0
  228. package/dist/options/still-frame.js +2 -1
  229. package/dist/options/still-image-format.d.ts +1 -0
  230. package/dist/options/still-image-format.js +2 -1
  231. package/dist/options/throw-if-site-exists.d.ts +1 -0
  232. package/dist/options/throw-if-site-exists.js +2 -1
  233. package/dist/options/timeout.d.ts +1 -0
  234. package/dist/options/timeout.js +2 -1
  235. package/dist/options/user-agent.d.ts +1 -0
  236. package/dist/options/user-agent.js +2 -1
  237. package/dist/options/version-flag.d.ts +1 -0
  238. package/dist/options/version-flag.js +2 -1
  239. package/dist/options/video-bitrate.d.ts +1 -0
  240. package/dist/options/video-bitrate.js +2 -1
  241. package/dist/options/video-cache-size.d.ts +1 -0
  242. package/dist/options/video-cache-size.js +2 -1
  243. package/dist/options/video-codec.d.ts +1 -0
  244. package/dist/options/video-codec.js +5 -3
  245. package/dist/options/video-image-format.d.ts +1 -0
  246. package/dist/options/video-image-format.js +7 -2
  247. package/dist/options/webhook-custom-data.d.ts +1 -0
  248. package/dist/options/webhook-custom-data.js +2 -1
  249. package/dist/options/webpack-poll.d.ts +1 -0
  250. package/dist/options/webpack-poll.js +2 -1
  251. package/dist/options/x264-preset.d.ts +1 -0
  252. package/dist/options/x264-preset.js +2 -1
  253. package/dist/prespawn-ffmpeg.d.ts +20 -0
  254. package/dist/prespawn-ffmpeg.js +157 -29
  255. package/dist/probe-shared-memory-capture.d.ts +8 -0
  256. package/dist/probe-shared-memory-capture.js +111 -0
  257. package/dist/puppeteer-screenshot.d.ts +3 -1
  258. package/dist/puppeteer-screenshot.js +1 -0
  259. package/dist/pure.d.ts +1 -1
  260. package/dist/remotion-shared-memory-ffmpeg.d.ts +26 -0
  261. package/dist/remotion-shared-memory-ffmpeg.js +312 -0
  262. package/dist/remotion-shared-memory.d.ts +49 -0
  263. package/dist/remotion-shared-memory.js +359 -0
  264. package/dist/render-frame-and-retry-target-close.d.ts +5 -2
  265. package/dist/render-frame-and-retry-target-close.js +20 -4
  266. package/dist/render-frame-with-option-to-reject.d.ts +4 -1
  267. package/dist/render-frame-with-option-to-reject.js +206 -115
  268. package/dist/render-frame.d.ts +4 -5
  269. package/dist/render-frame.js +3 -1
  270. package/dist/render-frames.d.ts +3 -0
  271. package/dist/render-frames.js +15 -18
  272. package/dist/render-media.d.ts +1 -1
  273. package/dist/render-media.js +131 -46
  274. package/dist/render-still.js +1 -0
  275. package/dist/screenshot-background.d.ts +2 -0
  276. package/dist/screenshot-background.js +20 -0
  277. package/dist/screenshot-task.d.ts +4 -2
  278. package/dist/screenshot-task.js +40 -21
  279. package/dist/seek-to-frame.js +1 -1
  280. package/dist/stitch-frames-to-video.js +71 -10
  281. package/dist/take-frame.d.ts +11 -3
  282. package/dist/take-frame.js +10 -8
  283. package/dist/validate-output-filename.d.ts +1 -1
  284. package/dist/validate-output-filename.js +10 -2
  285. package/package.json +13 -13
package/dist/client.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BrowserSafeApis = exports.defaultEditorIds = exports.customEditorTargetPathPlaceholder = exports.customEditorLineNumberPlaceholder = exports.customEditorColumnNumberPlaceholder = exports.defaultCodingAgentIds = void 0;
4
4
  const no_react_1 = require("remotion/no-react");
5
5
  const TimeoutSettings_1 = require("./browser/TimeoutSettings");
6
+ const can_use_parallel_encoding_1 = require("./can-use-parallel-encoding");
6
7
  const codec_1 = require("./codec");
7
8
  const codec_supports_media_1 = require("./codec-supports-media");
8
9
  const crf_1 = require("./crf");
@@ -31,6 +32,7 @@ Object.defineProperty(exports, "customEditorLineNumberPlaceholder", { enumerable
31
32
  Object.defineProperty(exports, "customEditorTargetPathPlaceholder", { enumerable: true, get: function () { return default_editor_1.customEditorTargetPathPlaceholder; } });
32
33
  Object.defineProperty(exports, "defaultEditorIds", { enumerable: true, get: function () { return default_editor_1.defaultEditorIds; } });
33
34
  exports.BrowserSafeApis = {
35
+ canUseParallelEncoding: can_use_parallel_encoding_1.canUseParallelEncoding,
34
36
  getExtensionOfFilename: get_extension_of_filename_1.getExtensionOfFilename,
35
37
  getFileExtensionFromCodec: get_extension_from_codec_1.getFileExtensionFromCodec,
36
38
  validCodecs: codec_1.validCodecs,
@@ -32,8 +32,9 @@ type OptionalCombineChunksOptions = {
32
32
  sampleRate: number;
33
33
  };
34
34
  export type CombineChunksOptions = MandatoryCombineChunksOptions & Partial<OptionalCombineChunksOptions>;
35
- export declare const internalCombineChunks: ({ outputLocation: output, onProgress, codec, fps, numberOfGifLoops, audioBitrate, indent, logLevel, binariesDirectory, cancelSignal, metadata, audioFiles, videoFiles, framesPerChunk, audioCodec, preferLossless, everyNthFrame, frameRange, compositionDurationInFrames, sampleRate, }: MandatoryCombineChunksOptions & OptionalCombineChunksOptions & {
35
+ export declare const internalCombineChunks: ({ outputLocation: output, onProgress, codec, fps, numberOfGifLoops, audioBitrate, indent, logLevel, binariesDirectory, cancelSignal, metadata, audioFiles, videoFiles, framesPerChunk, audioCodec, preferLossless, everyNthFrame, frameRange, compositionDurationInFrames, sampleRate, separateAudioTo, }: MandatoryCombineChunksOptions & OptionalCombineChunksOptions & {
36
36
  indent: boolean;
37
+ separateAudioTo: string | null;
37
38
  }) => Promise<void>;
38
39
  export declare const combineChunks: (options: CombineChunksOptions) => Promise<void>;
39
40
  export {};
@@ -10,7 +10,9 @@ const combine_video_streams_1 = require("./combine-video-streams");
10
10
  const combine_video_streams_seamlessly_1 = require("./combine-video-streams-seamlessly");
11
11
  const get_duration_from_frame_range_1 = require("./get-duration-from-frame-range");
12
12
  const get_extension_from_codec_1 = require("./get-extension-from-codec");
13
+ const get_extension_of_filename_1 = require("./get-extension-of-filename");
13
14
  const get_frame_to_render_1 = require("./get-frame-to-render");
15
+ const get_mp4_brand_1 = require("./get-mp4-brand");
14
16
  const is_audio_codec_1 = require("./is-audio-codec");
15
17
  const logger_1 = require("./logger");
16
18
  const mux_video_and_audio_1 = require("./mux-video-and-audio");
@@ -19,23 +21,28 @@ const tmp_dir_1 = require("./tmp-dir");
19
21
  const truthy_1 = require("./truthy");
20
22
  const validate_number_of_gif_loops_1 = require("./validate-number-of-gif-loops");
21
23
  const REMOTION_FILELIST_TOKEN = 'remotion-filelist';
22
- const internalCombineChunks = async ({ outputLocation: output, onProgress, codec, fps, numberOfGifLoops, audioBitrate, indent, logLevel, binariesDirectory, cancelSignal, metadata, audioFiles, videoFiles, framesPerChunk, audioCodec, preferLossless, everyNthFrame, frameRange, compositionDurationInFrames, sampleRate, }) => {
24
+ const internalCombineChunks = async ({ outputLocation: output, onProgress, codec, fps, numberOfGifLoops, audioBitrate, indent, logLevel, binariesDirectory, cancelSignal, metadata, audioFiles, videoFiles, framesPerChunk, audioCodec, preferLossless, everyNthFrame, frameRange, compositionDurationInFrames, sampleRate, separateAudioTo, }) => {
25
+ var _a;
26
+ var _b;
23
27
  (0, validate_number_of_gif_loops_1.validateNumberOfGifLoops)(numberOfGifLoops, codec);
24
- const filelistDir = (0, tmp_dir_1.tmpDir)(REMOTION_FILELIST_TOKEN);
25
28
  const shouldCreateVideo = !(0, is_audio_codec_1.isAudioCodec)(codec);
26
29
  const resolvedAudioCodec = (0, audio_codec_1.resolveAudioCodec)({
27
30
  setting: audioCodec,
28
31
  codec,
29
32
  preferLossless,
30
- separateAudioTo: null,
33
+ separateAudioTo,
31
34
  });
32
35
  const shouldCreateAudio = resolvedAudioCodec !== null && audioFiles.length > 0;
36
+ if (separateAudioTo !== null && (!shouldCreateAudio || !shouldCreateVideo)) {
37
+ throw new Error('Separate audio requires a video render with audio chunks.');
38
+ }
33
39
  const seamlessVideo = (0, can_concat_seamlessly_1.canConcatVideoSeamlessly)(codec);
34
40
  const realFrameRange = (0, get_frame_to_render_1.getRealFrameRange)(compositionDurationInFrames, frameRange);
35
41
  const seamlessAudio = (0, can_concat_seamlessly_1.canConcatAudioSeamlessly)(resolvedAudioCodec, framesPerChunk);
36
42
  const numberOfFrames = (0, get_duration_from_frame_range_1.getFramesToRender)(realFrameRange, everyNthFrame).length;
43
+ const filelistDir = (0, tmp_dir_1.tmpDir)(REMOTION_FILELIST_TOKEN);
37
44
  const videoOutput = shouldCreateVideo
38
- ? (0, node_path_1.join)(filelistDir, `video.${(0, get_extension_from_codec_1.getFileExtensionFromCodec)(codec, resolvedAudioCodec)}`)
45
+ ? (0, node_path_1.join)(filelistDir, `video.${(0, get_extension_from_codec_1.getFileExtensionFromCodec)(codec, separateAudioTo === null ? resolvedAudioCodec : null)}`)
39
46
  : null;
40
47
  const audioOutput = shouldCreateAudio
41
48
  ? (0, node_path_1.join)(filelistDir, `audio.${(0, audio_codec_1.getExtensionFromAudioCodec)(resolvedAudioCodec)}`)
@@ -63,52 +70,52 @@ const internalCombineChunks = async ({ outputLocation: output, onProgress, codec
63
70
  : seamlessVideo
64
71
  ? 'seamlessly'
65
72
  : 'normally'}`);
66
- await Promise.all([
67
- shouldCreateAudio && audioOutput
68
- ? (0, combine_audio_1.createCombinedAudio)({
69
- audioBitrate,
70
- filelistDir,
71
- files: audioFiles,
72
- indent,
73
- logLevel,
74
- output: audioOutput,
75
- resolvedAudioCodec,
76
- seamless: seamlessAudio,
77
- chunkDurationInSeconds,
78
- addRemotionMetadata: !shouldCreateVideo,
79
- binariesDirectory,
80
- fps,
81
- cancelSignal,
82
- onProgress: (frames) => {
83
- concatenatedAudio = frames;
84
- updateProgress();
85
- },
86
- sampleRate,
87
- })
88
- : null,
89
- shouldCreateVideo && !seamlessVideo && videoOutput
90
- ? (0, combine_video_streams_1.combineVideoStreams)({
91
- codec,
92
- filelistDir,
93
- fps,
94
- indent,
95
- logLevel,
96
- numberOfGifLoops,
97
- output: videoOutput,
98
- files: videoFiles,
99
- addRemotionMetadata: !shouldCreateAudio,
100
- binariesDirectory,
101
- cancelSignal,
102
- onProgress: (frames) => {
103
- concatenatedVideo = frames;
104
- updateProgress();
105
- },
106
- })
107
- : null,
108
- ].filter(truthy_1.truthy));
109
73
  try {
74
+ await Promise.all([
75
+ shouldCreateAudio && audioOutput
76
+ ? (0, combine_audio_1.createCombinedAudio)({
77
+ audioBitrate,
78
+ filelistDir,
79
+ files: audioFiles,
80
+ indent,
81
+ logLevel,
82
+ output: audioOutput,
83
+ resolvedAudioCodec,
84
+ seamless: seamlessAudio,
85
+ chunkDurationInSeconds,
86
+ addRemotionMetadata: !shouldCreateVideo,
87
+ binariesDirectory,
88
+ fps,
89
+ cancelSignal,
90
+ onProgress: (frames) => {
91
+ concatenatedAudio = frames;
92
+ updateProgress();
93
+ },
94
+ sampleRate,
95
+ })
96
+ : null,
97
+ shouldCreateVideo && !seamlessVideo && videoOutput
98
+ ? (0, combine_video_streams_1.combineVideoStreams)({
99
+ codec,
100
+ filelistDir,
101
+ fps,
102
+ indent,
103
+ logLevel,
104
+ numberOfGifLoops,
105
+ output: videoOutput,
106
+ files: videoFiles,
107
+ addRemotionMetadata: !shouldCreateAudio,
108
+ binariesDirectory,
109
+ cancelSignal,
110
+ onProgress: (frames) => {
111
+ concatenatedVideo = frames;
112
+ updateProgress();
113
+ },
114
+ })
115
+ : null,
116
+ ].filter(truthy_1.truthy));
110
117
  await (0, mux_video_and_audio_1.muxVideoAndAudio)({
111
- audioOutput,
118
+ audioOutput: separateAudioTo === null ? audioOutput : null,
112
119
  indent,
113
120
  logLevel,
114
121
  onProgress: (frames) => {
@@ -127,12 +134,33 @@ const internalCombineChunks = async ({ outputLocation: output, onProgress, codec
127
134
  audioCodec: resolvedAudioCodec,
128
135
  sampleRate,
129
136
  });
137
+ if (separateAudioTo !== null && audioOutput !== null) {
138
+ const extension = (_b = (_a = (0, get_extension_of_filename_1.getExtensionOfFilename)(separateAudioTo)) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : null;
139
+ if ((0, get_mp4_brand_1.getMp4BrandForExtension)(extension)) {
140
+ await (0, mux_video_and_audio_1.muxVideoAndAudio)({
141
+ videoOutput: null,
142
+ audioOutput,
143
+ output: separateAudioTo,
144
+ indent,
145
+ logLevel,
146
+ onProgress: () => undefined,
147
+ binariesDirectory,
148
+ fps,
149
+ cancelSignal,
150
+ metadata: null,
151
+ numberOfGifLoops: null,
152
+ audioCodec: resolvedAudioCodec,
153
+ sampleRate,
154
+ });
155
+ }
156
+ else {
157
+ (0, node_fs_1.copyFileSync)(audioOutput, separateAudioTo);
158
+ }
159
+ }
130
160
  onProgress({ totalProgress: 1, frames: numberOfFrames });
131
- (0, node_fs_1.rmSync)(filelistDir, { recursive: true });
132
161
  }
133
- catch (err) {
134
- (0, node_fs_1.rmSync)(filelistDir, { recursive: true });
135
- throw err;
162
+ finally {
163
+ (0, node_fs_1.rmSync)(filelistDir, { recursive: true, force: true });
136
164
  }
137
165
  };
138
166
  exports.internalCombineChunks = internalCombineChunks;
@@ -159,6 +187,7 @@ const combineChunks = (options) => {
159
187
  frameRange: (_j = options.frameRange) !== null && _j !== void 0 ? _j : null,
160
188
  compositionDurationInFrames: options.compositionDurationInFrames,
161
189
  sampleRate: (_k = options.sampleRate) !== null && _k !== void 0 ? _k : 48000,
190
+ separateAudioTo: null,
162
191
  });
163
192
  };
164
193
  exports.combineChunks = combineChunks;
@@ -34,6 +34,9 @@ const combineVideoStreams = async ({ fps, codec, filelistDir, numberOfGifLoops,
34
34
  '-an',
35
35
  '-c:v',
36
36
  encoder,
37
+ // Keep the MP4/MOV video time base consistent with the initial encoding.
38
+ '-video_track_timescale',
39
+ '90000',
37
40
  codec === 'h265' ? '-tag:v' : null,
38
41
  codec === 'h265' ? 'hvc1' : null,
39
42
  addRemotionMetadata ? `-metadata` : null,
@@ -8,27 +8,42 @@ exports.getExecutableDir = exports.getExecutablePath = void 0;
8
8
  exports.isMusl = isMusl;
9
9
  const path_1 = __importDefault(require("path"));
10
10
  const logger_1 = require("../logger");
11
- let warned = false;
11
+ let cachedIsMusl = null;
12
12
  function isMusl({ indent, logLevel, }) {
13
- var _a;
13
+ if (cachedIsMusl !== null) {
14
+ return cachedIsMusl;
15
+ }
14
16
  if (!process.report && typeof Bun !== 'undefined') {
15
- if (!warned) {
16
- logger_1.Log.warn({ indent, logLevel }, 'Bun limitation: Could not determine if your Linux is using musl or glibc. Assuming glibc.');
17
- }
18
- warned = true;
19
- return false;
17
+ logger_1.Log.warn({ indent, logLevel }, 'Bun limitation: Could not determine if your Linux is using musl or glibc. Assuming glibc.');
18
+ cachedIsMusl = false;
19
+ return cachedIsMusl;
20
20
  }
21
- const report = (_a = process.report) === null || _a === void 0 ? void 0 : _a.getReport();
22
- if (report && typeof report === 'string') {
23
- if (!warned) {
21
+ const processReport = process.report;
22
+ const excludeNetwork = processReport && 'excludeNetwork' in processReport
23
+ ? processReport.excludeNetwork
24
+ : null;
25
+ try {
26
+ // Diagnostic reports can block on reverse DNS lookups for open sockets.
27
+ // This option is available in Node.js 20.13.0+ and 22.0.0+.
28
+ if (processReport && 'excludeNetwork' in processReport) {
29
+ processReport.excludeNetwork = true;
30
+ }
31
+ const report = processReport === null || processReport === void 0 ? void 0 : processReport.getReport();
32
+ if (report && typeof report === 'string') {
24
33
  logger_1.Log.warn({ indent, logLevel }, 'Bun limitation: Could not determine if your Windows is using musl or glibc. Assuming glibc.');
34
+ cachedIsMusl = false;
35
+ return cachedIsMusl;
36
+ }
37
+ // @ts-expect-error no types
38
+ const { glibcVersionRuntime } = report.header;
39
+ cachedIsMusl = !glibcVersionRuntime;
40
+ return cachedIsMusl;
41
+ }
42
+ finally {
43
+ if (processReport && 'excludeNetwork' in processReport) {
44
+ processReport.excludeNetwork = excludeNetwork;
25
45
  }
26
- warned = true;
27
- return false;
28
46
  }
29
- // @ts-expect-error no types
30
- const { glibcVersionRuntime } = report.header;
31
- return !glibcVersionRuntime;
32
47
  }
33
48
  const getExecutablePath = ({ indent, logLevel, type, binariesDirectory, }) => {
34
49
  const base = binariesDirectory !== null && binariesDirectory !== void 0 ? binariesDirectory : (0, exports.getExecutableDir)(indent, logLevel);
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cycleBrowserTabs = void 0;
4
+ const flaky_errors_1 = require("./browser/flaky-errors");
4
5
  const logger_1 = require("./logger");
5
6
  const cycleBrowserTabs = ({ puppeteerInstance, concurrency, logLevel, indent, }) => {
6
7
  if (concurrency <= 1) {
@@ -25,7 +26,14 @@ const cycleBrowserTabs = ({ puppeteerInstance, concurrency, logLevel, indent, })
25
26
  if (!(currentPage === null || currentPage === void 0 ? void 0 : currentPage.closed) &&
26
27
  !stopped &&
27
28
  (currentPage === null || currentPage === void 0 ? void 0 : currentPage.url()) !== 'about:blank') {
28
- return currentPage.bringToFront();
29
+ return currentPage.bringToFront().catch((err) => {
30
+ // The tabs are closed at the end of a render while a
31
+ // bringToFront() may still be in flight. Only that case is ignored.
32
+ if (stopped && (0, flaky_errors_1.isTargetClosedErr)(err)) {
33
+ return;
34
+ }
35
+ throw err;
36
+ });
29
37
  }
30
38
  })
31
39
  .catch((err) => logger_1.Log.error({ indent, logLevel }, err))
@@ -29,6 +29,7 @@ export declare const ensureBrowser: (options?: Partial<{
29
29
  readonly logLevel: {
30
30
  cliFlag: "log";
31
31
  name: string;
32
+ addedIn: string;
32
33
  ssrName: string;
33
34
  description: () => import("react/jsx-runtime").JSX.Element;
34
35
  docLink: string;
@@ -46,6 +47,7 @@ export declare const ensureBrowser: (options?: Partial<{
46
47
  };
47
48
  readonly onBrowserDownload: {
48
49
  name: string;
50
+ addedIn: string;
49
51
  cliFlag: "on-browser-download";
50
52
  description: () => import("react/jsx-runtime").JSX.Element;
51
53
  ssrName: "onBrowserDownload";
@@ -58,6 +60,7 @@ export declare const ensureBrowser: (options?: Partial<{
58
60
  readonly chromeMode: {
59
61
  cliFlag: "chrome-mode";
60
62
  name: string;
63
+ addedIn: string;
61
64
  ssrName: string;
62
65
  description: () => import("react/jsx-runtime").JSX.Element;
63
66
  docLink: string;
@@ -10,18 +10,37 @@ const BrowserFetcher_1 = require("./browser/BrowserFetcher");
10
10
  const logger_1 = require("./logger");
11
11
  let currentEnsureBrowserOperation = Promise.resolve();
12
12
  const internalEnsureBrowserUncapped = async ({ indent, logLevel, browserExecutable, onBrowserDownload, chromeMode, }) => {
13
- const status = getBrowserStatus({ browserExecutable, chromeMode });
13
+ const defaultStatus = getBrowserStatus({
14
+ browserExecutable,
15
+ chromeMode,
16
+ version: null,
17
+ });
18
+ if (defaultStatus.type === 'local-puppeteer-browser' ||
19
+ defaultStatus.type === 'user-defined-path') {
20
+ return defaultStatus;
21
+ }
22
+ const { onProgress, version } = onBrowserDownload({ chromeMode });
23
+ const status = version
24
+ ? getBrowserStatus({ browserExecutable, chromeMode, version })
25
+ : defaultStatus;
26
+ if (status.type === 'local-puppeteer-browser') {
27
+ return status;
28
+ }
14
29
  if (status.type === 'version-mismatch') {
30
+ const expectedVersion = (0, BrowserFetcher_1.getExpectedVersion)({
31
+ version,
32
+ chromeMode,
33
+ platform: (0, BrowserFetcher_1.getPlatform)(),
34
+ });
15
35
  const versionInfo = status.actualVersion
16
36
  ? ` (installed: ${status.actualVersion})`
17
37
  : '';
18
- logger_1.Log.info({ indent, logLevel }, `This version of Remotion uses Chrome version ${BrowserFetcher_1.TESTED_VERSION}, but the installed one differs${versionInfo}. Re-downloading.`);
38
+ logger_1.Log.info({ indent, logLevel }, `This version of Remotion uses Chrome version ${expectedVersion}, but the installed one differs${versionInfo}. Re-downloading.`);
19
39
  }
20
40
  if (status.type === 'no-browser' || status.type === 'version-mismatch') {
21
- const { onProgress, version } = onBrowserDownload({ chromeMode });
22
41
  await (0, BrowserFetcher_1.downloadBrowser)({ indent, logLevel, onProgress, version, chromeMode });
23
42
  }
24
- const newStatus = getBrowserStatus({ browserExecutable, chromeMode });
43
+ const newStatus = getBrowserStatus({ browserExecutable, chromeMode, version });
25
44
  return newStatus;
26
45
  };
27
46
  const internalEnsureBrowser = (options) => {
@@ -29,7 +48,7 @@ const internalEnsureBrowser = (options) => {
29
48
  return currentEnsureBrowserOperation;
30
49
  };
31
50
  exports.internalEnsureBrowser = internalEnsureBrowser;
32
- const getBrowserStatus = ({ browserExecutable, chromeMode, }) => {
51
+ const getBrowserStatus = ({ browserExecutable, chromeMode, version, }) => {
33
52
  if (browserExecutable) {
34
53
  if (!fs_1.default.existsSync(browserExecutable)) {
35
54
  throw new Error(`"browserExecutable" was specified as '${browserExecutable}' but the path doesn't exist. Pass "null" for "browserExecutable" to download a browser automatically.`);
@@ -39,7 +58,12 @@ const getBrowserStatus = ({ browserExecutable, chromeMode, }) => {
39
58
  const revision = (0, BrowserFetcher_1.getRevisionInfo)(chromeMode);
40
59
  if (revision.local && fs_1.default.existsSync(revision.executablePath)) {
41
60
  const actualVersion = (0, BrowserFetcher_1.readVersionFile)(chromeMode);
42
- if (actualVersion === BrowserFetcher_1.TESTED_VERSION) {
61
+ if (actualVersion ===
62
+ (0, BrowserFetcher_1.getExpectedVersion)({
63
+ version,
64
+ chromeMode,
65
+ platform: (0, BrowserFetcher_1.getPlatform)(),
66
+ })) {
43
67
  return { path: revision.executablePath, type: 'local-puppeteer-browser' };
44
68
  }
45
69
  return { type: 'version-mismatch', actualVersion };