@remotion/renderer 4.1.0-alpha3 → 4.1.0-alpha4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/assets/get-video-stream-duration.d.ts +9 -0
  2. package/dist/assets/get-video-stream-duration.js +71 -0
  3. package/dist/browser/Browser.d.ts +7 -6
  4. package/dist/browser/Browser.js +12 -12
  5. package/dist/browser/BrowserPage.d.ts +13 -2
  6. package/dist/browser/BrowserPage.js +15 -8
  7. package/dist/browser/BrowserRunner.js +2 -2
  8. package/dist/browser/LaunchOptions.d.ts +2 -0
  9. package/dist/browser/Launcher.js +2 -1
  10. package/dist/browser/Target.d.ts +2 -1
  11. package/dist/browser/Target.js +3 -1
  12. package/dist/browser/should-log-message.js +8 -0
  13. package/dist/calculate-sar-dar-pixels.d.ts +9 -0
  14. package/dist/calculate-sar-dar-pixels.js +19 -0
  15. package/dist/compositor/compositor.d.ts +3 -2
  16. package/dist/compositor/compositor.js +6 -5
  17. package/dist/cycle-browser-tabs.d.ts +2 -1
  18. package/dist/cycle-browser-tabs.js +2 -2
  19. package/dist/determine-resize-params.d.ts +4 -0
  20. package/dist/determine-resize-params.js +10 -0
  21. package/dist/determine-vcodec-ffmpeg-flags.d.ts +2 -0
  22. package/dist/determine-vcodec-ffmpeg-flags.js +13 -0
  23. package/dist/ensure-ffmpeg.d.ts +18 -0
  24. package/dist/ensure-ffmpeg.js +58 -0
  25. package/dist/ensure-presentation-timestamp.d.ts +15 -0
  26. package/dist/ensure-presentation-timestamp.js +88 -0
  27. package/dist/extract-frame-from-video.d.ts +16 -0
  28. package/dist/extract-frame-from-video.js +191 -0
  29. package/dist/ffmpeg-executable.d.ts +1 -0
  30. package/dist/ffmpeg-executable.js +2 -0
  31. package/dist/ffmpeg-flags.d.ts +31 -0
  32. package/dist/ffmpeg-flags.js +245 -0
  33. package/dist/format-logs.d.ts +3 -0
  34. package/dist/format-logs.js +201 -0
  35. package/dist/frame-to-ffmpeg-timestamp.d.ts +1 -0
  36. package/dist/frame-to-ffmpeg-timestamp.js +8 -0
  37. package/dist/get-browser-instance.d.ts +3 -2
  38. package/dist/get-browser-instance.js +5 -5
  39. package/dist/get-can-extract-frames-fast.d.ts +14 -0
  40. package/dist/get-can-extract-frames-fast.js +71 -0
  41. package/dist/get-compositions.d.ts +4 -3
  42. package/dist/get-compositions.js +6 -5
  43. package/dist/get-frame-of-video-slow.d.ts +17 -0
  44. package/dist/get-frame-of-video-slow.js +72 -0
  45. package/dist/get-video-info.d.ts +8 -0
  46. package/dist/get-video-info.js +59 -0
  47. package/dist/index.d.ts +14 -15
  48. package/dist/is-beyond-last-frame.d.ts +3 -0
  49. package/dist/is-beyond-last-frame.js +12 -0
  50. package/dist/last-frame-from-video-cache.d.ts +17 -0
  51. package/dist/last-frame-from-video-cache.js +55 -0
  52. package/dist/legacy-webpack-config.d.ts +9 -0
  53. package/dist/legacy-webpack-config.js +13 -0
  54. package/dist/logger.d.ts +0 -1
  55. package/dist/logger.js +5 -10
  56. package/dist/offthread-video-server.d.ts +3 -2
  57. package/dist/offthread-video-server.js +4 -3
  58. package/dist/open-browser.d.ts +3 -2
  59. package/dist/open-browser.js +7 -5
  60. package/dist/perf.js +4 -2
  61. package/dist/prepare-server.d.ts +3 -2
  62. package/dist/prepare-server.js +4 -4
  63. package/dist/prespawn-ffmpeg.d.ts +2 -1
  64. package/dist/prespawn-ffmpeg.js +2 -30
  65. package/dist/quality.d.ts +1 -0
  66. package/dist/quality.js +21 -0
  67. package/dist/render-frames.d.ts +11 -4
  68. package/dist/render-frames.js +15 -11
  69. package/dist/render-media.d.ts +11 -4
  70. package/dist/render-media.js +12 -14
  71. package/dist/render-still.d.ts +8 -2
  72. package/dist/render-still.js +8 -8
  73. package/dist/replace-browser.d.ts +2 -1
  74. package/dist/replace-browser.js +2 -2
  75. package/dist/select-composition.d.ts +2 -1
  76. package/dist/select-composition.js +8 -8
  77. package/dist/serve-static.d.ts +2 -1
  78. package/dist/serve-static.js +1 -1
  79. package/dist/stitch-frames-to-video.d.ts +2 -1
  80. package/dist/stitch-frames-to-video.js +12 -22
  81. package/dist/try-to-extract-frame-of-video-fast.d.ts +12 -0
  82. package/dist/try-to-extract-frame-of-video-fast.js +55 -0
  83. package/dist/validate-ffmpeg.d.ts +7 -0
  84. package/dist/validate-ffmpeg.js +77 -0
  85. package/dist/warn-about-ffmpeg-version.d.ts +5 -0
  86. package/dist/warn-about-ffmpeg-version.js +37 -0
  87. package/package.json +9 -9
