@remotion/renderer 3.2.3 → 3.2.4

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
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import execa from 'execa';
3
2
  import { SymbolicateableError } from './error-handling/symbolicateable-error';
4
3
  import { mimeContentType, mimeLookup } from './mime-types';
@@ -137,7 +136,7 @@ export declare const RenderInternals: {
137
136
  getValidCrfRanges: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => [number, number];
138
137
  validateSelectedPixelFormatAndCodecCombination: (pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le", codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => void;
139
138
  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
+ validateSelectedPixelFormatAndImageFormatCombination: (pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le", imageFormat: "png" | "jpeg" | "none") => "none" | "valid";
141
140
  DEFAULT_CODEC: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
142
141
  isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif" | undefined) => boolean;
143
142
  logLevels: readonly ["verbose", "info", "warn", "error"];
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { SmallTCompMetadata } from 'remotion';
3
2
  import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
4
3
  import type { DownloadMap } from './assets/download-map';
@@ -65,4 +64,4 @@ export declare type RenderMediaOptions = {
65
64
  * @description Render a video from a composition
66
65
  * @link https://www.remotion.dev/docs/renderer/render-media
67
66
  */
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>;
67
+ 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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "3.2.3",
3
+ "version": "3.2.4",
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.4",
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": "ee420b99227e0e5bcf093c108e3695f5d46e3658"
61
61
  }