@remotion/renderer 4.0.298 → 4.0.301

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.
@@ -123,7 +123,11 @@ class Page extends EventEmitter_1.EventEmitter {
123
123
  }
124
124
  else if (log.type === 'error') {
125
125
  if (log.text.includes('Failed to load resource:')) {
126
- logger_1.Log.error({ logLevel, tag: url, indent }, log.text);
126
+ logger_1.Log.error({ logLevel, tag: url, indent },
127
+ // Sometimes the log is like this:
128
+ // Failed to load resource: the server responded with a status of 404 ()
129
+ // We remove the empty parentheses.
130
+ log.text.replace(/\(\)$/, ''));
127
131
  }
128
132
  else {
129
133
  logger_1.Log.error({ logLevel, tag: `console.${log.type}`, indent }, log.text);
@@ -2834,7 +2834,7 @@ class Page extends EventEmitter {
2834
2834
  }
2835
2835
  } else if (log.type === "error") {
2836
2836
  if (log.text.includes("Failed to load resource:")) {
2837
- Log.error({ logLevel, tag: url, indent }, log.text);
2837
+ Log.error({ logLevel, tag: url, indent }, log.text.replace(/\(\)$/, ""));
2838
2838
  } else {
2839
2839
  Log.error({ logLevel, tag: `console.${log.type}`, indent }, log.text);
2840
2840
  }
@@ -20271,7 +20271,7 @@ var stringifyFfmpegFilter = ({
20271
20271
  trimLeft: actualTrimLeft
20272
20272
  });
20273
20273
  const padAtEnd = chunkLengthInSeconds - audibleDuration - startInVideoSeconds;
20274
- const padStart = startInVideoSeconds + presentationTimeOffsetInSeconds;
20274
+ const padStart = startInVideoSeconds + (asset.trimLeft === 0 ? presentationTimeOffsetInSeconds : 0);
20275
20275
  return {
20276
20276
  filter: `[0:a]` + [
20277
20277
  `aformat=sample_fmts=s32:sample_rates=${DEFAULT_SAMPLE_RATE}`,
@@ -114,7 +114,8 @@ const stringifyFfmpegFilter = ({ channels, volume, fps, assetDuration, chunkLeng
114
114
  trimLeft: actualTrimLeft,
115
115
  });
116
116
  const padAtEnd = chunkLengthInSeconds - audibleDuration - startInVideoSeconds;
117
- const padStart = startInVideoSeconds + presentationTimeOffsetInSeconds;
117
+ const padStart = startInVideoSeconds +
118
+ (asset.trimLeft === 0 ? presentationTimeOffsetInSeconds : 0);
118
119
  // Set as few filters as possible, as combining them can create noise
119
120
  return {
120
121
  filter: `[0:a]` +
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.298",
6
+ "version": "4.0.301",
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.298",
22
- "@remotion/streaming": "4.0.298"
21
+ "@remotion/streaming": "4.0.301",
22
+ "remotion": "4.0.301"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": ">=16.8.0",
@@ -33,17 +33,17 @@
33
33
  "react-dom": "19.0.0",
34
34
  "@types/ws": "8.5.10",
35
35
  "eslint": "9.19.0",
36
- "@remotion/example-videos": "4.0.298",
37
- "@remotion/eslint-config-internal": "4.0.298"
36
+ "@remotion/example-videos": "4.0.301",
37
+ "@remotion/eslint-config-internal": "4.0.301"
38
38
  },
39
39
  "optionalDependencies": {
40
- "@remotion/compositor-darwin-x64": "4.0.298",
41
- "@remotion/compositor-darwin-arm64": "4.0.298",
42
- "@remotion/compositor-linux-arm64-musl": "4.0.298",
43
- "@remotion/compositor-linux-arm64-gnu": "4.0.298",
44
- "@remotion/compositor-linux-x64-gnu": "4.0.298",
45
- "@remotion/compositor-linux-x64-musl": "4.0.298",
46
- "@remotion/compositor-win32-x64-msvc": "4.0.298"
40
+ "@remotion/compositor-darwin-arm64": "4.0.301",
41
+ "@remotion/compositor-darwin-x64": "4.0.301",
42
+ "@remotion/compositor-linux-arm64-musl": "4.0.301",
43
+ "@remotion/compositor-linux-arm64-gnu": "4.0.301",
44
+ "@remotion/compositor-linux-x64-gnu": "4.0.301",
45
+ "@remotion/compositor-win32-x64-msvc": "4.0.301",
46
+ "@remotion/compositor-linux-x64-musl": "4.0.301"
47
47
  },
48
48
  "keywords": [
49
49
  "remotion",
@@ -1,6 +0,0 @@
1
- export type DownloadBehavior = {
2
- type: 'play-in-browser';
3
- } | {
4
- type: 'download';
5
- fileName: string | null;
6
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +0,0 @@
1
- import type { LogLevel } from './log-level';
2
- export declare const maxLambdaMemory: () => number;
3
- export declare const getAvailableMemory: (logLevel: LogLevel) => number;
@@ -1,58 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAvailableMemory = exports.maxLambdaMemory = void 0;
4
- const node_fs_1 = require("node:fs");
5
- const node_os_1 = require("node:os");
6
- const logger_1 = require("./logger");
7
- const getFreeMemoryFromProcMeminfo = () => {
8
- const data = (0, node_fs_1.readFileSync)('/proc/meminfo', 'utf-8');
9
- // Split the file by lines and find the line with MemFree
10
- const lines = data.split('\n');
11
- const memAvailableLine = lines.find((line) => line.startsWith('MemAvailable'));
12
- // If we couldn't find MemAvailable, return an error
13
- if (!memAvailableLine) {
14
- throw new Error('MemAvailable not found in /proc/meminfo');
15
- }
16
- // Extract the value and unit from the line
17
- const matches = memAvailableLine.match(/(\d+)\s+(\w+)/);
18
- if (!matches || matches.length !== 3) {
19
- throw new Error('Failed to parse MemAvailable value');
20
- }
21
- const value = parseInt(matches[1], 10);
22
- const unit = matches[2].toLowerCase();
23
- // Convert the value to bytes based on its unit
24
- switch (unit) {
25
- case 'kb':
26
- return value * 1024;
27
- case 'mb':
28
- return value * 1024 * 1024;
29
- case 'gb':
30
- return value * 1024 * 1024 * 1024;
31
- default:
32
- throw new Error(`Unknown unit: ${unit}`);
33
- }
34
- };
35
- const maxLambdaMemory = () => {
36
- if (process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE) {
37
- return (parseInt(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE, 10) * 1024 * 1024);
38
- }
39
- return Infinity;
40
- };
41
- exports.maxLambdaMemory = maxLambdaMemory;
42
- const getAvailableMemory = (logLevel) => {
43
- const maxMemory = (0, exports.maxLambdaMemory)();
44
- if ((0, node_fs_1.existsSync)('/proc/meminfo')) {
45
- try {
46
- const val = getFreeMemoryFromProcMeminfo();
47
- if (val !== null) {
48
- return Math.min(val, maxMemory);
49
- }
50
- }
51
- catch (err) {
52
- logger_1.Log.warn({ indent: false, logLevel }, 'Tried to get available memory from /proc/meminfo but failed. Falling back to os.freemem(). Error:');
53
- logger_1.Log.warn({ indent: false, logLevel }, err);
54
- }
55
- }
56
- return Math.min((0, node_os_1.freemem)(), maxMemory);
57
- };
58
- exports.getAvailableMemory = getAvailableMemory;
@@ -1,15 +0,0 @@
1
- import type { Page } from './browser/BrowserPage';
2
- import type { StillImageFormat } from './image-format';
3
- export declare const provideScreenshot: ({ page, imageFormat, options, jpegQuality, height, width, timeoutInMilliseconds, scale, }: {
4
- page: Page;
5
- imageFormat: StillImageFormat;
6
- jpegQuality: number | undefined;
7
- options: {
8
- frame: number;
9
- output: string | null;
10
- };
11
- height: number;
12
- width: number;
13
- timeoutInMilliseconds: number;
14
- scale: number;
15
- }) => Promise<Buffer>;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.provideScreenshot = void 0;
4
- const screenshot_dom_element_1 = require("./screenshot-dom-element");
5
- const provideScreenshot = ({ page, imageFormat, options, jpegQuality, height, width, timeoutInMilliseconds, scale, }) => {
6
- return (0, screenshot_dom_element_1.screenshotDOMElement)({
7
- page,
8
- opts: {
9
- path: options.output,
10
- },
11
- imageFormat,
12
- jpegQuality,
13
- height,
14
- width,
15
- timeoutInMilliseconds,
16
- scale,
17
- });
18
- };
19
- exports.provideScreenshot = provideScreenshot;
@@ -1,14 +0,0 @@
1
- import type { Page } from './browser/BrowserPage';
2
- import type { StillImageFormat } from './image-format';
3
- export declare const screenshotDOMElement: ({ page, imageFormat, jpegQuality, opts, height, width, timeoutInMilliseconds, scale, }: {
4
- page: Page;
5
- imageFormat: StillImageFormat;
6
- jpegQuality: number | undefined;
7
- opts: {
8
- path: string | null;
9
- };
10
- height: number;
11
- width: number;
12
- timeoutInMilliseconds: number;
13
- scale: number;
14
- }) => Promise<Buffer>;
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.screenshotDOMElement = void 0;
4
- const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
5
- const puppeteer_screenshot_1 = require("./puppeteer-screenshot");
6
- const screenshotDOMElement = async ({ page, imageFormat, jpegQuality, opts, height, width, timeoutInMilliseconds, scale, }) => {
7
- const { path } = opts;
8
- if (imageFormat === 'png' ||
9
- imageFormat === 'pdf' ||
10
- imageFormat === 'webp') {
11
- await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
12
- pageFunction: () => {
13
- document.body.style.background = 'transparent';
14
- },
15
- args: [],
16
- frame: null,
17
- page,
18
- timeoutInMilliseconds,
19
- });
20
- }
21
- else {
22
- await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
23
- pageFunction: () => {
24
- document.body.style.background = 'black';
25
- },
26
- args: [],
27
- frame: null,
28
- page,
29
- timeoutInMilliseconds,
30
- });
31
- }
32
- // @ts-expect-error
33
- if (imageFormat === 'none') {
34
- throw new TypeError('Tried to make a screenshot with format "none"');
35
- }
36
- const buf = await (0, puppeteer_screenshot_1.screenshot)({
37
- page,
38
- omitBackground: imageFormat === 'png',
39
- path: path !== null && path !== void 0 ? path : undefined,
40
- type: imageFormat,
41
- jpegQuality,
42
- width,
43
- height,
44
- scale,
45
- });
46
- if (typeof buf === 'string') {
47
- throw new TypeError('Expected a buffer');
48
- }
49
- return buf;
50
- };
51
- exports.screenshotDOMElement = screenshotDOMElement;