@remotion/renderer 4.0.226 → 4.0.228

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 (71) hide show
  1. package/dist/assets/download-and-map-assets-to-file.js +0 -2
  2. package/dist/assets/download-map.d.ts +0 -3
  3. package/dist/assets/download-map.js +0 -1
  4. package/dist/browser-instances.js +1 -1
  5. package/dist/client.d.ts +48 -1
  6. package/dist/client.js +2 -0
  7. package/dist/combine-audio.js +1 -1
  8. package/dist/compositor/compose.d.ts +1 -21
  9. package/dist/compositor/compose.js +2 -34
  10. package/dist/compositor/compositor.js +1 -1
  11. package/dist/compositor/payloads.d.ts +0 -35
  12. package/dist/crf.d.ts +4 -2
  13. package/dist/crf.js +12 -6
  14. package/dist/delete-directory.js +1 -1
  15. package/dist/error-handling/handle-javascript-exception.js +1 -0
  16. package/dist/ffmpeg-args.d.ts +6 -1
  17. package/dist/ffmpeg-args.js +14 -5
  18. package/dist/get-browser-instance.js +3 -2
  19. package/dist/get-codec-name.d.ts +5 -1
  20. package/dist/get-codec-name.js +38 -15
  21. package/dist/get-cpu-count.js +1 -1
  22. package/dist/get-local-browser-executable.d.ts +6 -1
  23. package/dist/get-local-browser-executable.js +9 -4
  24. package/dist/get-port.js +1 -0
  25. package/dist/index.d.ts +5 -5
  26. package/dist/logger.d.ts +4 -4
  27. package/dist/logger.js +20 -1
  28. package/dist/open-browser.js +5 -1
  29. package/dist/options/audio-codec.d.ts +1 -1
  30. package/dist/options/audio-codec.js +1 -0
  31. package/dist/options/hardware-acceleration.d.ts +18 -0
  32. package/dist/options/hardware-acceleration.js +56 -0
  33. package/dist/options/index.d.ts +15 -0
  34. package/dist/options/index.js +2 -0
  35. package/dist/options/options-map.d.ts +30 -0
  36. package/dist/options/options-map.js +3 -0
  37. package/dist/path-normalize.js +1 -1
  38. package/dist/prespawn-ffmpeg.d.ts +2 -0
  39. package/dist/prespawn-ffmpeg.js +3 -0
  40. package/dist/provide-screenshot.d.ts +1 -3
  41. package/dist/provide-screenshot.js +1 -2
  42. package/dist/puppeteer-evaluate.js +2 -3
  43. package/dist/puppeteer-screenshot.d.ts +0 -2
  44. package/dist/puppeteer-screenshot.js +0 -1
  45. package/dist/render-frames.js +4 -7
  46. package/dist/render-media.d.ts +1 -1
  47. package/dist/render-media.js +12 -8
  48. package/dist/render-still.js +10 -13
  49. package/dist/screenshot-dom-element.d.ts +1 -3
  50. package/dist/screenshot-dom-element.js +1 -2
  51. package/dist/screenshot-task.d.ts +1 -3
  52. package/dist/screenshot-task.js +8 -16
  53. package/dist/serve-handler/index.js +2 -2
  54. package/dist/stitch-frames-to-video.d.ts +2 -2
  55. package/dist/stitch-frames-to-video.js +7 -2
  56. package/dist/take-frame.d.ts +18 -0
  57. package/dist/take-frame.js +34 -0
  58. package/ensure-browser.mjs +13 -1
  59. package/eslint.config.mjs +34 -0
  60. package/package.json +15 -14
  61. package/Cargo.lock +0 -952
  62. package/Cargo.toml +0 -26
  63. package/build.ts +0 -311
  64. package/dist/browser/BrowserConnector.d.ts +0 -19
  65. package/dist/browser/BrowserConnector.js +0 -17
  66. package/dist/browser/PuppeteerNode.d.ts +0 -30
  67. package/dist/browser/PuppeteerNode.js +0 -52
  68. package/dist/browser/node.d.ts +0 -2
  69. package/dist/browser/node.js +0 -5
  70. package/dist/copy-to-clipboard.d.ts +0 -2
  71. package/dist/copy-to-clipboard.js +0 -18
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.screenshotDOMElement = void 0;
4
4
  const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
