@remotion/renderer 3.2.3 → 3.2.8

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.
@@ -0,0 +1,10 @@
1
+ import type { TCaption } from 'remotion';
2
+ interface CaptionFfmpegInputs {
3
+ captionFilters: string[];
4
+ captionInputs: [string, string][];
5
+ }
6
+ export declare const captionsToFfmpegInputs: ({ assetsCount, captions, }: {
7
+ assetsCount: number;
8
+ captions: TCaption[][];
9
+ }) => CaptionFfmpegInputs;
10
+ export {};
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.captionsToFfmpegInputs = void 0;
4
+ const captionsToFfmpegInputs = ({ assetsCount, captions, }) => {
5
+ const uniqueCaptions = Object.values(captions.flat(1).reduce((acc, caption) => {
6
+ acc[caption.id] = caption;
7
+ return acc;
8
+ }, {}));
9
+ /**
10
+ * TODO: Support more formats.
11
+ * `mov_text` works for SRT.
12
+ */
13
+ const getFilter = ({ language, title }, index) => {
14
+ return ['-map', `${assetsCount + 1 + index}:s`, '-c:s', 'mov_text'].concat(language ? [`-metadata:s:s:${index}`, `language=${language}`] : '', title ? [`-metadata:s:s:${index}`, `title=${title}`] : '');
15
+ };
16
+ return {
17
+ captionInputs: uniqueCaptions.map((caption) => ['-i', caption.src]),
18
+ captionFilters: uniqueCaptions.reduce((acc, caption, i) => acc.concat(getFilter(caption, i)), []),
19
+ };
20
+ };
21
+ exports.captionsToFfmpegInputs = captionsToFfmpegInputs;
@@ -1,2 +1,2 @@
1
1
  import type { Codec } from './codec';
2
- export declare const getFileExtensionFromCodec: (codec: Codec, type: 'chunk' | 'final') => "mp3" | "aac" | "wav" | "gif" | "mp4" | "mkv" | "mov" | "webm";
2
+ export declare const getFileExtensionFromCodec: (codec: Codec, type: 'chunk' | 'final') => "mp3" | "aac" | "wav" | "gif" | "webm" | "mp4" | "mov" | "mkv";
@@ -1 +1 @@
1
- export declare const guessExtensionForVideo: (src: string) => Promise<"mp3" | "wav" | "mp4" | "webm">;
1
+ export declare const guessExtensionForVideo: (src: string) => Promise<"mp3" | "wav" | "webm" | "mp4">;
package/dist/index.d.ts CHANGED
@@ -68,7 +68,7 @@ export declare const RenderInternals: {
68
68
  task: Promise<Buffer | null>;
69
69
  getLogs: () => string;
70
70
  }>;
71
- getFileExtensionFromCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif", type: "chunk" | "final") => "mp3" | "aac" | "wav" | "gif" | "mp4" | "mkv" | "mov" | "webm";
71
+ getFileExtensionFromCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif", type: "chunk" | "final") => "mp3" | "aac" | "wav" | "gif" | "webm" | "mp4" | "mov" | "mkv";
72
72
  tmpDir: (str: string) => string;
73
73
  deleteDirectory: (directory: string) => Promise<void>;
74
74
  isServeUrl: (potentialUrl: string) => boolean;
