@remotion/renderer 4.1.0-alpha4 → 4.1.0-alpha7

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 (83) hide show
  1. package/dist/browser/Browser.js +1 -1
  2. package/dist/browser/BrowserPage.js +41 -5
  3. package/dist/browser/Connection.d.ts +9 -3
  4. package/dist/browser/Connection.js +11 -3
  5. package/dist/browser/ConsoleMessage.d.ts +8 -1
  6. package/dist/browser/ConsoleMessage.js +2 -1
  7. package/dist/browser/ExecutionContext.js +4 -4
  8. package/dist/browser/FrameManager.js +2 -2
  9. package/dist/browser/NetworkManager.d.ts +4 -1
  10. package/dist/browser/devtools-types.d.ts +59 -0
  11. package/dist/browser/should-log-message.js +6 -0
  12. package/dist/chalk/index.d.ts +2 -1
  13. package/dist/chalk/index.js +3 -8
  14. package/dist/chalk/is-color-supported.d.ts +1 -1
  15. package/dist/chalk/is-color-supported.js +18 -10
  16. package/dist/compositor/compose.js +5 -0
  17. package/dist/compositor/compositor.js +3 -4
  18. package/dist/create-ffmpeg-merge-filter.js +1 -2
  19. package/dist/format-logs.js +7 -1
  20. package/dist/get-compositions.d.ts +3 -3
  21. package/dist/get-compositions.js +1 -1
  22. package/dist/index.d.ts +27 -23
  23. package/dist/logger.d.ts +1 -1
  24. package/dist/logger.js +9 -9
  25. package/dist/offthread-video-server.js +8 -0
  26. package/dist/options/crf.js +1 -1
  27. package/dist/options/video-codec.js +1 -1
  28. package/dist/puppeteer-evaluate.d.ts +4 -1
  29. package/dist/puppeteer-evaluate.js +5 -5
  30. package/dist/render-frames.d.ts +3 -3
  31. package/dist/render-frames.js +12 -7
  32. package/dist/render-media.d.ts +3 -3
  33. package/dist/render-media.js +7 -5
  34. package/dist/render-still.d.ts +3 -3
  35. package/dist/render-still.js +5 -6
  36. package/dist/screenshot-task.js +4 -2
  37. package/dist/seek-to-frame.d.ts +2 -1
  38. package/dist/seek-to-frame.js +5 -5
  39. package/dist/select-composition.d.ts +7 -3
  40. package/dist/select-composition.js +7 -6
  41. package/dist/set-props-and-env.js +8 -7
  42. package/dist/take-frame-and-compose.js +1 -1
  43. package/package.json +9 -9
  44. package/dist/assets/get-video-stream-duration.d.ts +0 -9
  45. package/dist/assets/get-video-stream-duration.js +0 -71
  46. package/dist/calculate-sar-dar-pixels.d.ts +0 -9
  47. package/dist/calculate-sar-dar-pixels.js +0 -19
  48. package/dist/determine-resize-params.d.ts +0 -4
  49. package/dist/determine-resize-params.js +0 -10
  50. package/dist/determine-vcodec-ffmpeg-flags.d.ts +0 -2
  51. package/dist/determine-vcodec-ffmpeg-flags.js +0 -13
  52. package/dist/ensure-ffmpeg.d.ts +0 -18
  53. package/dist/ensure-ffmpeg.js +0 -58
  54. package/dist/ensure-presentation-timestamp.d.ts +0 -15
  55. package/dist/ensure-presentation-timestamp.js +0 -88
  56. package/dist/extract-frame-from-video.d.ts +0 -16
  57. package/dist/extract-frame-from-video.js +0 -191
  58. package/dist/ffmpeg-executable.d.ts +0 -1
  59. package/dist/ffmpeg-executable.js +0 -2
  60. package/dist/ffmpeg-flags.d.ts +0 -31
  61. package/dist/ffmpeg-flags.js +0 -245
  62. package/dist/frame-to-ffmpeg-timestamp.d.ts +0 -1
  63. package/dist/frame-to-ffmpeg-timestamp.js +0 -8
  64. package/dist/get-can-extract-frames-fast.d.ts +0 -14
  65. package/dist/get-can-extract-frames-fast.js +0 -71
  66. package/dist/get-frame-of-video-slow.d.ts +0 -17
  67. package/dist/get-frame-of-video-slow.js +0 -72
  68. package/dist/get-video-info.d.ts +0 -8
  69. package/dist/get-video-info.js +0 -59
  70. package/dist/is-beyond-last-frame.d.ts +0 -3
  71. package/dist/is-beyond-last-frame.js +0 -12
  72. package/dist/last-frame-from-video-cache.d.ts +0 -17
  73. package/dist/last-frame-from-video-cache.js +0 -55
  74. package/dist/legacy-webpack-config.d.ts +0 -9
  75. package/dist/legacy-webpack-config.js +0 -13
  76. package/dist/quality.d.ts +0 -1
  77. package/dist/quality.js +0 -21
  78. package/dist/try-to-extract-frame-of-video-fast.d.ts +0 -12
  79. package/dist/try-to-extract-frame-of-video-fast.js +0 -55
  80. package/dist/validate-ffmpeg.d.ts +0 -7
  81. package/dist/validate-ffmpeg.js +0 -77
  82. package/dist/warn-about-ffmpeg-version.d.ts +0 -5
  83. package/dist/warn-about-ffmpeg-version.js +0 -37