5
5
  const puppeteer_screenshot_1 = require("./puppeteer-screenshot");
6
- const screenshotDOMElement = async ({ page, imageFormat, jpegQuality, opts, height, width, clipRegion, timeoutInMilliseconds, scale, }) => {
6
+ const screenshotDOMElement = async ({ page, imageFormat, jpegQuality, opts, height, width, timeoutInMilliseconds, scale, }) => {
7
7
  const { path } = opts;
8
8
  if (imageFormat === 'png' ||
9
9
  imageFormat === 'pdf' ||
@@ -41,7 +41,6 @@ const screenshotDOMElement = async ({ page, imageFormat, jpegQuality, opts, heig
41
41
  jpegQuality,
42
42
  width,
43
43
  height,
44
- clipRegion,
45
44
  scale,
46
45
  });
47
46
  if (typeof buf === 'string') {
@@ -1,7 +1,6 @@
1
- import type { ClipRegion } from 'remotion/no-react';
2
1
  import type { Page } from './browser/BrowserPage';
3
2
  import type { StillImageFormat } from './image-format';
4
- export declare const screenshotTask: ({ format, height, omitBackground, page, width, path, jpegQuality, clipRegion, scale, }: {
3
+ export declare const screenshotTask: ({ format, height, omitBackground, page, width, path, jpegQuality, scale, }: {
5
4
  page: Page;
6
5
  format: StillImageFormat;
7
6
  path?: string;
@@ -9,6 +8,5 @@ export declare const screenshotTask: ({ format, height, omitBackground, page, wi
9
8
  omitBackground: boolean;
10
9
  width: number;
11
10
  height: number;
12
- clipRegion: ClipRegion | null;
13
11
  scale: number;
14
12
  }) => Promise<Buffer | string>;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.screenshotTask = void 0;
7
7
  const node_fs_1 = __importDefault(require("node:fs"));
8
8
  const perf_1 = require("./perf");
9
- const screenshotTask = async ({ format, height, omitBackground, page, width, path, jpegQuality, clipRegion, scale, }) => {
9
+ const screenshotTask = async ({ format, height, omitBackground, page, width, path, jpegQuality, scale, }) => {
10
10
  var _a;
11
11
  const client = page._client();
12
12
  const target = page.target();
@@ -49,21 +49,13 @@ const screenshotTask = async ({ format, height, omitBackground, page, width, pat
49
49
  const { value } = await client.send('Page.captureScreenshot', {
50
50
  format,
51
51
  quality: jpegQuality,
52
- clip: clipRegion !== null && clipRegion !== 'hide'
53
- ? {
54
- x: clipRegion.x,
55
- y: clipRegion.y,
56
- height: clipRegion.height,
57
- scale: 1,
58
- width: clipRegion.width,
59
- }
60
- : {
61
- x: 0,
62
- y: 0,
63
- height: height * scaleFactor,
64
- scale: 1,
65
- width: width * scaleFactor,
66
- },
52
+ clip: {
53
+ x: 0,
54
+ y: 0,
55
+ height: height * scaleFactor,
56
+ scale: 1,
57
+ width: width * scaleFactor,
58
+ },
67
59
  captureBeyondViewport: true,
68
60
  optimizeForSpeed: true,
69
61
  fromSurface,
@@ -80,7 +80,7 @@ const serveHandler = async (request, response, config) => {
80
80
  try {
81
81
  relativePath = decodeURIComponent(node_url_1.default.parse(request.url).pathname);
82
82
  }
83
- catch (err) {
83
+ catch (_a) {
84
84
  return sendError('/', response, {
85
85
  statusCode: 400,
86
86
  code: 'bad_request',
@@ -192,7 +192,7 @@ const serveHandler = async (request, response, config) => {
192
192
  try {
193
193
  stream = (0, node_fs_1.createReadStream)(absolutePath, streamOpts !== null && streamOpts !== void 0 ? streamOpts : {});
194
194
  }
195
- catch (err) {
195
+ catch (_b) {
196
196
  return internalError(absolutePath, response);
197
197
  }
198
198
  const headers = getHeaders(absolutePath, stats);
@@ -41,7 +41,7 @@ type InternalStitchFramesToVideoOptions = {
41
41
  ffmpegOverride: null | FfmpegOverrideFn;
42
42
  colorSpace: ColorSpace | null;
43
43
  binariesDirectory: string | null;
44
- metadata?: Record<string, string> | null;
44
+ metadata: Record<string, string> | null;
45
45
  } & ToOptions<typeof optionsMap.stitchFramesToVideo>;
46
46
  export type StitchFramesToVideoOptions = {
47
47
  fps: number;
@@ -79,5 +79,5 @@ export declare const internalStitchFramesToVideo: (options: InternalStitchFrames
79
79
  * @param {StitchFramesToVideoOptions} options The configuration options for stitching frames into a video
80
80
  * @returns {Promise<Buffer | null>} A promise that resolves with the video buffer or null if the output was written to a file
81
81
  */
82
- export declare const stitchFramesToVideo: ({ assetsInfo, force, fps, height, width, audioBitrate, audioCodec, cancelSignal, codec, crf, enforceAudioTrack, ffmpegOverride, muted, numberOfGifLoops, onDownload, onProgress, outputLocation, pixelFormat, proResProfile, verbose, videoBitrate, maxRate, bufferSize, x264Preset, colorSpace, binariesDirectory, separateAudioTo, metadata, }: StitchFramesToVideoOptions) => Promise<Buffer | null>;
82
+ export declare const stitchFramesToVideo: ({ assetsInfo, force, fps, height, width, audioBitrate, audioCodec, cancelSignal, codec, crf, enforceAudioTrack, ffmpegOverride, muted, numberOfGifLoops, onDownload, onProgress, outputLocation, pixelFormat, proResProfile, verbose, videoBitrate, maxRate, bufferSize, x264Preset, colorSpace, binariesDirectory, separateAudioTo, metadata, hardwareAcceleration, }: StitchFramesToVideoOptions) => Promise<Buffer | null>;
83
83
  export {};
@@ -30,7 +30,7 @@ const render_has_audio_1 = require("./render-has-audio");
30
30
  const validate_1 = require("./validate");
31
31
  const validate_even_dimensions_with_codec_1 = require("./validate-even-dimensions-with-codec");
32
32
  const validate_videobitrate_1 = require("./validate-videobitrate");
33
- const innerStitchFramesToVideo = async ({ assetsInfo, audioBitrate, audioCodec: audioCodecSetting, cancelSignal, codec, crf, enforceAudioTrack, ffmpegOverride, force, fps, height, indent, muted, onDownload, outputLocation, pixelFormat, preEncodedFileLocation, preferLossless, proResProfile, logLevel, videoBitrate, maxRate, bufferSize, width, numberOfGifLoops, onProgress, x264Preset, colorSpace, binariesDirectory, separateAudioTo, metadata, }, remotionRoot) => {
33
+ const innerStitchFramesToVideo = async ({ assetsInfo, audioBitrate, audioCodec: audioCodecSetting, cancelSignal, codec, crf, enforceAudioTrack, ffmpegOverride, force, fps, height, indent, muted, onDownload, outputLocation, pixelFormat, preEncodedFileLocation, preferLossless, proResProfile, logLevel, videoBitrate, maxRate, bufferSize, width, numberOfGifLoops, onProgress, x264Preset, colorSpace, binariesDirectory, separateAudioTo, metadata, hardwareAcceleration, }, remotionRoot) => {
34
34
  var _a;
35
35
  (0, validate_1.validateDimension)(height, 'height', 'passed to `stitchFramesToVideo()`');
36
36
  (0, validate_1.validateDimension)(width, 'width', 'passed to `stitchFramesToVideo()`');
@@ -108,6 +108,7 @@ const innerStitchFramesToVideo = async ({ assetsInfo, audioBitrate, audioCodec:
108
108
  videoBitrate,
109
109
  encodingMaxRate: maxRate,
110
110
  encodingBufferSize: bufferSize,
111
+ hardwareAcceleration,
111
112
  });
112
113
  (0, pixel_format_1.validateSelectedPixelFormatAndCodecCombination)(pixelFormat, codec);
113
114
  const updateProgress = (muxProgress) => {
@@ -197,6 +198,9 @@ const innerStitchFramesToVideo = async ({ assetsInfo, audioBitrate, audioCodec:
197
198
  pixelFormat,
198
199
  x264Preset,
199
200
  colorSpace,
201
+ hardwareAcceleration,
202
+ indent,
203
+ logLevel,
200
204
  }),
201
205
  codec === 'h264' ? ['-movflags', 'faststart'] : null,
202
206
  // Ignore metadata that may come from remote media
@@ -305,7 +309,7 @@ exports.internalStitchFramesToVideo = internalStitchFramesToVideo;
305
309
  * @param {StitchFramesToVideoOptions} options The configuration options for stitching frames into a video
306
310
  * @returns {Promise<Buffer | null>} A promise that resolves with the video buffer or null if the output was written to a file
307
311
  */
308
- const stitchFramesToVideo = ({ assetsInfo, force, fps, height, width, audioBitrate, audioCodec, cancelSignal, codec, crf, enforceAudioTrack, ffmpegOverride, muted, numberOfGifLoops, onDownload, onProgress, outputLocation, pixelFormat, proResProfile, verbose, videoBitrate, maxRate, bufferSize, x264Preset, colorSpace, binariesDirectory, separateAudioTo, metadata, }) => {
312
+ const stitchFramesToVideo = ({ assetsInfo, force, fps, height, width, audioBitrate, audioCodec, cancelSignal, codec, crf, enforceAudioTrack, ffmpegOverride, muted, numberOfGifLoops, onDownload, onProgress, outputLocation, pixelFormat, proResProfile, verbose, videoBitrate, maxRate, bufferSize, x264Preset, colorSpace, binariesDirectory, separateAudioTo, metadata, hardwareAcceleration, }) => {
309
313
  return (0, exports.internalStitchFramesToVideo)({
310
314
  assetsInfo,
311
315
  audioBitrate: audioBitrate !== null && audioBitrate !== void 0 ? audioBitrate : null,
@@ -338,6 +342,7 @@ const stitchFramesToVideo = ({ assetsInfo, force, fps, height, width, audioBitra
338
342
  binariesDirectory: binariesDirectory !== null && binariesDirectory !== void 0 ? binariesDirectory : null,
339
343
  metadata: metadata !== null && metadata !== void 0 ? metadata : null,
340
344
  separateAudioTo: separateAudioTo !== null && separateAudioTo !== void 0 ? separateAudioTo : null,
345
+ hardwareAcceleration: hardwareAcceleration !== null && hardwareAcceleration !== void 0 ? hardwareAcceleration : 'disable',
341
346
  });
342
347
  };
343
348
  exports.stitchFramesToVideo = stitchFramesToVideo;
@@ -0,0 +1,18 @@
1
+ import type { TRenderAsset } from 'remotion/no-react';
2
+ import type { Page } from './browser/BrowserPage';
3
+ import type { StillImageFormat, VideoImageFormat } from './image-format';
4
+ export declare const takeFrame: ({ freePage, imageFormat, jpegQuality, frame, width, height, output, scale, wantsBuffer, timeoutInMilliseconds, }: {
5
+ freePage: Page;
6
+ imageFormat: VideoImageFormat | StillImageFormat;
7
+ jpegQuality: number | undefined;
8
+ frame: number;
9
+ height: number;
10
+ width: number;
11
+ output: string | null;
12
+ scale: number;
13
+ wantsBuffer: boolean;
14
+ timeoutInMilliseconds: number;
15
+ }) => Promise<{
16
+ buffer: Buffer | null;
17
+ collectedAssets: TRenderAsset[];
18
+ }>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.takeFrame = void 0;
4
+ const collect_assets_1 = require("./collect-assets");
5
+ const provide_screenshot_1 = require("./provide-screenshot");
6
+ const takeFrame = async ({ freePage, imageFormat, jpegQuality, frame, width, height, output, scale, wantsBuffer, timeoutInMilliseconds, }) => {
7
+ const collectedAssets = await (0, collect_assets_1.collectAssets)({
8
+ frame,
9
+ freePage,
10
+ timeoutInMilliseconds,
11
+ });
12
+ if (imageFormat === 'none') {
13
+ return { buffer: null, collectedAssets };
14
+ }
15
+ const shouldMakeBuffer = wantsBuffer;
16
+ const buf = await (0, provide_screenshot_1.provideScreenshot)({
17
+ page: freePage,
18
+ imageFormat,
19
+ jpegQuality,
20
+ options: {
21
+ frame,
22
+ output: wantsBuffer ? null : output,
23
+ },
24
+ height,
25
+ width,
26
+ timeoutInMilliseconds,
27
+ scale,
28
+ });
29
+ if (shouldMakeBuffer) {
30
+ return { buffer: buf, collectedAssets };
31
+ }
32
+ return { buffer: null, collectedAssets };
33
+ };
34
+ exports.takeFrame = takeFrame;
@@ -2743,6 +2743,9 @@ var Log = {
2743
2743
  verbose: (options, ...args) => {
2744
2744
  writeInRepro("verbose", ...args);
2745
2745
  if (isEqualOrBelowLogLevel(options.logLevel, "verbose")) {
2746
+ if (args.length === 0) {
2747
+ return process.stdout.write("\n");
2748
+ }
2746
2749
  return console.log(...[
2747
2750
  options.indent ? INDENT_TOKEN : null,
2748
2751
  options.tag ? verboseTag(options.tag) : null
@@ -2752,18 +2755,27 @@ var Log = {
2752
2755
  info: (options, ...args) => {
2753
2756
  writeInRepro("info", ...args);
2754
2757
  if (isEqualOrBelowLogLevel(options.logLevel, "info")) {
2755
- return console.log(...[options.indent ? INDENT_TOKEN : null].filter(truthy).concat(args));
2758
+ if (args.length === 0) {
2759
+ return process.stdout.write("\n");
2760
+ }
2761
+ return console.log(...[options.indent ? INDENT_TOKEN : null].filter(truthy).concat(args ?? []));
2756
2762
  }
2757
2763
  },
2758
2764
  warn: (options, ...args) => {
2759
2765
  writeInRepro("warn", ...args);
2760
2766
  if (isEqualOrBelowLogLevel(options.logLevel, "warn")) {
2767
+ if (args.length === 0) {
2768
+ return process.stdout.write("\n");
2769
+ }
2761
2770
  return console.warn(...[options.indent ? chalk.yellow(INDENT_TOKEN) : null].filter(truthy).concat(args.map((a) => chalk.yellow(a))));
2762
2771
  }
2763
2772
  },
2764
2773
  error: (options, ...args) => {
2765
2774
  writeInRepro("error", ...args);
2766
2775
  if (isEqualOrBelowLogLevel(options.logLevel, "error")) {
2776
+ if (args.length === 0) {
2777
+ return process.stdout.write("\n");
2778
+ }
2767
2779
  return console.error(...[
2768
2780
  options.indent ? INDENT_TOKEN : null,
2769
2781
  options.tag ? verboseTag(options.tag) : null
@@ -0,0 +1,34 @@
1
+ import {remotionFlatConfig} from '@remotion/eslint-config-internal';
2
+
3
+ const config = remotionFlatConfig({react: false});
4
+
5
+ export default [
6
+ {
7
+ ...config,
8
+ rules: {
9
+ ...config.rules,
10
+ '@typescript-eslint/no-use-before-define': 'off',
11
+ 'no-restricted-imports': [
12
+ 'error',
13
+ {
14
+ patterns: ['@remotion/*/src/*', 'remotion/src/*'],
15
+ paths: ['remotion', 'react', 'react-dom'],
16
+ },
17
+ ],
18
+ },
19
+ ignores: ['src/browser/**'],
20
+ },
21
+ {
22
+ ...config,
23
+ files: ['src/test/**'],
24
+ rules: {
25
+ ...config.rules,
26
+ 'no-restricted-imports': [
27
+ 'error',
28
+ {
29
+ patterns: ['@remotion/*/src/*', 'remotion/src/*'],
30
+ },
31
+ ],
32
+ },
33
+ },
34
+ ];
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/renderer"
4
4
  },
5
5
  "name": "@remotion/renderer",
6
- "version": "4.0.226",
6
+ "version": "4.0.228",
7
7
  "description": "Render Remotion videos using Node.js or Bun",
8
8
  "main": "dist/index.js",
9
9
  "types": "dist/index.d.ts",
@@ -18,8 +18,8 @@
18
18
  "extract-zip": "2.0.1",
19
19
  "source-map": "^0.8.0-beta.0",
20
20
  "ws": "8.17.1",
21
- "remotion": "4.0.226",
22
- "@remotion/streaming": "4.0.226"
21
+ "remotion": "4.0.228",
22
+ "@remotion/streaming": "4.0.228"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": ">=16.8.0",
@@ -31,16 +31,18 @@
31
31
  "@happy-dom/global-registrator": "14.5.1",
32
32
  "react": "18.3.1",
33
33
  "react-dom": "18.3.1",
34
- "@types/ws": "8.5.10"
34
+ "@types/ws": "8.5.10",
35
+ "eslint": "9.14.0",
36
+ "@remotion/eslint-config-internal": "4.0.228"
35
37
  },
36
38
  "optionalDependencies": {
37
- "@remotion/compositor-darwin-arm64": "4.0.226",
38
- "@remotion/compositor-darwin-x64": "4.0.226",
39
- "@remotion/compositor-linux-arm64-gnu": "4.0.226",
40
- "@remotion/compositor-linux-x64-gnu": "4.0.226",
41
- "@remotion/compositor-linux-x64-musl": "4.0.226",
42
- "@remotion/compositor-win32-x64-msvc": "4.0.226",
43
- "@remotion/compositor-linux-arm64-musl": "4.0.226"
39
+ "@remotion/compositor-darwin-x64": "4.0.228",
40
+ "@remotion/compositor-linux-arm64-gnu": "4.0.228",
41
+ "@remotion/compositor-linux-arm64-musl": "4.0.228",
42
+ "@remotion/compositor-linux-x64-gnu": "4.0.228",
43
+ "@remotion/compositor-linux-x64-musl": "4.0.228",
44
+ "@remotion/compositor-win32-x64-msvc": "4.0.228",
45
+ "@remotion/compositor-darwin-arm64": "4.0.228"
44
46
  },
45
47
  "keywords": [
46
48
  "remotion",
@@ -55,9 +57,8 @@
55
57
  "homepage": "https://www.remotion.dev/docs/renderer",
56
58
  "scripts": {
57
59
  "formatting": "prettier src --check",
58
- "lint": "eslint src --ext ts,tsx",
60
+ "lint": "eslint src",
59
61
  "test": "bun test src",
60
- "make": "bun build.ts --debug",
61
- "build-all": "bun build.ts --all"
62
+ "make": "tsc -d"
62
63
  }
63
64
  }