@remotion/cli 3.3.41 → 3.3.42

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,3 @@
1
+ import type { AudioCodec } from '@remotion/renderer';
2
+ export declare const setAudioCodec: (audioCodec: AudioCodec | null) => void;
3
+ export declare const getAudioCodec: () => "mp3" | "aac" | "pcm-16" | "opus" | null;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAudioCodec = exports.setAudioCodec = void 0;
4
+ const renderer_1 = require("@remotion/renderer");
5
+ let _audioCodec = null;
6
+ const setAudioCodec = (audioCodec) => {
7
+ if (audioCodec === null) {
8
+ _audioCodec = null;
9
+ return;
10
+ }
11
+ if (!renderer_1.RenderInternals.validAudioCodecs.includes(audioCodec)) {
12
+ throw new Error(`Audio codec must be one of the following: ${renderer_1.RenderInternals.validAudioCodecs.join(', ')}, but got ${audioCodec}`);
13
+ }
14
+ _audioCodec = audioCodec;
15
+ };
16
+ exports.setAudioCodec = setAudioCodec;
17
+ const getAudioCodec = () => {
18
+ return _audioCodec;
19
+ };
20
+ exports.getAudioCodec = getAudioCodec;
@@ -27,6 +27,7 @@ export declare const ConfigInternals: {
27
27
  getConcurrency: () => string | number | null;
28
28
  getCurrentPuppeteerTimeout: () => number;
29
29
  getQuality: () => number | undefined;
30
+ getAudioCodec: () => "mp3" | "aac" | "pcm-16" | "opus" | null;
30
31
  getStillFrame: () => number;
31
32
  getShouldOutputImageSequence: (frameRange: import("@remotion/renderer").FrameRange | null) => boolean;
32
33
  getDotEnvLocation: () => string | null;
@@ -49,6 +49,7 @@ const scale_1 = require("./scale");
49
49
  const still_frame_1 = require("./still-frame");
50
50
  const timeout_1 = require("./timeout");
51
51
  const webpack_caching_1 = require("./webpack-caching");
52
+ const audio_codec_1 = require("./audio-codec");
52
53
  const bitrate_1 = require("./bitrate");
53
54
  const browser_executable_2 = require("./browser-executable");
54
55
  const chromium_flags_2 = require("./chromium-flags");
@@ -155,6 +156,8 @@ exports.Config = {
155
156
  Puppeteer,
156
157
  Rendering,
157
158
  Output,
159
+ // Options added after migration
160
+ setAudioCodec: audio_codec_1.setAudioCodec,
158
161
  };
159
162
  exports.ConfigInternals = {
160
163
  getRange: frame_range_1.getRange,
@@ -176,6 +179,7 @@ exports.ConfigInternals = {
176
179
  getConcurrency: concurrency_1.getConcurrency,
177
180
  getCurrentPuppeteerTimeout: timeout_1.getCurrentPuppeteerTimeout,
178
181
  getQuality: quality_1.getQuality,
182
+ getAudioCodec: audio_codec_1.getAudioCodec,
179
183
  getStillFrame: still_frame_1.getStillFrame,
180
184
  getShouldOutputImageSequence: image_sequence_1.getShouldOutputImageSequence,
181
185
  getDotEnvLocation: env_file_1.getDotEnvLocation,
@@ -0,0 +1 @@
1
+ export declare const makeFileExtensionMap: () => Record<string, ("h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif")[]>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeFileExtensionMap = void 0;
4
+ const renderer_1 = require("@remotion/renderer");
5
+ const makeFileExtensionMap = () => {
6
+ const map = {};
7
+ Object.keys(renderer_1.RenderInternals.defaultFileExtensionMap).forEach((_codec) => {
8
+ const codec = _codec;
9
+ const fileExtMap = renderer_1.RenderInternals.defaultFileExtensionMap[codec];
10
+ const audioCodecs = Object.keys(fileExtMap.forAudioCodec);
11
+ const possibleExtensionsForAudioCodec = audioCodecs.map((audioCodec) => fileExtMap.forAudioCodec[audioCodec].possible);
12
+ const allPossibleExtensions = [
13
+ fileExtMap.default,
14
+ ...possibleExtensionsForAudioCodec.flat(1),
15
+ ];
16
+ for (const extension of allPossibleExtensions) {
17
+ if (!map[extension]) {
18
+ map[extension] = [];
19
+ }
20
+ if (!map[extension].includes(codec)) {
21
+ map[extension].push(codec);
22
+ }
23
+ }
24
+ });
25
+ return map;
26
+ };
27
+ exports.makeFileExtensionMap = makeFileExtensionMap;
@@ -0,0 +1,2 @@
1
+ import type { AudioCodec } from '@remotion/renderer';
2
+ export declare const getResolvedAudioCodec: () => AudioCodec | null;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getResolvedAudioCodec = void 0;
4
+ const config_1 = require("./config");
5
+ const parse_command_line_1 = require("./parse-command-line");
6
+ const getResolvedAudioCodec = () => {
7
+ var _a;
8
+ return (_a = parse_command_line_1.parsedCli['audio-codec']) !== null && _a !== void 0 ? _a : config_1.ConfigInternals.getAudioCodec();
9
+ };
10
+ exports.getResolvedAudioCodec = getResolvedAudioCodec;
@@ -1,6 +1,4 @@
1
- import type { Codec } from '@remotion/renderer';
2
- export declare const getOutputFilename: ({ codec, imageSequence, compositionName, defaultExtension, args, }: {
3
- codec: Codec;
1
+ export declare const getOutputFilename: ({ imageSequence, compositionName, defaultExtension, args, }: {
4
2
  imageSequence: boolean;
5
3
  compositionName: string;
6
4
  defaultExtension: string;
@@ -4,14 +4,14 @@ exports.getOutputFilename = void 0;
4
4
  const renderer_1 = require("@remotion/renderer");
5
5
  const log_1 = require("./log");
6
6
  const user_passed_output_location_1 = require("./user-passed-output-location");
7
- const getOutputFilename = ({ codec, imageSequence, compositionName, defaultExtension, args, }) => {
8
- let filename = (0, user_passed_output_location_1.getOutputLocation)({
7
+ const getOutputFilename = ({ imageSequence, compositionName, defaultExtension, args, }) => {
8
+ const filename = (0, user_passed_output_location_1.getOutputLocation)({
9
9
  compositionId: compositionName,
10
10
  defaultExtension,
11
11
  args,
12
12
  type: imageSequence ? 'sequence' : 'asset',
13
13
  });
14
- let extension = renderer_1.RenderInternals.getExtensionOfFilename(filename);
14
+ const extension = renderer_1.RenderInternals.getExtensionOfFilename(filename);
15
15
  if (imageSequence) {
16
16
  if (extension !== null) {
17
17
  log_1.Log.error('The output directory of the image sequence cannot have an extension. Got: ' +
@@ -21,26 +21,8 @@ const getOutputFilename = ({ codec, imageSequence, compositionName, defaultExten
21
21
  return filename;
22
22
  }
23
23
  if (extension === null && !imageSequence) {
24
- if (codec === 'h264' || codec === 'h265') {
25
- log_1.Log.warn('No file extension specified, adding .mp4 automatically.');
26
- filename += '.mp4';
27
- extension = 'mp4';
28
- }
29
- if (codec === 'h264-mkv') {
30
- log_1.Log.warn('No file extension specified, adding .mkv automatically.');
31
- filename += '.mkv';
32
- extension = 'mkv';
33
- }
34
- if (codec === 'vp8' || codec === 'vp9') {
35
- log_1.Log.warn('No file extension specified, adding .webm automatically.');
36
- filename += '.webm';
37
- extension = 'webm';
38
- }
39
- if (codec === 'prores') {
40
- log_1.Log.warn('No file extension specified, adding .mov automatically.');
41
- filename += '.mov';
42
- extension = 'mov';
43
- }
24
+ log_1.Log.warn(`No file extension specified, adding ${defaultExtension} automatically.`);
25
+ return `${filename}.${defaultExtension}`;
44
26
  }
45
27
  return filename;
46
28
  };
@@ -2,55 +2,47 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFinalOutputCodec = void 0;
4
4
  const renderer_1 = require("@remotion/renderer");
5
- const fileExtensions = {
6
- webm: ['vp8', 'vp9'],
7
- hevc: ['h265'],
8
- mp3: ['mp3'],
9
- mov: ['prores'],
10
- wav: ['wav'],
11
- aac: ['aac'],
12
- mkv: ['h264-mkv'],
13
- gif: ['gif'],
14
- mp4: ['h264'],
15
- m4a: ['aac'],
16
- };
17
- const deriveExtensionFromFilename = (extension) => {
18
- var _a;
5
+ const deriveCodecsFromFilename = (extension) => {
6
+ var _a, _b;
19
7
  if (extension === null) {
20
- return [];
8
+ return { possible: [], default: null };
21
9
  }
22
- return (_a = fileExtensions[extension]) !== null && _a !== void 0 ? _a : [];
10
+ return {
11
+ default: (_a = renderer_1.RenderInternals.defaultCodecsForFileExtension[extension]) !== null && _a !== void 0 ? _a : null,
12
+ possible: (_b = renderer_1.RenderInternals.makeFileExtensionMap()[extension]) !== null && _b !== void 0 ? _b : [],
13
+ };
23
14
  };
24
15
  const getFinalOutputCodec = ({ cliFlag, configFile, downloadName, outName, }) => {
25
16
  const downloadNameExtension = renderer_1.RenderInternals.getExtensionOfFilename(downloadName);
26
17
  const outNameExtension = renderer_1.RenderInternals.getExtensionOfFilename(outName);
27
- const derivedDownloadCodecs = deriveExtensionFromFilename(downloadNameExtension);
28
- const derivedOutNameCodecs = deriveExtensionFromFilename(outNameExtension);
29
- if (derivedDownloadCodecs.length > 0 &&
30
- derivedOutNameCodecs.length > 0 &&
31
- derivedDownloadCodecs.join('') !== derivedOutNameCodecs.join('')) {
18
+ const derivedDownloadCodecs = deriveCodecsFromFilename(downloadNameExtension);
19
+ const derivedOutNameCodecs = deriveCodecsFromFilename(outNameExtension);
20
+ if (derivedDownloadCodecs.possible.length > 0 &&
21
+ derivedOutNameCodecs.possible.length > 0 &&
22
+ derivedDownloadCodecs.possible.join('') !==
23
+ derivedOutNameCodecs.possible.join('')) {
32
24
  throw new TypeError(`The download name is ${downloadName} but the output name is ${outName}. The file extensions must match`);
33
25
  }
34
26
  if (cliFlag) {
35
- if (derivedDownloadCodecs.length > 0 &&
36
- derivedDownloadCodecs.indexOf(cliFlag) === -1) {
37
- throw new TypeError(`The download name is ${downloadName} but --codec=${cliFlag} was passed. The download name implies a codec of ${derivedDownloadCodecs.join(' or ')} which does not align with the --codec flag.`);
27
+ if (derivedDownloadCodecs.possible.length > 0 &&
28
+ derivedDownloadCodecs.possible.indexOf(cliFlag) === -1) {
29
+ throw new TypeError(`The download name is ${downloadName} but --codec=${cliFlag} was passed. The download name implies a codec of ${derivedDownloadCodecs.possible.join(' or ')} which does not align with the --codec flag.`);
38
30
  }
39
- if (derivedOutNameCodecs.length > 0 &&
40
- derivedOutNameCodecs.indexOf(cliFlag) === -1) {
41
- throw new TypeError(`The out name is ${outName} but --codec=${cliFlag} was passed. The out name implies a codec of ${derivedOutNameCodecs.join(' or ')} which does not align with the --codec flag.`);
31
+ if (derivedOutNameCodecs.possible.length > 0 &&
32
+ derivedOutNameCodecs.possible.indexOf(cliFlag) === -1) {
33
+ throw new TypeError(`The out name is ${outName} but --codec=${cliFlag} was passed. The out name implies a codec of ${derivedOutNameCodecs.possible.join(' or ')} which does not align with the --codec flag.`);
42
34
  }
43
35
  return { codec: cliFlag, reason: 'from --codec flag' };
44
36
  }
45
- if (derivedDownloadCodecs.length > 0) {
37
+ if (derivedDownloadCodecs.possible.length > 0) {
46
38
  return {
47
- codec: derivedDownloadCodecs[0],
39
+ codec: derivedDownloadCodecs.default,
48
40
  reason: 'derived from download name',
49
41
  };
50
42
  }
51
- if (derivedOutNameCodecs.length > 0) {
43
+ if (derivedOutNameCodecs.possible.length > 0) {
52
44
  return {
53
- codec: derivedOutNameCodecs[0],
45
+ codec: derivedOutNameCodecs.default,
54
46
  reason: 'derived from out name',
55
47
  };
56
48
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRenderMediaOptions = void 0;
4
4
  const renderer_1 = require("@remotion/renderer");
5
5
  const config_1 = require("./config");
6
+ const get_audio_codec_1 = require("./get-audio-codec");
6
7
  const get_cli_options_1 = require("./get-cli-options");
7
8
  const image_formats_1 = require("./image-formats");
8
9
  const getRenderMediaOptions = async ({ outputLocation, config, serveUrl, codec, remotionRoot, }) => {
@@ -12,6 +13,7 @@ const getRenderMediaOptions = async ({ outputLocation, config, serveUrl, codec,
12
13
  remotionRoot,
13
14
  });
14
15
  const imageFormat = (0, image_formats_1.getImageFormat)(codec);
16
+ const audioCodec = (0, get_audio_codec_1.getResolvedAudioCodec)();
15
17
  return {
16
18
  outputLocation,
17
19
  composition: {
@@ -47,6 +49,7 @@ const getRenderMediaOptions = async ({ outputLocation, config, serveUrl, codec,
47
49
  codec,
48
50
  audioBitrate,
49
51
  videoBitrate,
52
+ audioCodec,
50
53
  };
51
54
  };
52
55
  exports.getRenderMediaOptions = getRenderMediaOptions;
@@ -1,4 +1,4 @@
1
- import type { BrowserExecutable, Codec, FfmpegExecutable, ImageFormat, OpenGlRenderer, PixelFormat, ProResProfile } from '@remotion/renderer';
1
+ import type { AudioCodec, BrowserExecutable, Codec, FfmpegExecutable, ImageFormat, OpenGlRenderer, PixelFormat, ProResProfile } from '@remotion/renderer';
2
2
  export declare type CommandLineOptions = {
3
3
  ['browser-executable']: BrowserExecutable;
4
4
  ['ffmpeg-executable']: FfmpegExecutable;
@@ -20,6 +20,7 @@ export declare type CommandLineOptions = {
20
20
  ['public-dir']: string;
21
21
  ['audio-bitrate']: string;
22
22
  ['video-bitrate']: string;
23
+ ['audio-codec']: AudioCodec;
23
24
  crf: number;
24
25
  force: boolean;
25
26
  overwrite: boolean;
package/dist/render.js CHANGED
@@ -13,6 +13,7 @@ const remotion_1 = require("remotion");
13
13
  const chalk_1 = require("./chalk");
14
14
  const config_1 = require("./config");
15
15
  const entry_point_1 = require("./entry-point");
16
+ const get_audio_codec_1 = require("./get-audio-codec");
16
17
  const get_cli_options_1 = require("./get-cli-options");
17
18
  const get_composition_with_dimension_override_1 = require("./get-composition-with-dimension-override");
18
19
  const get_filename_1 = require("./get-filename");
@@ -112,11 +113,11 @@ const render = async (remotionRoot, args) => {
112
113
  codec,
113
114
  scale,
114
115
  });
116
+ const audioCodec = (0, get_audio_codec_1.getResolvedAudioCodec)();
115
117
  const relativeOutputLocation = (0, get_filename_1.getOutputFilename)({
116
- codec,
117
118
  imageSequence: shouldOutputImageSequence,
118
119
  compositionName: compositionId,
119
- defaultExtension: renderer_1.RenderInternals.getFileExtensionFromCodec(codec),
120
+ defaultExtension: renderer_1.RenderInternals.getFileExtensionFromCodec(codec, audioCodec),
120
121
  args: argsAfterComposition,
121
122
  });
122
123
  log_1.Log.info(chalk_1.chalk.gray(`Entry point = ${path_1.default.relative(process.cwd(), file)} (${entryPointReason}), Composition = ${compositionId} (${reason}), Codec = ${codec} (${codecReason}), Output = ${relativeOutputLocation}`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cli",
3
- "version": "3.3.41",
3
+ "version": "3.3.42",
4
4
  "description": "CLI for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -22,16 +22,16 @@
22
22
  "author": "Jonny Burger <jonny@remotion.dev>",
23
23
  "license": "SEE LICENSE IN LICENSE.md",
24
24
  "dependencies": {
25
- "@remotion/bundler": "3.3.41",
26
- "@remotion/media-utils": "3.3.41",
27
- "@remotion/player": "3.3.41",
28
- "@remotion/renderer": "3.3.41",
25
+ "@remotion/bundler": "3.3.42",
26
+ "@remotion/media-utils": "3.3.42",
27
+ "@remotion/player": "3.3.42",
28
+ "@remotion/renderer": "3.3.42",
29
29
  "better-opn": "2.1.1",
30
30
  "dotenv": "9.0.2",
31
31
  "memfs": "3.4.3",
32
32
  "minimist": "1.2.6",
33
33
  "prompts": "2.4.1",
34
- "remotion": "3.3.41",
34
+ "remotion": "3.3.42",
35
35
  "semver": "7.3.5",
36
36
  "source-map": "0.6.1"
37
37
  },
@@ -71,5 +71,5 @@
71
71
  "publishConfig": {
72
72
  "access": "public"
73
73
  },
74
- "gitHead": "8e408247d151ac824864acf357782f10c89ed5f5"
74
+ "gitHead": "bfb8098300fb75d4c27220eead954c2dc8e5b4ce"
75
75
  }