@@ -0,0 +1,9 @@
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>;
@@ -0,0 +1,71 @@
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;
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import type { LogLevel } from '../log-level';
16
17
  import type { AnySourceMapConsumer } from '../symbolicate-stacktrace';
17
18
  import type { Page } from './BrowserPage';
18
19
  import type { Connection } from './Connection';
@@ -40,12 +41,12 @@ export declare class HeadlessBrowser extends EventEmitter {
40
41
  get _targets(): Map<string, Target>;
41
42
  constructor(connection: Connection, defaultViewport: Viewport, closeCallback?: BrowserCloseCallback);
42
43
  browserContexts(): BrowserContext[];
43
- newPage(context: AnySourceMapConsumer | null): Promise<Page>;
44
- _createPageInContext(context: AnySourceMapConsumer | null): Promise<Page>;
44
+ newPage(context: AnySourceMapConsumer | null, logLevel: LogLevel, indent: boolean): Promise<Page>;
45
+ _createPageInContext(context: AnySourceMapConsumer | null, logLevel: LogLevel, indent: boolean): Promise<Page>;
45
46
  targets(): Target[];
46
47
  waitForTarget(predicate: (x: Target) => boolean | Promise<boolean>, options?: WaitForTargetOptions): Promise<Target>;
47
- pages(): Promise<Page[]>;
48
- close(silent: boolean): Promise<void>;
48
+ pages(logLevel: LogLevel, indent: boolean): Promise<Page[]>;
49
+ close(silent: boolean, logLevel: LogLevel, indent: boolean): Promise<void>;
49
50
  disconnect(): void;
50
51
  }
