@remotion/renderer 4.1.0-alpha4 → 4.1.0-alpha5

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 (75) hide show
  1. package/dist/browser/Browser.js +1 -1
  2. package/dist/browser/BrowserPage.js +30 -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/chalk/index.d.ts +2 -1
  12. package/dist/chalk/index.js +3 -8
  13. package/dist/chalk/is-color-supported.d.ts +1 -1
  14. package/dist/chalk/is-color-supported.js +18 -10
  15. package/dist/create-ffmpeg-merge-filter.js +1 -2
  16. package/dist/format-logs.js +1 -1
  17. package/dist/get-compositions.d.ts +3 -3
  18. package/dist/get-compositions.js +1 -1
  19. package/dist/index.d.ts +10 -7
  20. package/dist/logger.d.ts +1 -1
  21. package/dist/logger.js +2 -2
  22. package/dist/puppeteer-evaluate.d.ts +4 -1
  23. package/dist/puppeteer-evaluate.js +5 -5
  24. package/dist/render-frames.d.ts +3 -3
  25. package/dist/render-frames.js +3 -3
  26. package/dist/render-media.d.ts +3 -3
  27. package/dist/render-still.d.ts +3 -3
  28. package/dist/render-still.js +3 -3
  29. package/dist/screenshot-task.js +4 -2
  30. package/dist/seek-to-frame.js +1 -1
  31. package/dist/select-composition.d.ts +7 -3
  32. package/dist/select-composition.js +7 -6
  33. package/dist/set-props-and-env.js +5 -5
  34. package/dist/take-frame-and-compose.js +1 -1
  35. package/package.json +9 -9
  36. package/dist/assets/get-video-stream-duration.d.ts +0 -9
  37. package/dist/assets/get-video-stream-duration.js +0 -71
  38. package/dist/calculate-sar-dar-pixels.d.ts +0 -9
  39. package/dist/calculate-sar-dar-pixels.js +0 -19
  40. package/dist/determine-resize-params.d.ts +0 -4
  41. package/dist/determine-resize-params.js +0 -10
  42. package/dist/determine-vcodec-ffmpeg-flags.d.ts +0 -2
  43. package/dist/determine-vcodec-ffmpeg-flags.js +0 -13
  44. package/dist/ensure-ffmpeg.d.ts +0 -18
  45. package/dist/ensure-ffmpeg.js +0 -58
  46. package/dist/ensure-presentation-timestamp.d.ts +0 -15
  47. package/dist/ensure-presentation-timestamp.js +0 -88
  48. package/dist/extract-frame-from-video.d.ts +0 -16
  49. package/dist/extract-frame-from-video.js +0 -191
  50. package/dist/ffmpeg-executable.d.ts +0 -1
  51. package/dist/ffmpeg-executable.js +0 -2
  52. package/dist/ffmpeg-flags.d.ts +0 -31
  53. package/dist/ffmpeg-flags.js +0 -245
  54. package/dist/frame-to-ffmpeg-timestamp.d.ts +0 -1
  55. package/dist/frame-to-ffmpeg-timestamp.js +0 -8
  56. package/dist/get-can-extract-frames-fast.d.ts +0 -14
  57. package/dist/get-can-extract-frames-fast.js +0 -71
  58. package/dist/get-frame-of-video-slow.d.ts +0 -17
  59. package/dist/get-frame-of-video-slow.js +0 -72
  60. package/dist/get-video-info.d.ts +0 -8
  61. package/dist/get-video-info.js +0 -59
  62. package/dist/is-beyond-last-frame.d.ts +0 -3
  63. package/dist/is-beyond-last-frame.js +0 -12
  64. package/dist/last-frame-from-video-cache.d.ts +0 -17
  65. package/dist/last-frame-from-video-cache.js +0 -55
  66. package/dist/legacy-webpack-config.d.ts +0 -9
  67. package/dist/legacy-webpack-config.js +0 -13
  68. package/dist/quality.d.ts +0 -1
  69. package/dist/quality.js +0 -21
  70. package/dist/try-to-extract-frame-of-video-fast.d.ts +0 -12
  71. package/dist/try-to-extract-frame-of-video-fast.js +0 -55
  72. package/dist/validate-ffmpeg.d.ts +0 -7
  73. package/dist/validate-ffmpeg.js +0 -77
  74. package/dist/warn-about-ffmpeg-version.d.ts +0 -5
  75. package/dist/warn-about-ffmpeg-version.js +0 -37