@@ -123,8 +123,8 @@ export declare const RenderInternals: {
123
123
  validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
124
124
  DEFAULT_BROWSER: import("./browser").Browser;
125
125
  validateFrameRange: (frameRange: import("./frame-range").FrameRange | null) => void;
126
- DEFAULT_OPENGL_RENDERER: "swangle" | "angle" | "egl" | "swiftshader" | null;
127
- validateOpenGlRenderer: (option: "swangle" | "angle" | "egl" | "swiftshader" | null) => "swangle" | "angle" | "egl" | "swiftshader" | null;
126
+ DEFAULT_OPENGL_RENDERER: "angle" | "swangle" | "egl" | "swiftshader" | null;
127
+ validateOpenGlRenderer: (option: "angle" | "swangle" | "egl" | "swiftshader" | null) => "angle" | "swangle" | "egl" | "swiftshader" | null;
128
128
  getDefaultCrfForCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => number;
129
129
  validateSelectedCrfAndCodecCombination: (crf: unknown, codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => void;
130
130
  validImageFormats: readonly ["png", "jpeg", "none"];
@@ -136,12 +136,12 @@ export declare const RenderInternals: {
136
136
  DEFAULT_TIMEOUT: number;
137
137
  getValidCrfRanges: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => [number, number];
138
138
  validateSelectedPixelFormatAndCodecCombination: (pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le", codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => void;
139
- validateSelectedCodecAndProResCombination: (actualCodec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif", actualProResProfile: "4444-xq" | "4444" | "hq" | "standard" | "light" | "proxy" | undefined) => void;
140
- validateSelectedPixelFormatAndImageFormatCombination: (pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le", imageFormat: "none" | "png" | "jpeg") => "none" | "valid";
139
+ validateSelectedCodecAndProResCombination: (actualCodec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif", actualProResProfile: "proxy" | "4444-xq" | "4444" | "hq" | "standard" | "light" | undefined) => void;
140
+ validateSelectedPixelFormatAndImageFormatCombination: (pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le", imageFormat: "jpeg" | "png" | "none") => "none" | "valid";
141
141
  DEFAULT_CODEC: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
142
142
  isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif" | undefined) => boolean;
143
143
  logLevels: readonly ["verbose", "info", "warn", "error"];
144
- isEqualOrBelowLogLevel: (currentLevel: "verbose" | "error" | "info" | "warn", level: "verbose" | "error" | "info" | "warn") => boolean;
144
+ isEqualOrBelowLogLevel: (currentLevel: "error" | "verbose" | "info" | "warn", level: "error" | "verbose" | "info" | "warn") => boolean;
145
145
  isValidLogLevel: (level: string) => boolean;
146
146
  validateEveryNthFrame: (everyNthFrame: unknown) => void;
147
147
  perf: typeof perf;
@@ -65,4 +65,4 @@ export declare type RenderMediaOptions = {
65
65
  * @description Render a video from a composition
66
66
  * @link https://www.remotion.dev/docs/renderer/render-media
67
67
  */
68
- export declare const renderMedia: ({ parallelism, proResProfile, crf, composition, imageFormat, ffmpegExecutable, ffprobeExecutable, inputProps, pixelFormat, codec, envVariables, quality, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, dumpBrowserLogs, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ...options }: RenderMediaOptions) => Promise<Buffer | null>;
68
+ export declare const renderMedia: ({ parallelism, proResProfile, crf, composition, ffmpegExecutable, ffprobeExecutable, inputProps, pixelFormat, codec, envVariables, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, dumpBrowserLogs, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ...options }: RenderMediaOptions) => Promise<Buffer | null>;
@@ -19,6 +19,7 @@ const get_duration_from_frame_range_1 = require("./get-duration-from-frame-range
19
19
  const get_extension_from_codec_1 = require("./get-extension-from-codec");
20
20
  const get_extension_of_filename_1 = require("./get-extension-of-filename");
21
21
  const get_frame_to_render_1 = require("./get-frame-to-render");
22
+ const is_audio_codec_1 = require("./is-audio-codec");
22
23
  const legacy_webpack_config_1 = require("./legacy-webpack-config");
23
24
  const make_cancel_signal_1 = require("./make-cancel-signal");
24
25
  const overwrite_1 = require("./overwrite");
@@ -36,9 +37,9 @@ const validate_scale_1 = require("./validate-scale");
36
37
  * @description Render a video from a composition
37
38
  * @link https://www.remotion.dev/docs/renderer/render-media
38
39
  */
39
- const renderMedia = ({ parallelism, proResProfile, crf, composition, imageFormat, ffmpegExecutable, ffprobeExecutable, inputProps, pixelFormat, codec, envVariables, quality, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, dumpBrowserLogs, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ...options }) => {
40
- var _a, _b, _c;
41
- (0, quality_1.validateQuality)(quality);
40
+ const renderMedia = ({ parallelism, proResProfile, crf, composition, ffmpegExecutable, ffprobeExecutable, inputProps, pixelFormat, codec, envVariables, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, dumpBrowserLogs, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ...options }) => {
41
+ var _a, _b, _c, _d;
42
+ (0, quality_1.validateQuality)(options.quality);
42
43
  if (typeof crf !== 'undefined' && crf !== null) {
43
44
  (0, crf_1.validateSelectedCrfAndCodecCombination)(crf, codec);
44
45
  }
@@ -74,7 +75,10 @@ const renderMedia = ({ parallelism, proResProfile, crf, composition, imageFormat
74
75
  console.log('[PRESTITCHER] Parallel encoding is disabled.');
75
76
  }
76
77
  }
77
- const actualImageFormat = imageFormat !== null && imageFormat !== void 0 ? imageFormat : 'jpeg';
78
+ const imageFormat = (0, is_audio_codec_1.isAudioCodec)(codec)
79
+ ? 'none'
80
+ : (_d = options.imageFormat) !== null && _d !== void 0 ? _d : 'jpeg';
81
+ const quality = imageFormat === 'jpeg' ? options.quality : undefined;
78
82
  const preEncodedFileLocation = parallelEncoding
79
83
  ? path_1.default.join(downloadMap.preEncode, 'pre-encode.' + (0, get_extension_from_codec_1.getFileExtensionFromCodec)(codec, 'chunk'))
80
84
  : null;
@@ -124,7 +128,7 @@ const renderMedia = ({ parallelism, proResProfile, crf, composition, imageFormat
124
128
  },
125
129
  verbose: (_a = options.verbose) !== null && _a !== void 0 ? _a : false,
126
130
  ffmpegExecutable,
127
- imageFormat: actualImageFormat,
131
+ imageFormat,
128
132
  signal: cancelPrestitcher.cancelSignal,
129
133
  });
130
134
  stitcherFfmpeg = preStitcher.task;
@@ -162,7 +166,7 @@ const renderMedia = ({ parallelism, proResProfile, crf, composition, imageFormat
162
166
  },
163
167
  inputProps,
164
168
  envVariables,
165
- imageFormat: actualImageFormat,
169
+ imageFormat,
166
170
  quality,
167
171
  frameRange: frameRange !== null && frameRange !== void 0 ? frameRange : null,
168
172
  puppeteerInstance,
@@ -215,7 +219,7 @@ const renderMedia = ({ parallelism, proResProfile, crf, composition, imageFormat
215
219
  outputLocation,
216
220
  internalOptions: {
217
221
  preEncodedFileLocation,
218
- imageFormat: actualImageFormat,
222
+ imageFormat,
219
223
  },
220
224
  force: overwrite !== null && overwrite !== void 0 ? overwrite : overwrite_1.DEFAULT_OVERWRITE,
221
225
  pixelFormat,
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setPropsAndEnv = void 0;
4
+ const version_1 = require("remotion/version");
4
5
  const TimeoutSettings_1 = require("./browser/TimeoutSettings");
5
6
  const normalize_serve_url_1 = require("./normalize-serve-url");
6
7
  const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
@@ -90,9 +91,25 @@ const setPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, initia
90
91
  frame: null,
91
92
  page,
92
93
  });
94
+ const remotionVersion = await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
95
+ pageFunction: () => {
96
+ return window.remotion_version;
97
+ },
98
+ args: [],
99
+ frame: null,
100
+ page,
101
+ });
93
102
  const requiredVersion = '4';
94
103
  if (siteVersion !== requiredVersion) {
95
104
  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.`);
96
105
  }
106
+ if (remotionVersion !== version_1.VERSION) {
107
+ if (remotionVersion) {
108
+ console.warn(`The site was bundled with version ${remotionVersion} of @remotion/bundler, while @remotion/renderer is on version ${version_1.VERSION}. You may not have the newest bugfixes and features. Re-bundle the site to fix this issue.`);
109
+ }
110
+ else {
111
+ console.warn(`The site was bundled with an old version of Remotion, while @remotion/renderer is on version ${version_1.VERSION}. You may not have the newest bugfixes and features. Re-bundle the site to fix this issue.`);
112
+ }
113
+ }
97
114
  };
98
115
  exports.setPropsAndEnv = setPropsAndEnv;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "3.2.3",
3
+ "version": "3.2.8",
4
4
  "description": "Renderer for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,7 +22,7 @@
22
22
  "dependencies": {
23
23
  "execa": "5.1.1",
24
24
  "extract-zip": "2.0.1",
25
- "remotion": "3.2.3",
25
+ "remotion": "3.2.8",
26
26
  "source-map": "^0.8.0-beta.0",
27
27
  "ws": "8.7.0"
28
28
  },
@@ -57,5 +57,5 @@
57
57
  "publishConfig": {
58
58
  "access": "public"
59
59
  },
60
- "gitHead": "15773a2e48ee8a9dbcfd898520cb914396c21eb1"
60
+ "gitHead": "7ccde3ec3f4adecd5fb7188d9d2933435bba5743"
61
61
  }