@remotion/renderer 4.0.152 → 4.0.154

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.
package/dist/client.d.ts CHANGED
@@ -467,19 +467,19 @@ export declare const BrowserSafeApis: {
467
467
  cliFlag: "gl";
468
468
  docLink: string;
469
469
  name: string;
470
- type: "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
470
+ type: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
471
471
  ssrName: string;
472
472
  description: () => import("react/jsx-runtime").JSX.Element;
473
473
  getValue: ({ commandLine }: {
474
474
  commandLine: Record<string, unknown>;
475
475
  }) => {
476
- value: "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl";
476
+ value: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl";
477
477
  source: string;
478
478
  } | {
479
479
  value: null;
480
480
  source: string;
481
481
  };
482
- setConfig: (value: "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null) => void;
482
+ setConfig: (value: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null) => void;
483
483
  };
484
484
  enableLambdaInsights: {
485
485
  name: string;
package/dist/index.d.ts CHANGED
@@ -140,8 +140,8 @@ export declare const RenderInternals: {
140
140
  validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
141
141
  DEFAULT_BROWSER: "chrome";
142
142
  validateFrameRange: (frameRange: import("./frame-range").FrameRange | null) => void;
143
- DEFAULT_OPENGL_RENDERER: "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
144
- validateOpenGlRenderer: (option: unknown) => "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
143
+ DEFAULT_OPENGL_RENDERER: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
144
+ validateOpenGlRenderer: (option: unknown) => "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
145
145
  validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "h264-ts", "gif"];
146
146
  DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
147
147
  validateJpegQuality: (q: unknown) => void;
@@ -337,7 +337,7 @@ export declare const RenderInternals: {
337
337
  makeFileExtensionMap: () => Record<string, ("h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif")[]>;
338
338
  defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif">;
339
339
  getExecutablePath: ({ indent, logLevel, type, binariesDirectory, }: {
340
- type: "compositor" | "ffmpeg" | "ffprobe";
340
+ type: "ffmpeg" | "ffprobe" | "compositor";
341
341
  indent: boolean;
342
342
  logLevel: "verbose" | "info" | "warn" | "error";
343
343
  binariesDirectory: string | null;
@@ -353,8 +353,8 @@ export declare const RenderInternals: {
353
353
  }) => execa.ExecaChildProcess<string>;
354
354
  validStillImageFormats: readonly ["png", "jpeg", "pdf", "webp"];
355
355
  validVideoImageFormats: readonly ["png", "jpeg", "none"];
356
- DEFAULT_STILL_IMAGE_FORMAT: "png" | "jpeg" | "pdf" | "webp";
357
- DEFAULT_VIDEO_IMAGE_FORMAT: "png" | "jpeg" | "none";
356
+ DEFAULT_STILL_IMAGE_FORMAT: "jpeg" | "png" | "webp" | "pdf";
357
+ DEFAULT_VIDEO_IMAGE_FORMAT: "jpeg" | "png" | "none";
358
358
  DEFAULT_JPEG_QUALITY: number;
359
359
  chalk: {
360
360
  enabled: () => boolean;
@@ -453,7 +453,7 @@ export declare const RenderInternals: {
453
453
  frame: number;
454
454
  serializedInputPropsWithCustomSchema: string;
455
455
  serializedResolvedPropsWithCustomSchema: string;
456
- imageFormat: "png" | "jpeg" | "pdf" | "webp";
456
+ imageFormat: "jpeg" | "png" | "webp" | "pdf";
457
457
  jpegQuality: number;
458
458
  puppeteerInstance: HeadlessBrowser | null;
459
459
  envVariables: Record<string, string>;
@@ -820,24 +820,4 @@ export declare const RenderInternals: {
820
820
  setConfig: () => never;
821
821
  };
822
822
  }>) => Promise<import("./ensure-browser").BrowserStatus>;
823
- exampleVideos: {
824
- bigBuckBunny: string;
825
- transparentWebm: string;
826
- framerWithoutFileExtension: string;
827
- corrupted: string;
828
- customDar: string;
829
- screenrecording: string;
830
- nofps: string;
831
- variablefps: string;
832
- zerotimestamp: string;
833
- webcam: string;
834
- iphonevideo: string;
835
- av1: string;
836
- framer24fps: string;
837
- music: string;
838
- notavideo: string;
839
- notafile: string;
840
- transparentwithdar: string;
841
- iphonehevc: string;
842
- };
843
823
  };
package/dist/index.js CHANGED
@@ -115,7 +115,6 @@ const make_file_executable_1 = require("./compositor/make-file-executable");
115
115
  const ensure_browser_2 = require("./ensure-browser");
116
116
  const audio_codec_1 = require("./options/audio-codec");
117
117
  const render_has_audio_1 = require("./render-has-audio");
118
- const example_videos_1 = require("./test/example-videos");
119
118
  const to_megabytes_1 = require("./to-megabytes");
120
119
  const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
121
120
  const validate_videobitrate_1 = require("./validate-videobitrate");
@@ -206,7 +205,6 @@ exports.RenderInternals = {
206
205
  codecSupportsMedia: codec_supports_media_1.codecSupportsMedia,
207
206
  toMegabytes: to_megabytes_1.toMegabytes,
208
207
  internalEnsureBrowser: ensure_browser_2.internalEnsureBrowser,
209
- exampleVideos: example_videos_1.exampleVideos,
210
208
  };
211
209
  // Warn of potential performance issues with Apple Silicon (M1 chip under Rosetta)
212
210
  (0, check_version_requirements_1.checkRuntimeVersion)('info', false);
@@ -74,12 +74,6 @@ const startOffthreadVideoServer = ({ downloadMap, concurrency, logLevel, indent,
74
74
  }
75
75
  const { src, time, transparent, toneMapped } = (0, exports.extractUrlAndSourceFromUrl)(req.url);
76
76
  response.setHeader('access-control-allow-origin', '*');
77
- if (transparent) {
78
- response.setHeader('content-type', `image/png`);
79
- }
80
- else {
81
- response.setHeader('content-type', `image/bmp`);
82
- }
83
77
  // Prevent caching of the response and excessive disk writes
84
78
  // https://github.com/remotion-dev/remotion/issues/2760
85
79
  response.setHeader('cache-control', 'no-cache, no-store, must-revalidate');
@@ -134,6 +128,21 @@ const startOffthreadVideoServer = ({ downloadMap, concurrency, logLevel, indent,
134
128
  if (timeToExtract > 1000) {
135
129
  logger_1.Log.verbose({ indent, logLevel }, `Took ${timeToExtract}ms to extract frame from ${src} at ${time}`);
136
130
  }
131
+ const firstByte = readable.at(0);
132
+ const secondByte = readable.at(1);
133
+ const thirdByte = readable.at(2);
134
+ const isPng = firstByte === 0x89 && secondByte === 0x50 && thirdByte === 0x4e;
135
+ const isBmp = firstByte === 0x42 && secondByte === 0x4d;
136
+ if (isPng) {
137
+ response.setHeader('content-type', `image/png`);
138
+ }
139
+ else if (isBmp) {
140
+ response.setHeader('content-type', `image/bmp`);
141
+ }
142
+ else {
143
+ reject(new Error(`Unknown file type: ${firstByte} ${secondByte} ${thirdByte}`));
144
+ return;
145
+ }
137
146
  response.writeHead(200);
138
147
  response.write(readable, (err) => {
139
148
  response.end();
@@ -1,19 +1,19 @@
1
1
  export declare const validOpenGlRenderers: readonly ["swangle", "angle", "egl", "swiftshader", "vulkan", "angle-egl"];
2
2
  export type OpenGlRenderer = (typeof validOpenGlRenderers)[number];
3
3
  export declare const DEFAULT_OPENGL_RENDERER: OpenGlRenderer | null;
4
- export declare const getChromiumOpenGlRenderer: () => "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
4
+ export declare const getChromiumOpenGlRenderer: () => "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
5
5
  export declare const setChromiumOpenGlRenderer: (renderer: OpenGlRenderer) => void;
6
6
  export declare const glOption: {
7
7
  cliFlag: "gl";
8
8
  docLink: string;
9
9
  name: string;
10
- type: "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
10
+ type: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
11
11
  ssrName: string;
12
12
  description: () => import("react/jsx-runtime").JSX.Element;
13
13
  getValue: ({ commandLine }: {
14
14
  commandLine: Record<string, unknown>;
15
15
  }) => {
16
- value: "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl";
16
+ value: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl";
17
17
  source: string;
18
18
  } | {
19
19
  value: null;
@@ -245,19 +245,19 @@ export declare const allOptions: {
245
245
  cliFlag: "gl";
246
246
  docLink: string;
247
247
  name: string;
248
- type: "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
248
+ type: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
249
249
  ssrName: string;
250
250
  description: () => import("react/jsx-runtime").JSX.Element;
251
251
  getValue: ({ commandLine }: {
252
252
  commandLine: Record<string, unknown>;
253
253
  }) => {
254
- value: "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl";
254
+ value: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl";
255
255
  source: string;
256
256
  } | {
257
257
  value: null;
258
258
  source: string;
259
259
  };
260
- setConfig: (value: "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null) => void;
260
+ setConfig: (value: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null) => void;
261
261
  };
262
262
  enableLambdaInsights: {
263
263
  name: string;
@@ -7,12 +7,16 @@ export type ProcessedTrack = {
7
7
  pad_start: string | null;
8
8
  pad_end: string | null;
9
9
  };
10
- export declare const getActualTrimLeft: ({ asset, fps, trimLeftOffset, seamless, }: {
10
+ export declare const getActualTrimLeft: ({ asset, fps, trimLeftOffset, seamless, assetDuration, }: {
11
11
  asset: MediaAsset;
12
12
  fps: number;
13
13
  trimLeftOffset: number;
14
14
  seamless: boolean;
15
- }) => number;
15
+ assetDuration: number | null;
16
+ }) => {
17
+ trimLeft: number;
18
+ maxTrim: number | null;
19
+ };
16
20
  export declare const stringifyFfmpegFilter: ({ channels, volume, fps, assetDuration, chunkLengthInSeconds, forSeamlessAacConcatenation, trimLeftOffset, trimRightOffset, asset, indent, logLevel, }: {
17
21
  channels: number;
18
22
  volume: AssetVolume;
@@ -15,17 +15,23 @@ const stringifyTrim = (trim) => {
15
15
  }
16
16
  return asString;
17
17
  };
18
- const getActualTrimLeft = ({ asset, fps, trimLeftOffset, seamless, }) => {
18
+ const getActualTrimLeft = ({ asset, fps, trimLeftOffset, seamless, assetDuration, }) => {
19
19
  const sinceStart = asset.trimLeft - asset.audioStartFrame;
20
20
  if (!seamless) {
21
- return (asset.audioStartFrame / fps +
22
- (sinceStart / fps) * asset.playbackRate +
23
- trimLeftOffset);
21
+ return {
22
+ trimLeft: asset.audioStartFrame / fps +
23
+ (sinceStart / fps) * asset.playbackRate +
24
+ trimLeftOffset,
25
+ maxTrim: assetDuration,
26
+ };
24
27
  }
25
28
  if (seamless) {
26
- return (asset.audioStartFrame / fps / asset.playbackRate +
27
- sinceStart / fps +
28
- trimLeftOffset);
29
+ return {
30
+ trimLeft: asset.audioStartFrame / fps / asset.playbackRate +
31
+ sinceStart / fps +
32
+ trimLeftOffset,
33
+ maxTrim: assetDuration ? assetDuration / asset.playbackRate : null,
34
+ };
29
35
  }
30
36
  throw new Error('This should never happen');
31
37
  };
@@ -36,15 +42,16 @@ const trimAndSetTempo = ({ forSeamlessAacConcatenation, assetDuration, asset, tr
36
42
  // and the offset needs to be the same for all audio tracks, before processing it further.
37
43
  // This also affects the trimLeft and trimRight values, as they need to be adjusted.
38
44
  if (forSeamlessAacConcatenation) {
39
- const trimLeft = (0, exports.getActualTrimLeft)({
45
+ const { trimLeft, maxTrim } = (0, exports.getActualTrimLeft)({
40
46
  asset,
41
47
  fps,
42
48
  trimLeftOffset,
43
49
  seamless: true,
50
+ assetDuration,
44
51
  });
45
52
  const trimRight = trimLeft + asset.duration / fps - trimLeftOffset + trimRightOffset;
46
- let trimRightOrAssetDuration = assetDuration
47
- ? Math.min(trimRight, assetDuration / asset.playbackRate)
53
+ let trimRightOrAssetDuration = maxTrim
54
+ ? Math.min(trimRight, maxTrim)
48
55
  : trimRight;
49
56
  if (trimRightOrAssetDuration < trimLeft) {
50
57
  logger_1.Log.warn({ indent, logLevel }, 'trimRightOrAssetDuration < trimLeft: ' +
@@ -68,15 +75,16 @@ const trimAndSetTempo = ({ forSeamlessAacConcatenation, assetDuration, asset, tr
68
75
  // Otherwise, we first trim and then apply playback rate, as then the atempo
69
76
  // filter needs to do less work.
70
77
  if (!forSeamlessAacConcatenation) {
71
- const actualTrimLeft = (0, exports.getActualTrimLeft)({
78
+ const { trimLeft: actualTrimLeft, maxTrim } = (0, exports.getActualTrimLeft)({
72
79
  asset,
73
80
  fps,
74
81
  trimLeftOffset,
75
82
  seamless: false,
83
+ assetDuration,
76
84
  });
77
85
  const trimRight = actualTrimLeft + (asset.duration / fps) * asset.playbackRate;
78
- const trimRightOrAssetDuration = assetDuration
79
- ? Math.min(trimRight, assetDuration)
86
+ const trimRightOrAssetDuration = maxTrim
87
+ ? Math.min(trimRight, maxTrim)
80
88
  : trimRight;
81
89
  return {
82
90
  filter: [
@@ -93,16 +101,16 @@ const stringifyFfmpegFilter = ({ channels, volume, fps, assetDuration, chunkLeng
93
101
  if (channels === 0) {
94
102
  return null;
95
103
  }
96
- const { toneFrequency, startInVideo, playbackRate } = asset;
104
+ const { toneFrequency, startInVideo } = asset;
97
105
  const startInVideoSeconds = startInVideo / fps;
98
- if (assetDuration &&
99
- (0, exports.getActualTrimLeft)({
100
- asset,
101
- fps,
102
- trimLeftOffset,
103
- seamless: forSeamlessAacConcatenation,
104
- }) >=
105
- assetDuration / playbackRate) {
106
+ const { trimLeft, maxTrim } = (0, exports.getActualTrimLeft)({
107
+ asset,
108
+ fps,
109
+ trimLeftOffset,
110
+ seamless: forSeamlessAacConcatenation,
111
+ assetDuration,
112
+ });
113
+ if (maxTrim && trimLeft >= maxTrim) {
106
114
  return null;
107
115
  }
108
116
  if (toneFrequency !== null && (toneFrequency <= 0 || toneFrequency > 2)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "4.0.152",
3
+ "version": "4.0.154",
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.0.152"
21
+ "remotion": "4.0.154"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": ">=16.8.0",
@@ -43,13 +43,13 @@
43
43
  "@types/ws": "8.5.10"
44
44
  },
45
45
  "optionalDependencies": {
46
- "@remotion/compositor-darwin-arm64": "4.0.152",
47
- "@remotion/compositor-linux-x64-gnu": "4.0.152",
48
- "@remotion/compositor-darwin-x64": "4.0.152",
49
- "@remotion/compositor-win32-x64-msvc": "4.0.152",
50
- "@remotion/compositor-linux-arm64-gnu": "4.0.152",
51
- "@remotion/compositor-linux-x64-musl": "4.0.152",
52
- "@remotion/compositor-linux-arm64-musl": "4.0.152"
46
+ "@remotion/compositor-linux-arm64-gnu": "4.0.154",
47
+ "@remotion/compositor-linux-arm64-musl": "4.0.154",
48
+ "@remotion/compositor-darwin-arm64": "4.0.154",
49
+ "@remotion/compositor-darwin-x64": "4.0.154",
50
+ "@remotion/compositor-linux-x64-gnu": "4.0.154",
51
+ "@remotion/compositor-linux-x64-musl": "4.0.154",
52
+ "@remotion/compositor-win32-x64-msvc": "4.0.154"
53
53
  },
54
54
  "keywords": [
55
55
  "remotion",