@remotion/renderer 4.0.0-alpha13 → 4.0.0-alpha14

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 (149) hide show
  1. package/dist/assets/download-and-map-assets-to-file.d.ts +6 -4
  2. package/dist/assets/download-and-map-assets-to-file.js +30 -6
  3. package/dist/assets/download-file.d.ts +2 -2
  4. package/dist/assets/download-map.d.ts +3 -3
  5. package/dist/assets/ffmpeg-volume-expression.d.ts +2 -2
  6. package/dist/assets/get-audio-channels.d.ts +1 -0
  7. package/dist/assets/get-audio-channels.js +10 -5
  8. package/dist/assets/get-video-stream-duration.d.ts +9 -0
  9. package/dist/assets/get-video-stream-duration.js +71 -0
  10. package/dist/assets/read-file.js +1 -1
  11. package/dist/assets/types.d.ts +4 -4
  12. package/dist/audio-codec.d.ts +2 -2
  13. package/dist/browser/Browser.d.ts +9 -9
  14. package/dist/browser/Browser.js +26 -32
  15. package/dist/browser/BrowserFetcher.d.ts +1 -1
  16. package/dist/browser/BrowserPage.d.ts +11 -2
  17. package/dist/browser/BrowserPage.js +47 -12
  18. package/dist/browser/BrowserRunner.js +19 -2
  19. package/dist/browser/ConsoleMessage.d.ts +1 -1
  20. package/dist/browser/DOMWorld.js +8 -8
  21. package/dist/browser/EvalTypes.d.ts +7 -7
  22. package/dist/browser/FrameManager.js +11 -11
  23. package/dist/browser/JSHandle.js +14 -14
  24. package/dist/browser/LaunchOptions.d.ts +1 -1
  25. package/dist/browser/Launcher.js +0 -1
  26. package/dist/browser/LifecycleWatcher.d.ts +1 -1
  27. package/dist/browser/NetworkEventManager.d.ts +4 -4
  28. package/dist/browser/NodeWebSocketTransport.js +16 -16
  29. package/dist/browser/Product.d.ts +1 -1
  30. package/dist/browser/Target.d.ts +2 -1
  31. package/dist/browser/Target.js +8 -2
  32. package/dist/browser/devtools-types.d.ts +10 -10
  33. package/dist/browser/mitt/index.d.ts +6 -6
  34. package/dist/browser/revisions.d.ts +1 -1
  35. package/dist/browser/should-log-message.d.ts +24 -0
  36. package/dist/browser/should-log-message.js +72 -0
  37. package/dist/browser-executable.d.ts +1 -1
  38. package/dist/browser-log.d.ts +1 -1
  39. package/dist/browser.d.ts +1 -1
  40. package/dist/calculate-sar-dar-pixels.d.ts +9 -0
  41. package/dist/calculate-sar-dar-pixels.js +19 -0
  42. package/dist/chalk/index.d.ts +4 -4
  43. package/dist/codec-supports-media.d.ts +1 -1
  44. package/dist/codec.d.ts +2 -2
  45. package/dist/combine-videos.d.ts +1 -1
  46. package/dist/compositor/compose.d.ts +11 -2
  47. package/dist/compositor/compose.js +15 -4
  48. package/dist/compositor/compositor.d.ts +1 -1
  49. package/dist/compositor/compositor.js +1 -1
  50. package/dist/compositor/payloads.d.ts +5 -5
  51. package/dist/create-ffmpeg-complex-filter.d.ts +4 -1
  52. package/dist/crf.d.ts +1 -1
  53. package/dist/determine-resize-params.d.ts +1 -0
  54. package/dist/determine-resize-params.js +10 -0
  55. package/dist/determine-vcodec-ffmpeg-flags.d.ts +2 -0
  56. package/dist/determine-vcodec-ffmpeg-flags.js +13 -0
  57. package/dist/ensure-ffmpeg.d.ts +18 -0
  58. package/dist/ensure-ffmpeg.js +58 -0
  59. package/dist/ensure-presentation-timestamp.d.ts +15 -0
  60. package/dist/ensure-presentation-timestamp.js +88 -0
  61. package/dist/error-handling/symbolicate-error.js +4 -2
  62. package/dist/extract-frame-from-video.d.ts +16 -0
  63. package/dist/extract-frame-from-video.js +191 -0
  64. package/dist/ffmpeg-executable.d.ts +1 -0
  65. package/dist/ffmpeg-executable.js +2 -0
  66. package/dist/ffmpeg-flags.d.ts +31 -0
  67. package/dist/ffmpeg-flags.js +245 -0
  68. package/dist/ffmpeg-override.d.ts +1 -1
  69. package/dist/file-extensions.d.ts +1 -1
  70. package/dist/frame-range.d.ts +1 -1
  71. package/dist/frame-to-ffmpeg-timestamp.d.ts +1 -0
  72. package/dist/frame-to-ffmpeg-timestamp.js +8 -0
  73. package/dist/get-browser-instance.d.ts +6 -1
  74. package/dist/get-browser-instance.js +9 -4
  75. package/dist/get-can-extract-frames-fast.d.ts +14 -0
  76. package/dist/get-can-extract-frames-fast.js +71 -0
  77. package/dist/get-compositions.d.ts +18 -11
  78. package/dist/get-compositions.js +66 -49
  79. package/dist/get-frame-of-video-slow.d.ts +17 -0
  80. package/dist/get-frame-of-video-slow.js +72 -0
  81. package/dist/get-frame-padded-index.d.ts +1 -1
  82. package/dist/get-video-info.d.ts +8 -0
  83. package/dist/get-video-info.js +59 -0
  84. package/dist/image-format.d.ts +3 -3
  85. package/dist/index.d.ts +110 -21
  86. package/dist/index.js +25 -13
  87. package/dist/is-beyond-last-frame.d.ts +3 -0
  88. package/dist/is-beyond-last-frame.js +12 -0
  89. package/dist/jpeg-quality.d.ts +1 -0
  90. package/dist/jpeg-quality.js +2 -1
  91. package/dist/last-frame-from-video-cache.d.ts +17 -0
  92. package/dist/last-frame-from-video-cache.js +55 -0
  93. package/dist/legacy-webpack-config.d.ts +9 -0
  94. package/dist/legacy-webpack-config.js +13 -0
  95. package/dist/log-level.d.ts +1 -1
  96. package/dist/logger.d.ts +4 -2
  97. package/dist/logger.js +12 -5
  98. package/dist/make-cancel-signal.d.ts +2 -2
  99. package/dist/merge-audio-track.d.ts +1 -1
  100. package/dist/mime-types.js +1 -1
  101. package/dist/offthread-video-server.d.ts +36 -4
  102. package/dist/offthread-video-server.js +48 -4
  103. package/dist/open-browser.d.ts +19 -10
  104. package/dist/open-browser.js +34 -21
  105. package/dist/options/option.d.ts +1 -1
  106. package/dist/parse-browser-error-stack.d.ts +1 -1
  107. package/dist/perf.d.ts +1 -1
  108. package/dist/pixel-format.d.ts +1 -1
  109. package/dist/prepare-server.d.ts +20 -8
  110. package/dist/prepare-server.js +52 -8
  111. package/dist/preprocess-audio-track.d.ts +2 -2
  112. package/dist/prespawn-ffmpeg.d.ts +1 -1
  113. package/dist/prespawn-ffmpeg.js +7 -7
  114. package/dist/prores-profile.d.ts +1 -1
  115. package/dist/provide-screenshot.d.ts +0 -1
  116. package/dist/puppeteer-screenshot.d.ts +0 -1
  117. package/dist/puppeteer-screenshot.js +1 -2
  118. package/dist/quality.d.ts +1 -0
  119. package/dist/quality.js +21 -0
  120. package/dist/render-frames.d.ts +32 -11
  121. package/dist/render-frames.js +112 -77
  122. package/dist/render-media.d.ts +50 -21
  123. package/dist/render-media.js +249 -197
  124. package/dist/render-still.d.ts +33 -18
  125. package/dist/render-still.js +71 -43
  126. package/dist/replace-browser.d.ts +1 -1
  127. package/dist/screenshot-dom-element.d.ts +0 -1
  128. package/dist/screenshot-task.d.ts +0 -1
  129. package/dist/select-composition.d.ts +19 -11
  130. package/dist/select-composition.js +79 -42
  131. package/dist/serve-static.d.ts +2 -3
  132. package/dist/serve-static.js +2 -4
  133. package/dist/set-props-and-env.d.ts +1 -1
  134. package/dist/stitch-frames-to-video.d.ts +32 -11
  135. package/dist/stitch-frames-to-video.js +121 -99
  136. package/dist/stringify-ffmpeg-filter.d.ts +2 -2
  137. package/dist/symbolicate-stacktrace.d.ts +16 -3
  138. package/dist/symbolicate-stacktrace.js +49 -24
  139. package/dist/take-frame-and-compose.d.ts +0 -1
  140. package/dist/truthy.d.ts +1 -1
  141. package/dist/try-to-extract-frame-of-video-fast.d.ts +12 -0
  142. package/dist/try-to-extract-frame-of-video-fast.js +55 -0
  143. package/dist/types.d.ts +2 -2
  144. package/dist/validate-ffmpeg.d.ts +7 -0
  145. package/dist/validate-ffmpeg.js +77 -0
  146. package/dist/validate-opengl-renderer.d.ts +1 -1
  147. package/dist/warn-about-ffmpeg-version.d.ts +5 -0
  148. package/dist/warn-about-ffmpeg-version.js +37 -0
  149. package/package.json +11 -11
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseChromeLogLocation = exports.formatChromeMessage = exports.parseBrowserLogMessage = exports.shouldLogBrowserMessage = void 0;
4
+ const shouldLogBrowserMessage = (message) => {
5
+ // Not relevant for the user
6
+ if (message.startsWith('DevTools listening on')) {
7
+ return false;
8
+ }
9
+ // Noisy but harmless warning
10
+ if (message.includes('Failed to send GpuControl.CreateCommandBuffer')) {
11
+ return false;
12
+ }
13
+ return true;
14
+ };
15
+ exports.shouldLogBrowserMessage = shouldLogBrowserMessage;
16
+ const parseBrowserLogMessage = (input) => {
17
+ const format = /^\[([0-9]{4})\/([0-9]{6})\.([0-9]{6}):([A-Z]+):(.*)\(([0-9]+)\)\](.*)/;
18
+ const match = input.match(format);
19
+ if (!match) {
20
+ return null;
21
+ }
22
+ const date = match[1];
23
+ const day = parseInt(date.slice(0, 2), 10);
24
+ const month = parseInt(date.slice(2, 4), 10);
25
+ const time = match[2];
26
+ const hour = parseInt(time.slice(0, 2), 10);
27
+ const minute = parseInt(time.slice(2, 4), 10);
28
+ const seconds = parseInt(time.slice(4, 6), 10);
29
+ const microseconds = parseInt(match[3], 10);
30
+ const level = match[4];
31
+ const location = match[5];
32
+ const lineNumber = parseInt(match[6], 10);
33
+ const message = match[7].trim();
34
+ return {
35
+ day,
36
+ month,
37
+ hour,
38
+ minute,
39
+ seconds,
40
+ microseconds,
41
+ level,
42
+ location,
43
+ lineNumber,
44
+ message,
45
+ };
46
+ };
47
+ exports.parseBrowserLogMessage = parseBrowserLogMessage;
48
+ const formatChromeMessage = (input) => {
49
+ const parsed = (0, exports.parseBrowserLogMessage)(input);
50
+ if (!parsed) {
51
+ return { output: input, tag: 'chrome' };
52
+ }
53
+ const { location, lineNumber, message } = parsed;
54
+ // Don't print console.log's, these are handled through the WebSocket
55
+ if (location === 'CONSOLE') {
56
+ return null;
57
+ }
58
+ return { output: `${location}:${lineNumber}: ${message}`, tag: 'chrome' };
59
+ };
60
+ exports.formatChromeMessage = formatChromeMessage;
61
+ const parseChromeLogLocation = (message) => {
62
+ const regex = /(.*), source: (.*) \(([0-9]+)\)/;
63
+ const match = message.match(regex);
64
+ if (!match) {
65
+ return null;
66
+ }
67
+ return {
68
+ lineNumber: parseInt(match[3], 10),
69
+ location: match[2],
70
+ };
71
+ };
72
+ exports.parseChromeLogLocation = parseChromeLogLocation;
@@ -1 +1 @@
1
- export declare type BrowserExecutable = string | null;
1
+ export type BrowserExecutable = string | null;
@@ -1,5 +1,5 @@
1
1
  import type { ConsoleMessageLocation, ConsoleMessageType } from './browser/ConsoleMessage';