@@ -51,7 +51,7 @@ const innerSelectComposition = async ({ page, onBrowserLog, inputProps, envVaria
51
51
  logLevel,
52
52
  }, 'Running calculateMetadata()...');
53
53
  const time = Date.now();
54
- const result = await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
54
+ const { value: result, size } = await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
55
55
  pageFunction: (_id) => {
56
56
  return window.remotion_calculateComposition(_id);
57
57
  },
@@ -64,7 +64,7 @@ const innerSelectComposition = async ({ page, onBrowserLog, inputProps, envVaria
64
64
  tag: 'selectComposition()',
65
65
  logLevel,
66
66
  }, `calculateMetadata() took ${Date.now() - time}ms`);
67
- return result;
67
+ return { metadata: result, propsSize: size };
68
68
  };
69
69
  const internalSelectComposition = async (options) => {
70
70
  const cleanup = [];
@@ -117,8 +117,8 @@ const internalSelectComposition = async (options) => {
117
117
  server,
118
118
  });
119
119
  })
120
- .then((comp) => {
121
- return resolve(comp);
120
+ .then((data) => {
121
+ return resolve(data);
122
122
  })
123
123
  .catch((err) => {
124
124
  reject(err);
@@ -135,9 +135,9 @@ exports.internalSelectComposition = internalSelectComposition;
135
135
  * @description Gets a composition defined in a Remotion project based on a Webpack bundle.
136
136
  * @see [Documentation](https://www.remotion.dev/docs/renderer/select-composition)
137
137
  */
138
- const selectComposition = (options) => {
138
+ const selectComposition = async (options) => {
139
139
  const { id, serveUrl, browserExecutable, chromiumOptions, envVariables, inputProps, onBrowserLog, port, puppeteerInstance, timeoutInMilliseconds, verbose, } = options;
140
- return (0, exports.internalSelectComposition)({
140
+ const data = await (0, exports.internalSelectComposition)({
141
141
  id,
142
142
  serveUrl,
143
143
  browserExecutable: browserExecutable !== null && browserExecutable !== void 0 ? browserExecutable : null,
@@ -152,5 +152,6 @@ const selectComposition = (options) => {
152
152
  indent: false,
153
153
  server: undefined,
154
154
  });
155
+ return data.metadata;
155
156
  };
156
157
  exports.selectComposition = selectComposition;
@@ -7,6 +7,7 @@ const normalize_serve_url_1 = require("./normalize-serve-url");
7
7
  const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
8
8
  const redirect_status_codes_1 = require("./redirect-status-codes");
9
9
  const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
10
+ const logger_1 = require("./logger");
10
11
  const innerSetPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, initialFrame, timeoutInMilliseconds, proxyPort, retriesRemaining, audioEnabled, videoEnabled, }) => {
11
12
  (0, validate_puppeteer_timeout_1.validatePuppeteerTimeout)(timeoutInMilliseconds);
12
13
  const actualTimeout = timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : TimeoutSettings_1.DEFAULT_TIMEOUT;
@@ -81,7 +82,7 @@ const innerSetPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, i
81
82
  if (isRemotionFn === undefined) {
82
83
  throw new Error(`Error while getting compositions: Tried to go to ${urlToVisit} and verify that it is a Remotion project by checking if window.getStaticCompositions is defined. However, the function was undefined, which indicates that this is not a valid Remotion project. Please check the URL you passed.`);
83
84
  }
84
- const siteVersion = await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
85
+ const { value: siteVersion } = await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
85
86
  pageFunction: () => {
86
87
  return window.siteVersion;
87
88
  },
@@ -89,7 +90,7 @@ const innerSetPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, i
89
90
  frame: null,
90
91
  page,
91
92
  });
92
- const remotionVersion = await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
93
+ const { value: remotionVersion } = await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
93
94
  pageFunction: () => {
94
95
  return window.remotion_version;
95
96
  },
@@ -97,16 +98,16 @@ const innerSetPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, i
97
98
  frame: null,
98
99
  page,
99
100
  });
100
- const requiredVersion = '5';
101
+ const requiredVersion = '7';
101
102
  if (siteVersion !== requiredVersion) {
102
103
  throw new Error(`Incompatible site: When visiting ${urlToVisit}, a bundle was found, but one that is not compatible with this version of Remotion. Found version: ${siteVersion} - Required version: ${requiredVersion}. To resolve this error, please bundle and deploy again.`);
103
104
  }
104
105
  if (remotionVersion !== version_1.VERSION && process.env.NODE_ENV !== 'test') {
105
106
  if (remotionVersion) {
106
- console.warn(`The site was bundled with version ${remotionVersion} of @remotion/bundler, while @remotion/renderer is on version ${version_1.VERSION}. You may not have the newest bugfixes and features. Re-bundle the site to fix this issue.`);
107
+ logger_1.Log.warn(`The site was bundled with version ${remotionVersion} of @remotion/bundler, while @remotion/renderer is on version ${version_1.VERSION}. You may not have the newest bugfixes and features. Re-bundle the site to fix this issue.`);
107
108
  }
108
109
  else {
109
- console.warn(`The site was bundled with an old version of Remotion, while @remotion/renderer is on version ${version_1.VERSION}. You may not have the newest bugfixes and features. Re-bundle the site to fix this issue.`);
110
+ logger_1.Log.warn(`The site was bundled with an old version of Remotion, while @remotion/renderer is on version ${version_1.VERSION}. You may not have the newest bugfixes and features. Re-bundle the site to fix this issue.`);
110
111
  }
111
112
  }
112
113
  };
@@ -115,8 +116,8 @@ const setPropsAndEnv = (params) => {
115
116
  innerSetPropsAndEnv(params),
116
117
  new Promise((_, reject) => {
117
118
  setTimeout(() => {
118
- reject(new Error('Timed out while setting up the headless browser - the browser seems to not respond. This error is thrown to trigger a retry.'));
119
- }, 10000);
119
+ reject(new Error(`Timed out after ${params.timeoutInMilliseconds} while setting up the headless browser. This could be because the you specified takes a long time to load (or network resources that it includes like fonts) or because the browser is not responding. Optimize the site or increase the browser timeout.`));
120
+ }, params.timeoutInMilliseconds);
120
121
  }),
121
122
  ]);