51
52
  export declare class BrowserContext extends EventEmitter {
@@ -55,8 +56,8 @@ export declare class BrowserContext extends EventEmitter {
55
56
  waitForTarget(predicate: (x: Target) => boolean | Promise<boolean>, options?: {
56
57
  timeout?: number;
57
58
  }): Promise<Target>;
58
- pages(): Promise<Page[]>;
59
- newPage(context: AnySourceMapConsumer | null): Promise<Page>;
59
+ pages(logLevel: LogLevel, indent: boolean): Promise<Page[]>;
60
+ newPage(context: AnySourceMapConsumer | null, logLevel: LogLevel, indent: boolean): Promise<Page>;
60
61
  browser(): HeadlessBrowser;
61
62
  }
62
63
  export {};
@@ -65,10 +65,10 @@ class HeadlessBrowser extends EventEmitter_1.EventEmitter {
65
65
  browserContexts() {
66
66
  return [__classPrivateFieldGet(this, _HeadlessBrowser_defaultContext, "f"), ...Array.from(__classPrivateFieldGet(this, _HeadlessBrowser_contexts, "f").values())];
67
67
  }
68
- newPage(context) {
69
- return __classPrivateFieldGet(this, _HeadlessBrowser_defaultContext, "f").newPage(context);
68
+ newPage(context, logLevel, indent) {
69
+ return __classPrivateFieldGet(this, _HeadlessBrowser_defaultContext, "f").newPage(context, logLevel, indent);
70
70
  }
71
- async _createPageInContext(context) {
71
+ async _createPageInContext(context, logLevel, indent) {
72
72
  const { targetId } = await this.connection.send('Target.createTarget', {
73
73
  url: 'about:blank',
74
74
  browserContextId: undefined,
@@ -81,7 +81,7 @@ class HeadlessBrowser extends EventEmitter_1.EventEmitter {
81
81
  if (!initialized) {
82
82
  throw new Error(`Failed to create target for page (id = ${targetId})`);
83
83
  }
84
- const page = await target.page(context);
84
+ const page = await target.page(context, logLevel, indent);
85
85
  if (!page) {
86
86
  throw new Error(`Failed to create a page for context`);
87
87
  }
@@ -119,18 +119,18 @@ class HeadlessBrowser extends EventEmitter_1.EventEmitter {
119
119
  }
120
120
  }
121
121
  }
122
- async pages() {
122
+ async pages(logLevel, indent) {
123
123
  const contextPages = await Promise.all(this.browserContexts().map((context) => {
124
- return context.pages();
124
+ return context.pages(logLevel, indent);
125
125
  }));
126
126
  // Flatten array.
127
127
  return contextPages.reduce((acc, x) => {
128
128
  return acc.concat(x);
129
129
  }, []);
130
130
  }
131
- async close(silent) {
131
+ async close(silent, logLevel, indent) {
132
132
  await __classPrivateFieldGet(this, _HeadlessBrowser_closeCallback, "f").call(null);
133
- (await this.pages()).forEach((page) => {
133
+ (await this.pages(logLevel, indent)).forEach((page) => {
134
134
  page.emit("disposed" /* PageEmittedEvents.Disposed */);
135
135
  page.closed = true;
136
136
  });
@@ -196,16 +196,16 @@ class BrowserContext extends EventEmitter_1.EventEmitter {
196
196
  return target.browserContext() === this && predicate(target);
197
197
  }, options);
198
198
  }
199
- async pages() {
199
+ async pages(logLevel, indent) {
200
200
  const pages = await Promise.all(this.targets()
201
201
  .filter((target) => target.type() === 'page')
202
- .map((target) => target.page(null)));
202
+ .map((target) => target.page(null, logLevel, indent)));
203
203
  return pages.filter((page) => {
204
204
  return Boolean(page);
205
205
  });
206
206
  }
207
- newPage(context) {
208
- return __classPrivateFieldGet(this, _BrowserContext_browser, "f")._createPageInContext(context);
207
+ newPage(context, logLevel, indent) {
208
+ return __classPrivateFieldGet(this, _BrowserContext_browser, "f")._createPageInContext(context, logLevel, indent);
209
209
  }
210
210
  browser() {
211
211
  return __classPrivateFieldGet(this, _BrowserContext_browser, "f");
@@ -25,6 +25,7 @@ import type { JSHandle } from './JSHandle';
25
25
  import type { Viewport } from './PuppeteerViewport';
26
26
  import type { Target } from './Target';
27
27
  import { TaskQueue } from './TaskQueue';
28
+ import type { LogLevel } from '../log-level';
28
29
  interface WaitForOptions {
29
30
  timeout?: number;
30
31
  }
@@ -41,18 +42,28 @@ interface PageEventObject {
41
42
  export declare class Page extends EventEmitter {
42
43
  #private;
43
44
  id: string;
44
- static _create({ client, target, defaultViewport, browser, sourcemapContext, }: {
45
+ static _create({ client, target, defaultViewport, browser, sourcemapContext, logLevel, indent, }: {
45
46
  client: CDPSession;
46
47
  target: Target;
47
48
  defaultViewport: Viewport;
48
49
  browser: HeadlessBrowser;
49
50
  sourcemapContext: AnySourceMapConsumer | null;
51
+ logLevel: LogLevel;
52
+ indent: boolean;
50
53
  }): Promise<Page>;
51
54
  closed: boolean;
52
55
  browser: HeadlessBrowser;
53
56
  screenshotTaskQueue: TaskQueue;
54
57
  sourcemapContext: AnySourceMapConsumer | null;
55
- constructor(client: CDPSession, target: Target, browser: HeadlessBrowser, sourcemapContext: AnySourceMapConsumer | null);
58
+ logLevel: LogLevel;
59
+ constructor({ client, target, browser, sourcemapContext, logLevel, indent, }: {
60
+ client: CDPSession;
61
+ target: Target;
62
+ browser: HeadlessBrowser;
63
+ sourcemapContext: AnySourceMapConsumer | null;
64
+ logLevel: LogLevel;
65
+ indent: boolean;
66
+ });
56
67
  /**
57
68
  * Listen to page events.
58
69
  */
@@ -40,13 +40,20 @@ const TaskQueue_1 = require("./TaskQueue");
40
40
  const TimeoutSettings_1 = require("./TimeoutSettings");
41
41
  const util_1 = require("./util");
42
42
  class Page extends EventEmitter_1.EventEmitter {
43
- static async _create({ client, target, defaultViewport, browser, sourcemapContext, }) {
44
- const page = new Page(client, target, browser, sourcemapContext);
43
+ static async _create({ client, target, defaultViewport, browser, sourcemapContext, logLevel, indent, }) {
44
+ const page = new Page({
45
+ client,
46
+ target,
47
+ browser,
48
+ sourcemapContext,
49
+ logLevel,
50
+ indent,
51
+ });
45
52
  await __classPrivateFieldGet(page, _Page_instances, "m", _Page_initialize).call(page);
46
53
  await page.setViewport(defaultViewport);
47
54
  return page;
48
55
  }
49
- constructor(client, target, browser, sourcemapContext) {
56
+ constructor({ client, target, browser, sourcemapContext, logLevel, indent, }) {
50
57
  super();
51
58
  _Page_instances.add(this);
52
59
  this.closed = false;
@@ -62,6 +69,7 @@ class Page extends EventEmitter_1.EventEmitter {
62
69
  this.browser = browser;
63
70
  this.id = String(Math.random());
64
71
  this.sourcemapContext = sourcemapContext;
72
+ this.logLevel = logLevel;
65
73
  client.on('Target.attachedToTarget', (event) => {
66
74
  switch (event.targetInfo.type) {
67
75
  case 'iframe':
@@ -112,14 +120,13 @@ class Page extends EventEmitter_1.EventEmitter {
112
120
  .filter(truthy_1.truthy)
113
121
  .join(':');
114
122
  logger_1.Log.verboseAdvanced({
115
- logLevel: (0, logger_1.getLogLevel)(),
116
- tag: `console.${log.type}()`,
117
- secondTag: [origPosition.name, file].filter(truthy_1.truthy).join('@'),
118
- indent: false,
123
+ logLevel,
124
+ tag: [origPosition.name, file].filter(truthy_1.truthy).join('@'),
125
+ indent,
119
126
  }, log.text);
120
127
  }
121
128
  else {
122
- logger_1.Log.verboseAdvanced({ logLevel: (0, logger_1.getLogLevel)(), tag: `console.${log.type}`, indent: false }, log.text);
129
+ logger_1.Log.verboseAdvanced({ logLevel, tag: `console.${log.type}`, indent }, log.text);
123
130
  }
124
131
  });
125
132
  }
@@ -103,7 +103,7 @@ class BrowserRunner {
103
103
  return;
104
104
  }
105
105
  const { output, tag } = formatted;
106
- logger_1.Log.verboseAdvanced({ indent: options.indent, logLevel: (0, logger_1.getLogLevel)(), tag }, output);
106
+ logger_1.Log.verboseAdvanced({ indent: options.indent, logLevel: options.logLevel, tag }, output);
107
107
  }
108
108
  });
109
109
  (_b = this.proc.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (d) => {
@@ -114,7 +114,7 @@ class BrowserRunner {
114
114
  return;
115
115
  }
116
116
  const { output, tag } = formatted;
117
- logger_1.Log.verboseAdvanced({ indent: options.indent, logLevel: (0, logger_1.getLogLevel)(), tag }, output);
117
+ logger_1.Log.verboseAdvanced({ indent: options.indent, logLevel: options.logLevel, tag }, output);
118
118
  }
119
119
  });
120
120
  }
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import type { LogLevel } from '../log-level';
16
17
  import type { BrowserConnectOptions } from './BrowserConnector';
17
18
  import type { Product } from './Product';
18
19
  export interface BrowserLaunchArgumentOptions {
@@ -26,6 +27,7 @@ export interface LaunchOptions {
26
27
  executablePath?: string;
27
28
  timeout?: number;
28
29
  dumpio?: boolean;
30
+ logLevel: LogLevel;
29
31
  env?: Record<string, string | undefined>;
30
32
  product?: Product;
31
33
  indent: boolean;
@@ -84,6 +84,7 @@ class ChromeLauncher {
84
84
  dumpio,
85
85
  env,
86
86
  indent,
87
+ logLevel: options.logLevel,
87
88
  });
88
89
  let browser;
89
90
  try {
@@ -107,7 +108,7 @@ class ChromeLauncher {
107
108
  }, { timeout });
108
109
  }
109
110
  catch (error) {
110
- await browser.close(false);
111
+ await browser.close(false, options.logLevel, options.indent);
111
112
  throw error;
112
113
  }
113
114
  return browser;
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import type { LogLevel } from '../log-level';
16
17
  import type { AnySourceMapConsumer } from '../symbolicate-stacktrace';
17
18
  import type { BrowserContext, HeadlessBrowser } from './Browser';
18
19
  import { Page } from './BrowserPage';
@@ -36,7 +37,7 @@ export declare class Target {
36
37
  /**
37
38
  * If the target is not of type `"page"` or `"background_page"`, returns `null`.
38
39
  */
39
- page(sourcemapContext: AnySourceMapConsumer | null): Promise<Page | null>;
40
+ page(sourcemapContext: AnySourceMapConsumer | null, logLevel: LogLevel, indent: boolean): Promise<Page | null>;
40
41
  url(): string;
41
42
  /**
42
43
  * Identifies what kind of target this is.
@@ -79,7 +79,7 @@ class Target {
79
79
  /**
80
80
  * If the target is not of type `"page"` or `"background_page"`, returns `null`.
81
81
  */
82
- async page(sourcemapContext) {
82
+ async page(sourcemapContext, logLevel, indent) {
83
83
  var _a;
84
84
  if (isPagetTarget(__classPrivateFieldGet(this, _Target_targetInfo, "f")) && !__classPrivateFieldGet(this, _Target_pagePromise, "f")) {
85
85
  __classPrivateFieldSet(this, _Target_pagePromise, __classPrivateFieldGet(this, _Target_sessionFactory, "f").call(this).then((client) => {
@@ -90,6 +90,8 @@ class Target {
90
90
  defaultViewport: (_a = __classPrivateFieldGet(this, _Target_defaultViewport, "f")) !== null && _a !== void 0 ? _a : null,
91
91
  browser: this.browser(),
92
92
  sourcemapContext,
93
+ logLevel,
94
+ indent,
93
95
  });
94
96
  }), "f");
95
97
  }
@@ -6,6 +6,14 @@ const shouldLogBrowserMessage = (message) => {
6
6
  if (message.startsWith('DevTools listening on')) {
7
7
  return false;
8
8
  }
9
+ // In Ubuntu GitHub Action
10
+ if (message.includes('Falling back to ALSA for audio output')) {
11
+ return false;
12
+ }
13
+ // In Ubuntu GitHub Action
14
+ if (message.includes('Floss manager not present, cannot set Floss enable/disable')) {
15
+ return false;
16
+ }
9
17
  // Noisy but harmless warning
10
18
  if (message.includes('Failed to send GpuControl.CreateCommandBuffer')) {
11
19
  return false;
@@ -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,5 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import type { CompositorCommand } from './payloads';
3
+ import type { LogLevel } from '../log-level';
3
4
  export type Compositor = {
4
5
  finishCommands: () => void;
5
6
  executeCommand: <T extends keyof CompositorCommand>(type: T, payload: CompositorCommand[T]) => Promise<Buffer>;
@@ -7,5 +8,5 @@ export type Compositor = {
7
8
  pid: number | null;
8
9
  };
9
10
  export declare const getIdealMaximumFrameCacheItems: () => number;
10
- export declare const startLongRunningCompositor: (maximumFrameCacheItems: number, verbose: boolean, indent: boolean) => Compositor;
11
- export declare const startCompositor: <T extends keyof CompositorCommand>(type: T, payload: CompositorCommand[T], indent: boolean) => Compositor;
11
+ export declare const startLongRunningCompositor: (maximumFrameCacheItems: number, logLevel: LogLevel, indent: boolean) => Compositor;
12
+ export declare const startCompositor: <T extends keyof CompositorCommand>(type: T, payload: CompositorCommand[T], logLevel: LogLevel, indent: boolean) => Compositor;
@@ -13,6 +13,7 @@ const logger_1 = require("../logger");
13
13
  const compose_1 = require("./compose");
14
14
  const get_executable_path_1 = require("./get-executable-path");
15
15
  const make_nonce_1 = require("./make-nonce");
16
+ const log_level_1 = require("../log-level");
16
17
  const getIdealMaximumFrameCacheItems = () => {
17
18
  const freeMemory = node_os_1.default.freemem();
18
19
  // Assuming 1 frame is approximately 6MB
@@ -23,15 +24,15 @@ const getIdealMaximumFrameCacheItems = () => {
23
24
  return Math.max(100, Math.min(max, 1000));
24
25
  };
25
26
  exports.getIdealMaximumFrameCacheItems = getIdealMaximumFrameCacheItems;
26
- const startLongRunningCompositor = (maximumFrameCacheItems, verbose, indent) => {
27
+ const startLongRunningCompositor = (maximumFrameCacheItems, logLevel, indent) => {
27
28
  return (0, exports.startCompositor)('StartLongRunningProcess', {
28
29
  concurrency: (0, get_concurrency_1.getActualConcurrency)(null),
29
30
  maximum_frame_cache_items: maximumFrameCacheItems,
30
- verbose,
31
- }, indent);
31
+ verbose: (0, log_level_1.isEqualOrBelowLogLevel)(logLevel, 'verbose'),
32
+ }, logLevel, indent);
32
33
  };
33
34
  exports.startLongRunningCompositor = startLongRunningCompositor;
34
- const startCompositor = (type, payload, indent) => {
35
+ const startCompositor = (type, payload, logLevel, indent) => {
35
36
  var _a;
36
37
  const bin = (0, get_executable_path_1.getExecutablePath)('compositor');
37
38
  if (!process.env.READ_ONLY_FS) {
@@ -45,7 +46,7 @@ const startCompositor = (type, payload, indent) => {
45
46
  const waiters = new Map();
46
47
  const onMessage = (statusType, nonce, data) => {
47
48
  if (nonce === '0') {
48
- logger_1.Log.verboseAdvanced({ indent, logLevel: (0, logger_1.getLogLevel)(), tag: 'compositor' }, data.toString('utf8'));
49
+ logger_1.Log.verboseAdvanced({ indent, logLevel, tag: 'compositor' }, data.toString('utf8'));
49
50
  }
50
51
  if (waiters.has(nonce)) {
51
52
  if (statusType === 'error') {
@@ -1,4 +1,5 @@
1
+ import type { LogLevel } from './log-level';
1
2
  import type { BrowserReplacer } from './replace-browser';
2
- export declare const cycleBrowserTabs: (puppeteerInstance: BrowserReplacer, concurrency: number) => {
3
+ export declare const cycleBrowserTabs: (puppeteerInstance: BrowserReplacer, concurrency: number, logLevel: LogLevel, indent: boolean) => {
3
4
  stopCycling: () => void;
4
5
  };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cycleBrowserTabs = void 0;
4
- const cycleBrowserTabs = (puppeteerInstance, concurrency) => {
4
+ const cycleBrowserTabs = (puppeteerInstance, concurrency, logLevel, indent) => {
5
5
  if (concurrency <= 1) {
6
6
  return {
7
7
  stopCycling: () => undefined,
@@ -14,7 +14,7 @@ const cycleBrowserTabs = (puppeteerInstance, concurrency) => {
14
14
  interval = setTimeout(() => {
15
15
  puppeteerInstance
16
16
  .getBrowser()
17
- .pages()
17
+ .pages(logLevel, indent)
18
18
  .then((pages) => {
19
19
  if (pages.length === 0) {
20
20
  return;
@@ -0,0 +1,4 @@
1
+ export declare const determineResizeParams: (needsResize: [
2
+ number,
3
+ number
4
+ ] | 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 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 {};
@@ -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>;