@@ -82,11 +82,11 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, inputProps
82
82
  });
83
83
  await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
84
84
  // eslint-disable-next-line max-params
85
- pageFunction: (id, defaultProps, durationInFrames, fps, height, width) => {
85
+ pageFunction: (id, props, durationInFrames, fps, height, width) => {
86
86
  window.remotion_setBundleMode({
87
87
  type: 'composition',
88
88
  compositionName: id,
89
- compositionDefaultProps: defaultProps,
89
+ props,
90
90
  compositionDurationInFrames: durationInFrames,
91
91
  compositionFps: fps,
92
92
  compositionHeight: height,
@@ -95,7 +95,7 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, inputProps
95
95
  },
96
96
  args: [
97
97
  composition.id,
98
- composition.defaultProps,
98
+ composition.props,
99
99
  composition.durationInFrames,
100
100
  composition.fps,
101
101
  composition.height,
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import type { AnySmallCompMetadata } from 'remotion';
2
+ import type { VideoConfig } from 'remotion';
3
3
  import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
4
4
  import type { AudioCodec } from './audio-codec';
5
5
  import type { BrowserExecutable } from './browser-executable';
@@ -32,7 +32,7 @@ export type RenderMediaOnProgress = (progress: {
32
32
  export type InternalRenderMediaOptions = {
33
33
  outputLocation: string | null;
34
34
  codec: Codec;
35
- composition: AnySmallCompMetadata;
35
+ composition: VideoConfig;
36
36
  inputProps: Record<string, unknown>;
37
37
  crf: number | null;
38
38
  imageFormat: VideoImageFormat;
@@ -73,7 +73,7 @@ export type InternalRenderMediaOptions = {
73
73
  export type RenderMediaOptions = {
74
74
  outputLocation?: string | null;
75
75
  codec: Codec;
76
- composition: AnySmallCompMetadata;
76
+ composition: VideoConfig;
77
77
  inputProps?: Record<string, unknown>;
78
78
  crf?: number | null;
79
79
  imageFormat?: VideoImageFormat;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import type { AnySmallCompMetadata } from 'remotion';
2
+ import type { VideoConfig } from 'remotion';
3
3
  import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
4
4
  import type { BrowserExecutable } from './browser-executable';
5
5
  import type { BrowserLog } from './browser-log';
@@ -10,7 +10,7 @@ import type { ChromiumOptions } from './open-browser';
10
10
  import type { RemotionServer } from './prepare-server';
11
11
  import type { LogLevel } from './log-level';
12
12
  type InternalRenderStillOptions = {
13
- composition: AnySmallCompMetadata;
13
+ composition: VideoConfig;
14
14
  output: string | null;
15
15
  frame: number;
16
16
  inputProps: Record<string, unknown>;
@@ -34,7 +34,7 @@ type InternalRenderStillOptions = {
34
34
  };
35
35
  export type RenderStillOptions = {
36
36
  port?: number | null;
37
- composition: AnySmallCompMetadata;
37
+ composition: VideoConfig;
38
38
  output?: string | null;
39
39
  frame?: number;
40
40
  inputProps?: Record<string, unknown>;
@@ -148,11 +148,11 @@ const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFA
148
148
  });
149
149
  await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
150
150
  // eslint-disable-next-line max-params
151
- pageFunction: (id, defaultProps, durationInFrames, fps, height, width) => {
151
+ pageFunction: (id, props, durationInFrames, fps, height, width) => {
152
152
  window.remotion_setBundleMode({
153
153
  type: 'composition',
154
154
  compositionName: id,
155
- compositionDefaultProps: defaultProps,
155
+ props,
156
156
  compositionDurationInFrames: durationInFrames,
157
157
  compositionFps: fps,
158
158
  compositionHeight: height,
@@ -161,7 +161,7 @@ const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFA
161
161
  },
162
162
  args: [
163
163
  composition.id,
164
- composition.defaultProps,
164
+ composition.props,
165
165
  composition.durationInFrames,
166
166
  composition.fps,
167
167
  composition.height,
@@ -24,7 +24,7 @@ const screenshotTask = async ({ format, height, omitBackground, page, width, pat
24
24
  try {
25
25
  let result;
26
26
  if (format === 'pdf') {
27
- result = await client.send('Page.printToPDF', {
27
+ const res = await client.send('Page.printToPDF', {
28
28
  paperWidth: width / 96,
29
29
  paperHeight: height / 96,
30
30
  marginTop: 0,
@@ -34,9 +34,10 @@ const screenshotTask = async ({ format, height, omitBackground, page, width, pat
34
34
  scale: 1,
35
35
  printBackground: true,
36
36
  });
37
+ result = res.value;
37
38
  }
38
39
  else {
39
- result = await client.send('Page.captureScreenshot', {
40
+ const { value } = await client.send('Page.captureScreenshot', {
40
41
  format,
41
42
  quality: jpegQuality,
42
43
  clip: clipRegion !== null && clipRegion !== 'hide'
@@ -57,6 +58,7 @@ const screenshotTask = async ({ format, height, omitBackground, page, width, pat
57
58
  captureBeyondViewport: true,
58
59
  optimizeForSpeed: true,
59
60
  });
61
+ result = value;
60
62
  }
61
63
  (0, perf_1.stopPerfMeasure)(cap);
62
64
  if (shouldSetDefaultBackground)
@@ -33,7 +33,7 @@ const waitForReady = (page) => {
33
33
  page,
34
34
  });
35
35
  })
36
- .then((val) => {
36
+ .then(({ value: val }) => {
37
37
  if (typeof val !== 'string') {
38
38
  throw val;
39
39
  }
@@ -1,4 +1,4 @@
1
- import type { AnyCompMetadata } from 'remotion';
1
+ import type { VideoConfig } from 'remotion';
2
2
  import type { BrowserExecutable } from './browser-executable';
3
3
  import type { BrowserLog } from './browser-log';
4
4
  import type { HeadlessBrowser } from './browser/Browser';
@@ -33,10 +33,14 @@ export type SelectCompositionOptions = {
33
33
  serveUrl: string;
34
34
  id: string;
35
35
  };
36
- export declare const internalSelectComposition: (options: InternalSelectCompositionsConfig) => Promise<AnyCompMetadata>;
36
+ type InternalReturnType = {
37
+ metadata: VideoConfig;
38
+ propsSize: number;
39
+ };
40
+ export declare const internalSelectComposition: (options: InternalSelectCompositionsConfig) => Promise<InternalReturnType>;
37
41
  /**
38
42
  * @description Gets a composition defined in a Remotion project based on a Webpack bundle.
39
43
  * @see [Documentation](https://www.remotion.dev/docs/renderer/select-composition)
40
44
  */
41
- export declare const selectComposition: (options: SelectCompositionOptions) => Promise<AnyCompMetadata>;
45
+ export declare const selectComposition: (options: SelectCompositionOptions) => Promise<VideoConfig>;
42
46
  export {};
@@ -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;
@@ -81,7 +81,7 @@ const innerSetPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, i
81
81
  if (isRemotionFn === undefined) {
82
82
  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
83
  }
84
- const siteVersion = await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
84
+ const { value: siteVersion } = await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
85
85
  pageFunction: () => {
86
86
  return window.siteVersion;
87
87
  },
@@ -89,7 +89,7 @@ const innerSetPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, i
89
89
  frame: null,
90
90
  page,
91
91
  });
92
- const remotionVersion = await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
92
+ const { value: remotionVersion } = await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
93
93
  pageFunction: () => {
94
94
  return window.remotion_version;
95
95
  },
@@ -97,7 +97,7 @@ const innerSetPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, i
97
97
  frame: null,
98
98
  page,
99
99
  });
100
- const requiredVersion = '5';
100
+ const requiredVersion = '6';
101
101
  if (siteVersion !== requiredVersion) {
102
102
  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
103
  }
@@ -115,8 +115,8 @@ const setPropsAndEnv = (params) => {
115
115
  innerSetPropsAndEnv(params),
116
116
  new Promise((_, reject) => {
117
117
  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);
118
+ 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.`));
119
+ }, params.timeoutInMilliseconds);
120
120
  }),
121
121
  ]);
122
122
  };
@@ -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-alpha5",
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-alpha5"
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-alpha5",
46
+ "@remotion/compositor-darwin-x64": "4.1.0-alpha5",
47
+ "@remotion/compositor-linux-x64-gnu": "4.1.0-alpha5",
48
+ "@remotion/compositor-linux-arm64-gnu": "4.1.0-alpha5",
49
+ "@remotion/compositor-linux-arm64-musl": "4.1.0-alpha5",
50
+ "@remotion/compositor-linux-x64-musl": "4.1.0-alpha5",
51
+ "@remotion/compositor-win32-x64-msvc": "4.1.0-alpha5"
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 {};