122
123
  };
@@ -12,7 +12,7 @@ const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
12
12
  const truthy_1 = require("./truthy");
13
13
  const takeFrameAndCompose = async ({ freePage, imageFormat, jpegQuality, frame, width, height, output, scale, downloadMap, wantsBuffer, compositor, }) => {
14
14
  var _a;
15
- const [clipRegion, collectedAssets] = await Promise.all([
15
+ const [{ value: clipRegion }, { value: collectedAssets }] = await Promise.all([
16
16
  (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
17
17
  pageFunction: () => {
18
18
  if (typeof window.remotion_getClipRegion === 'undefined') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "4.1.0-alpha4",
3
+ "version": "4.1.0-alpha7",
4
4
  "description": "Renderer for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "extract-zip": "2.0.1",
19
19
  "source-map": "^0.8.0-beta.0",
20
20
  "ws": "8.7.0",
21
- "remotion": "4.1.0-alpha4"
21
+ "remotion": "4.1.0-alpha7"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": ">=16.8.0",
@@ -42,13 +42,13 @@
42
42
  "zod": "^3.21.4"
43
43
  },
44
44
  "optionalDependencies": {
45
- "@remotion/compositor-linux-arm64-musl": "4.1.0-alpha4",
46
- "@remotion/compositor-darwin-arm64": "4.1.0-alpha4",
47
- "@remotion/compositor-darwin-x64": "4.1.0-alpha4",
48
- "@remotion/compositor-linux-arm64-gnu": "4.1.0-alpha4",
49
- "@remotion/compositor-linux-x64-gnu": "4.1.0-alpha4",
50
- "@remotion/compositor-win32-x64-msvc": "4.1.0-alpha4",
51
- "@remotion/compositor-linux-x64-musl": "4.1.0-alpha4"
45
+ "@remotion/compositor-darwin-arm64": "4.1.0-alpha7",
46
+ "@remotion/compositor-linux-arm64-musl": "4.1.0-alpha7",
47
+ "@remotion/compositor-linux-arm64-gnu": "4.1.0-alpha7",
48
+ "@remotion/compositor-win32-x64-msvc": "4.1.0-alpha7",
49
+ "@remotion/compositor-linux-x64-musl": "4.1.0-alpha7",
50
+ "@remotion/compositor-darwin-x64": "4.1.0-alpha7",
51
+ "@remotion/compositor-linux-x64-gnu": "4.1.0-alpha7"
52
52
  },
53
53
  "keywords": [
54
54
  "remotion",
@@ -1,9 +0,0 @@
1
- import type { FfmpegExecutable } from '../ffmpeg-executable';
2
- import type { DownloadMap, VideoDurationResult } from './download-map';
3
- export declare const parseVideoStreamDuration: (stdout: string) => VideoDurationResult;
4
- export declare function getVideoStreamDurationwithoutCache({ src, ffprobeExecutable, remotionRoot, }: {
5
- src: string;
6
- ffprobeExecutable: FfmpegExecutable;
7
- remotionRoot: string;
8
- }): Promise<VideoDurationResult>;
9
- export declare const getVideoStreamDuration: (downloadMap: DownloadMap, src: string, ffprobeExecutable: FfmpegExecutable, remotionRoot: string) => Promise<VideoDurationResult>;
@@ -1,71 +0,0 @@
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.getVideoStreamDuration = exports.getVideoStreamDurationwithoutCache = exports.parseVideoStreamDuration = void 0;
7
- const execa_1 = __importDefault(require("execa"));
8
- const ffmpeg_flags_1 = require("../ffmpeg-flags");
9
- const p_limit_1 = require("../p-limit");
10
- const limit = (0, p_limit_1.pLimit)(1);
11
- const parseAlternativeDuration = (stdout) => {
12
- const webmDuration = stdout.match(/TAG:DURATION=([0-9.]+):([0-9.]+):([0-9.]+)/);
13
- if (!webmDuration) {
14
- return null;
15
- }
16
- const [, hours, minutes, seconds] = webmDuration;
17
- const hoursAsNumber = Number(hours);
18
- if (Number.isNaN(hoursAsNumber)) {
19
- return null;
20
- }
21
- const minutesAsNumber = Number(minutes);
22
- if (Number.isNaN(minutesAsNumber)) {
23
- return null;
24
- }
25
- const secondsAsNumber = Number(seconds);
26
- if (Number.isNaN(secondsAsNumber)) {
27
- return null;
28
- }
29
- return secondsAsNumber + minutesAsNumber * 60 + hoursAsNumber * 3600;
30
- };
31
- const parseVideoStreamDuration = (stdout) => {
32
- const duration = stdout.match(/duration=([0-9.]+)/);
33
- const alternativeDuration = parseAlternativeDuration(stdout);
34
- const fps = stdout.match(/r_frame_rate=([0-9.]+)\/([0-9.]+)/);
35
- const result = {
36
- duration: duration ? parseFloat(duration[1]) : alternativeDuration,
37
- fps: fps ? parseInt(fps[1], 10) / parseInt(fps[2], 10) : null,
38
- };
39
- return result;
40
- };
41
- exports.parseVideoStreamDuration = parseVideoStreamDuration;
42
- async function getVideoStreamDurationwithoutCache({ src, ffprobeExecutable, remotionRoot, }) {
43
- const args = [
44
- ['-v', 'error'],
45
- ['-select_streams', 'v:0'],
46
- ['-show_entries', 'stream'],
47
- [src],
48
- ]
49
- .reduce((acc, val) => acc.concat(val), [])
50
- .filter(Boolean);
51
- const task = await (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffprobeExecutable, remotionRoot, 'ffprobe'), args);
52
- const result = (0, exports.parseVideoStreamDuration)(task.stdout);
53
- return result;
54
- }
55
- exports.getVideoStreamDurationwithoutCache = getVideoStreamDurationwithoutCache;
56
- async function getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutable, remotionRoot) {
57
- if (downloadMap.videoDurationResultCache[src]) {
58
- return downloadMap.videoDurationResultCache[src];
59
- }
60
- const result = await getVideoStreamDurationwithoutCache({
61
- src,
62
- ffprobeExecutable,
63
- remotionRoot,
64
- });
65
- downloadMap.videoDurationResultCache[src] = result;
66
- return result;
67
- }
68
- const getVideoStreamDuration = (downloadMap, src, ffprobeExecutable, remotionRoot) => {
69
- return limit(() => getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutable, remotionRoot));
70
- };
71
- exports.getVideoStreamDuration = getVideoStreamDuration;
@@ -1,9 +0,0 @@
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
- };
@@ -1,19 +0,0 @@
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,4 +0,0 @@
1
- export declare const determineResizeParams: (needsResize: [
2
- number,
3
- number
4
- ] | null) => string[];
@@ -1,10 +0,0 @@
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;
@@ -1,2 +0,0 @@
1
- import type { SpecialVCodecForTransparency } from './assets/download-map';
2
- export declare const determineVcodecFfmpegFlags: (vcodecFlag: SpecialVCodecForTransparency) => string[];
@@ -1,13 +0,0 @@
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;
@@ -1,18 +0,0 @@
1
- export type EnsureFfmpegOptions = {
2
- remotionRoot?: string;
3
- };
4
- 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 {};
@@ -1,58 +0,0 @@
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;
@@ -1,15 +0,0 @@
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>;
@@ -1,88 +0,0 @@
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;
@@ -1,16 +0,0 @@
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
- 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 {};