2
- export declare type BrowserLog = {
2
+ export type BrowserLog = {
3
3
  text: string;
4
4
  stackTrace: ConsoleMessageLocation[];
5
5
  type: ConsoleMessageType;
package/dist/browser.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare type Browser = 'chrome' | 'firefox';
1
+ export type Browser = 'chrome' | 'firefox';
2
2
  export declare const DEFAULT_BROWSER: Browser;
@@ -0,0 +1,9 @@
1
+ export declare const calculateDisplayVideoSize: ({ darX, darY, x, y, }: {
2
+ x: number;
3
+ y: number;
4
+ darX: number;
5
+ darY: number;
6
+ }) => {
7
+ width: number;
8
+ height: number;
9
+ };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ // https://superuser.com/questions/907933/correct-aspect-ratio-without-re-encoding-video-file
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.calculateDisplayVideoSize = void 0;
5
+ const calculateDisplayVideoSize = ({ darX, darY, x, y, }) => {
6
+ // We know two equations:
7
+ // newWidth / newHeight = darX / darY
8
+ // and:
9
+ // x * y = (newWidth * newHeight)
10
+ // I solved it then on pen and paper and simplified the formula:
11
+ const dimensions = x * y;
12
+ const newWidth = Math.sqrt(dimensions * (darX / darY));
13
+ const newHeight = dimensions / newWidth;
14
+ return {
15
+ height: Math.round(newHeight),
16
+ width: Math.round(newWidth),
17
+ };
18
+ };
19
+ exports.calculateDisplayVideoSize = calculateDisplayVideoSize;
@@ -1,17 +1,17 @@
1
- declare type Style = {
1
+ type Style = {
2
2
  codes: [number, number];
3
3
  name: string;
4
4
  wrap?: (input: string, newline: boolean) => string;
5
5
  };
6
- declare type Method = (str: string) => string;
7
- declare type Colors = {
6
+ type Method = (str: string) => string;
7
+ type Colors = {
8
8
  enabled: boolean;
9
9
  visible: boolean;
10
10
  styles: Record<string, Style>;
11
11
  keys: Record<string, string[]>;
12
12
  alias?: (name: string, col: string) => void;
13
13
  };
14
- declare type ColorsWithMethods = Colors & {
14
+ type ColorsWithMethods = Colors & {
15
15
  reset: Method;
16
16
  bold: Method;
17
17
  dim: Method;
@@ -1,5 +1,5 @@
1
1
  import type { Codec } from './codec';
2
- declare type MediaSupport = {
2
+ type MediaSupport = {
3
3
  video: boolean;
4
4
  audio: boolean;
5
5
  };
package/dist/codec.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export declare const validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "gif"];
2
- export declare type Codec = typeof validCodecs[number];
3
- export declare type CodecOrUndefined = Codec | undefined;
2
+ export type Codec = typeof validCodecs[number];
3
+ export type CodecOrUndefined = Codec | undefined;
4
4
  export declare const DEFAULT_CODEC: Codec;
@@ -1,6 +1,6 @@
1
1
  import type { AudioCodec } from './audio-codec';
2
2
  import type { Codec } from './codec';
3
- declare type Options = {
3
+ type Options = {
4
4
  files: string[];
5
5
  filelistDir: string;
6
6
  output: string;
@@ -1,17 +1,26 @@
1
1
  import type { DownloadMap } from '../assets/download-map';
2
2
  import type { Compositor } from './compositor';
3
3
  import type { CompositorCommand, CompositorCommandSerialized, CompositorImageFormat, Layer } from './payloads';
4
- declare type CompositorInput = {
4
+ type CompositorInput = {
5
5
  height: number;
6
6
  width: number;
7
7
  layers: Layer[];
8
8
  imageFormat: CompositorImageFormat;
9
9
  };
10
+ type ComposeInput = CompositorInput & {
11
+ output: string;
12
+ compositor: Compositor;
13
+ };
10
14
  export declare const serializeCommand: <Type extends keyof CompositorCommand>(command: Type, params: CompositorCommand[Type]) => CompositorCommandSerialized<Type>;
15
+ export declare const composeWithoutCache: ({ height, width, layers, output, imageFormat, compositor, }: CompositorInput & {
16
+ output: string;
17
+ compositor: Compositor;
18
+ }) => Promise<void>;
11
19
  export declare const compose: ({ height, width, layers, output, downloadMap, imageFormat, compositor, }: CompositorInput & {
12
- downloadMap: DownloadMap;
13
20
  output: string;
14
21
  compositor: Compositor;
22
+ } & {
23
+ downloadMap: DownloadMap;
15
24
  }) => Promise<void>;
16
25
  export declare const callCompositor: (payload: string) => Promise<void>;
17
26
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.callCompositor = exports.compose = exports.serializeCommand = void 0;
3
+ exports.callCompositor = exports.compose = exports.composeWithoutCache = exports.serializeCommand = void 0;
4
4
  const node_child_process_1 = require("node:child_process");
5
5
  const node_crypto_1 = require("node:crypto");
6
6
  const node_fs_1 = require("node:fs");
@@ -21,18 +21,29 @@ const serializeCommand = (command, params) => {
21
21
  };
22
22
  };
23
23
  exports.serializeCommand = serializeCommand;
24
+ const composeWithoutCache = async ({ height, width, layers, output, imageFormat, compositor, }) => {
25
+ await compositor.executeCommand('Compose', {
26
+ height,
27
+ width,
28
+ layers,
29
+ output,
30
+ output_format: imageFormat,
31
+ });
32
+ };
33
+ exports.composeWithoutCache = composeWithoutCache;
24
34
  const compose = async ({ height, width, layers, output, downloadMap, imageFormat, compositor, }) => {
25
35
  const hash = getCompositorHash({ height, width, layers, imageFormat });
26
36
  if (downloadMap.compositorCache[hash]) {
27
37
  await (0, promises_1.copyFile)(downloadMap.compositorCache[hash], output);
28
38
  return;
29
39
  }
30
- await compositor.executeCommand('Compose', {
40
+ await (0, exports.composeWithoutCache)({
41
+ compositor,
31
42
  height,
32
- width,
43
+ imageFormat,
33
44
  layers,
34
45
  output,
35
- output_format: imageFormat,
46
+ width,
36
47
  });
37
48
  downloadMap.compositorCache[hash] = output;
38
49
  };
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import type { CompositorCommand } from './payloads';
3
- export declare type Compositor = {
3
+ export type Compositor = {
4
4
  finishCommands: () => void;
5
5
  executeCommand: <T extends keyof CompositorCommand>(type: T, payload: CompositorCommand[T]) => Promise<Buffer>;
6
6
  waitForDone: () => Promise<void>;
@@ -45,7 +45,7 @@ const startCompositor = (type, payload, indent) => {
45
45
  const waiters = new Map();
46
46
  const onMessage = (statusType, nonce, data) => {
47
47
  if (nonce === '0') {
48
- logger_1.Log.verboseAdvanced({ indent, logLevel: (0, logger_1.getLogLevel)(), tag: 'COMPOSITOR' }, data.toString('utf8'));
48
+ logger_1.Log.verboseAdvanced({ indent, logLevel: (0, logger_1.getLogLevel)(), tag: 'compositor' }, data.toString('utf8'));
49
49
  }
50
50
  if (waiters.has(nonce)) {
51
51
  if (statusType === 'error') {
@@ -1,4 +1,4 @@
1
- export declare type Layer = {
1
+ export type Layer = {
2
2
  type: 'PngImage';
3
3
  params: {
4
4
  src: string;
@@ -26,8 +26,8 @@ export declare type Layer = {
26
26
  height: number;
27
27
  };
28
28
  };
29
- export declare type CompositorImageFormat = 'Png' | 'Jpeg';
30
- export declare type CompositorCommand = {
29
+ export type CompositorImageFormat = 'Png' | 'Jpeg';
30
+ export type CompositorCommand = {
31
31
  Compose: {
32
32
  output: string;
33
33
  width: number;
@@ -55,14 +55,14 @@ export declare type CompositorCommand = {
55
55
  percent_of_memory: number;
56
56
  };
57
57
  };
58
- export declare type CompositorCommandSerialized<T extends keyof CompositorCommand> = {
58
+ export type CompositorCommandSerialized<T extends keyof CompositorCommand> = {
59
59
  nonce: string;
60
60
  payload: {
61
61
  type: T;
62
62
  params: CompositorCommand[T];
63
63
  };
64
64
  };
65
- export declare type ErrorPayload = {
65
+ export type ErrorPayload = {
66
66
  error: string;
67
67
  backtrace: string;
68
68
  };
@@ -4,6 +4,9 @@ export declare const createFfmpegComplexFilter: ({ filters, downloadMap, }: {
4
4
  filters: PreprocessedAudioTrack[];
5
5
  downloadMap: DownloadMap;
6
6
  }) => Promise<{
7
- complexFilterFlag: [string, string] | null;
7
+ complexFilterFlag: [
8
+ string,
9
+ string
10
+ ] | null;
8
11
  cleanup: () => void;
9
12
  }>;
package/dist/crf.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Codec } from './codec';
2
- export declare type Crf = number | undefined;
2
+ export type Crf = number | undefined;
3
3
  export declare const getDefaultCrfForCodec: (codec: Codec) => number;
4
4
  export declare const getValidCrfRanges: (codec: Codec) => [number, number];
5
5
  export declare const validateQualitySettings: ({ codec, crf, videoBitrate, }: {
@@ -0,0 +1 @@
1
+ export declare const determineResizeParams: (needsResize: [number, number] | null) => string[];
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.determineResizeParams = void 0;
4
+ const determineResizeParams = (needsResize) => {
5
+ if (needsResize === null) {
6
+ return [];
7
+ }
8
+ return ['-s', `${needsResize[0]}x${needsResize[1]}`];
9
+ };
10
+ exports.determineResizeParams = determineResizeParams;
@@ -0,0 +1,2 @@
1
+ import type { SpecialVCodecForTransparency } from './assets/download-map';
2
+ export declare const determineVcodecFfmpegFlags: (vcodecFlag: SpecialVCodecForTransparency) => string[];
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.determineVcodecFfmpegFlags = void 0;
4
+ const truthy_1 = require("./truthy");
5
+ const determineVcodecFfmpegFlags = (vcodecFlag) => {
6
+ return [
7
+ vcodecFlag === 'vp9' ? '-vcodec' : null,
8
+ vcodecFlag === 'vp9' ? 'libvpx-vp9' : null,
9
+ vcodecFlag === 'vp8' ? '-vcodec' : null,
10
+ vcodecFlag === 'vp8' ? 'libvpx' : null,
11
+ ].filter(truthy_1.truthy);
12
+ };
13
+ exports.determineVcodecFfmpegFlags = determineVcodecFfmpegFlags;
@@ -0,0 +1,18 @@
1
+ export declare type EnsureFfmpegOptions = {
2
+ remotionRoot?: string;
3
+ };
4
+ declare type Result = {
5
+ result: 'found-in-path' | 'found-in-node-modules' | 'installed';
6
+ wasAlreadyInstalled: boolean;
7
+ };
8
+ /**
9
+ * @description Checks if the ffmpeg binary is installed and if it is not, downloads it and puts it into your node_modules folder.
10
+ * @see [Documentation](https://www.remotion.dev/docs/renderer/ensure-ffmpeg)
11
+ */
12
+ export declare const ensureFfmpeg: (options?: EnsureFfmpegOptions) => Promise<Result>;
13
+ /**
14
+ * @description Checks if the ffprobe binary is installed and if it is not, downloads it and puts it into your node_modules folder.
15
+ * @see [Documentation](https://www.remotion.dev/docs/renderer/ensure-ffprobe)
16
+ */
17
+ export declare const ensureFfprobe: (options?: EnsureFfmpegOptions) => Promise<Result>;
18
+ export {};
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ensureFfprobe = exports.ensureFfmpeg = void 0;
7
+ const fs_1 = require("fs");
8
+ const os_1 = __importDefault(require("os"));
9
+ const ffmpeg_flags_1 = require("./ffmpeg-flags");
10
+ const validate_ffmpeg_1 = require("./validate-ffmpeg");
11
+ const ensureFfmpegOrFfprobe = async (binary, options) => {
12
+ var _a;
13
+ const exists = (0, validate_ffmpeg_1.binaryExists)(binary);
14
+ const remotionRoot = (_a = options === null || options === void 0 ? void 0 : options.remotionRoot) !== null && _a !== void 0 ? _a : process.cwd();
15
+ if (exists) {
16
+ return {
17
+ wasAlreadyInstalled: true,
18
+ result: 'found-in-path',
19
+ };
20
+ }
21
+ if (process.platform === 'linux' && (0, fs_1.existsSync)(ffmpeg_flags_1.lambdaFfmpegPaths[binary])) {
22
+ return {
23
+ wasAlreadyInstalled: true,
24
+ result: 'found-in-path',
25
+ };
26
+ }
27
+ if ((0, ffmpeg_flags_1.ffmpegInNodeModules)(remotionRoot, binary)) {
28
+ return {
29
+ result: 'found-in-node-modules',
30
+ wasAlreadyInstalled: true,
31
+ };
32
+ }
33
+ const binaryUrl = (0, ffmpeg_flags_1.getBinaryDownloadUrl)(binary);
34
+ if (binaryUrl) {
35
+ await (0, ffmpeg_flags_1.downloadBinary)(remotionRoot, binaryUrl.url, binary);
36
+ return {
37
+ result: 'installed',
38
+ wasAlreadyInstalled: false,
39
+ };
40
+ }
41
+ throw new Error(`${binary} could not be installed automatically. Your architecture and OS combination (os = ${os_1.default.platform()}, arch = ${process.arch}) is not supported. Please install ${binary} manually and add "${binary}" to your PATH.`);
42
+ };
43
+ /**
44
+ * @description Checks if the ffmpeg binary is installed and if it is not, downloads it and puts it into your node_modules folder.
45
+ * @see [Documentation](https://www.remotion.dev/docs/renderer/ensure-ffmpeg)
46
+ */
47
+ const ensureFfmpeg = (options) => {
48
+ return ensureFfmpegOrFfprobe('ffmpeg', options);
49
+ };
50
+ exports.ensureFfmpeg = ensureFfmpeg;
51
+ /**
52
+ * @description Checks if the ffprobe binary is installed and if it is not, downloads it and puts it into your node_modules folder.
53
+ * @see [Documentation](https://www.remotion.dev/docs/renderer/ensure-ffprobe)
54
+ */
55
+ const ensureFfprobe = (options) => {
56
+ return ensureFfmpegOrFfprobe('ffprobe', options);
57
+ };
58
+ exports.ensureFfprobe = ensureFfprobe;
@@ -0,0 +1,15 @@
1
+ import type { DownloadMap } from './assets/download-map';
2
+ import type { FfmpegExecutable } from './ffmpeg-executable';
3
+ export declare const ensurePresentationTimestampWithoutCache: ({ src, remotionRoot, ffmpegExecutable, ffprobeExecutable, }: {
4
+ src: string;
5
+ remotionRoot: string;
6
+ ffmpegExecutable: FfmpegExecutable;
7
+ ffprobeExecutable: FfmpegExecutable;
8
+ }) => Promise<string>;
9
+ export declare const ensurePresentationTimestamps: ({ downloadMap, src, remotionRoot, ffmpegExecutable, ffprobeExecutable, }: {
10
+ downloadMap: DownloadMap;
11
+ src: string;
12
+ remotionRoot: string;
13
+ ffmpegExecutable: FfmpegExecutable;
14
+ ffprobeExecutable: FfmpegExecutable;
15
+ }) => Promise<string>;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ensurePresentationTimestamps = exports.ensurePresentationTimestampWithoutCache = void 0;
7
+ const execa_1 = __importDefault(require("execa"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const ffmpeg_flags_1 = require("./ffmpeg-flags");
10
+ const guess_extension_for_media_1 = require("./guess-extension-for-media");
11
+ const truthy_1 = require("./truthy");
12
+ let callbacks = [];
13
+ const getTemporaryOutputName = async ({ src, remotionRoot, ffprobeBinary, }) => {
14
+ const parts = src.split(path_1.default.sep);
15
+ // If there is no file extension for the video, then we need to temporarily add an extension
16
+ const lastPart = parts[parts.length - 1];
17
+ const extraExtension = lastPart.includes('.')
18
+ ? null
19
+ : await (0, guess_extension_for_media_1.guessExtensionForVideo)({
20
+ src,
21
+ remotionRoot,
22
+ ffprobeBinary,
23
+ });
24
+ return parts
25
+ .map((p, i) => {
26
+ if (i === parts.length - 1) {
27
+ return [`pts-${p}`, extraExtension].filter(truthy_1.truthy).join('.');
28
+ }
29
+ return p;
30
+ })
31
+ .join(path_1.default.sep);
32
+ };
33
+ const ensurePresentationTimestampWithoutCache = async ({ src, remotionRoot, ffmpegExecutable, ffprobeExecutable, }) => {
34
+ // If there is no file extension for the video, then we need to tempoa
35
+ const output = await getTemporaryOutputName({
36
+ src,
37
+ remotionRoot,
38
+ ffprobeBinary: ffprobeExecutable,
39
+ });
40
+ await (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffmpegExecutable, remotionRoot, 'ffmpeg'), [
41
+ '-i',
42
+ src,
43
+ '-fflags',
44
+ '+genpts+igndts',
45
+ '-vcodec',
46
+ 'copy',
47
+ '-acodec',
48
+ 'copy',
49
+ output,
50
+ '-y',
51
+ ]);
52
+ return output;
53
+ };
54
+ exports.ensurePresentationTimestampWithoutCache = ensurePresentationTimestampWithoutCache;
55
+ const ensurePresentationTimestamps = async ({ downloadMap, src, remotionRoot, ffmpegExecutable, ffprobeExecutable, }) => {
56
+ const elem = downloadMap.ensureFileHasPresentationTimestamp[src];
57
+ if ((elem === null || elem === void 0 ? void 0 : elem.type) === 'encoding') {
58
+ return new Promise((resolve) => {
59
+ callbacks.push({
60
+ src,
61
+ fn: (newSrc) => resolve(newSrc),
62
+ });
63
+ });
64
+ }
65
+ if ((elem === null || elem === void 0 ? void 0 : elem.type) === 'done') {
66
+ return elem.src;
67
+ }
68
+ downloadMap.ensureFileHasPresentationTimestamp[src] = { type: 'encoding' };
69
+ const output = await (0, exports.ensurePresentationTimestampWithoutCache)({
70
+ ffmpegExecutable,
71
+ ffprobeExecutable,
72
+ remotionRoot,
73
+ src,
74
+ });
75
+ callbacks = callbacks.filter((c) => {
76
+ if (c.src === src) {
77
+ c.fn(output);
78
+ return false;
79
+ }
80
+ return true;
81
+ });
82
+ downloadMap.ensureFileHasPresentationTimestamp[src] = {
83
+ type: 'done',
84
+ src: output,
85
+ };
86
+ return output;
87
+ };
88
+ exports.ensurePresentationTimestamps = ensurePresentationTimestamps;
@@ -7,8 +7,10 @@ const handle_javascript_exception_1 = require("./handle-javascript-exception");
7
7
  const symbolicateError = async (symbolicateableError) => {
8
8
  const { delayRenderCall, stackFrame } = symbolicateableError;
9
9
  const [mainErrorFrames, delayRenderFrames] = await Promise.all([
10
- stackFrame ? (0, symbolicate_stacktrace_1.symbolicateStackTrace)(stackFrame) : null,
11
- delayRenderCall ? (0, symbolicate_stacktrace_1.symbolicateStackTrace)(delayRenderCall) : null,
10
+ stackFrame ? (0, symbolicate_stacktrace_1.symbolicateStackTraceFromRemoteFrames)(stackFrame) : null,
11
+ delayRenderCall
12
+ ? (0, symbolicate_stacktrace_1.symbolicateStackTraceFromRemoteFrames)(delayRenderCall)
13
+ : null,
12
14
  ].filter(truthy_1.truthy));
13
15
  const symbolicatedErr = new handle_javascript_exception_1.ErrorWithStackFrame({
14
16
  message: symbolicateableError.message,
@@ -0,0 +1,16 @@
1
+ import type { OffthreadVideoImageFormat } from 'remotion';
2
+ import type { DownloadMap } from './assets/download-map';
3
+ import type { FfmpegExecutable } from './ffmpeg-executable';
4
+ import type { LastFrameOptions } from './last-frame-from-video-cache';
5
+ export declare const getLastFrameOfVideo: (options: LastFrameOptions) => Promise<Buffer>;
6
+ declare type Options = {
7
+ time: number;
8
+ src: string;
9
+ ffmpegExecutable: FfmpegExecutable;
10
+ ffprobeExecutable: FfmpegExecutable;
11
+ imageFormat: OffthreadVideoImageFormat;
12
+ downloadMap: DownloadMap;
13
+ remotionRoot: string;
14
+ };
15
+ export declare const extractFrameFromVideo: (options: Options) => Promise<Buffer>;
16
+ export {};