@remotion/cli 3.2.27 → 3.2.29

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.
Files changed (49) hide show
  1. package/dist/benchmark.d.ts +1 -0
  2. package/dist/benchmark.js +180 -0
  3. package/dist/bundle.d.ts +1 -0
  4. package/dist/bundle.js +32 -0
  5. package/dist/compositions.js +1 -0
  6. package/dist/config/bundle-out-dir.d.ts +2 -0
  7. package/dist/config/bundle-out-dir.js +12 -0
  8. package/dist/config/get-public-path.d.ts +2 -0
  9. package/dist/config/get-public-path.js +12 -0
  10. package/dist/config/image-format.js +8 -1
  11. package/dist/config/log.d.ts +1 -1
  12. package/dist/determine-image-format.d.ts +11 -0
  13. package/dist/determine-image-format.js +48 -0
  14. package/dist/editor/components/Button.d.ts +4 -0
  15. package/dist/editor/components/Button.js +24 -0
  16. package/dist/editor/components/PlayPause.d.ts +0 -5
  17. package/dist/editor/components/PreviewZoomControls.d.ts +2 -0
  18. package/dist/editor/components/PreviewZoomControls.js +49 -0
  19. package/dist/editor/helpers/normalize-wheel.d.ts +5 -0
  20. package/dist/editor/helpers/normalize-wheel.js +20 -0
  21. package/dist/event-source-events.d.ts +3 -0
  22. package/dist/event-source.js +1 -1
  23. package/dist/get-cli-options.d.ts +11 -3
  24. package/dist/get-cli-options.js +22 -28
  25. package/dist/get-env.d.ts +1 -1
  26. package/dist/get-env.js +58 -6
  27. package/dist/get-final-output-codec.d.ts +9 -5
  28. package/dist/get-final-output-codec.js +56 -56
  29. package/dist/get-render-media-options.d.ts +7 -0
  30. package/dist/get-render-media-options.js +44 -0
  31. package/dist/index.d.ts +19 -2
  32. package/dist/index.js +10 -1
  33. package/dist/parse-command-line.js +0 -3
  34. package/dist/prepare-entry-point.d.ts +12 -0
  35. package/dist/prepare-entry-point.js +37 -0
  36. package/dist/preview-server/routes.d.ts +2 -1
  37. package/dist/preview-server/routes.js +4 -2
  38. package/dist/preview-server/start-server.d.ts +1 -1
  39. package/dist/preview-server/start-server.js +2 -1
  40. package/dist/preview.js +10 -2
  41. package/dist/print-help.js +6 -3
  42. package/dist/progress-bar.js +3 -1
  43. package/dist/render.js +18 -30
  44. package/dist/still.js +12 -24
  45. package/dist/validate-image-format.d.ts +2 -0
  46. package/dist/validate-image-format.js +15 -0
  47. package/dist/webpack-cache.d.ts +12 -0
  48. package/dist/webpack-cache.js +66 -0
  49. package/package.json +7 -7
package/dist/render.js CHANGED
@@ -15,10 +15,12 @@ const config_1 = require("./config");
15
15
  const get_cli_options_1 = require("./get-cli-options");
16
16
  const get_composition_id_1 = require("./get-composition-id");
17
17
  const get_filename_1 = require("./get-filename");
18
+ const get_render_media_options_1 = require("./get-render-media-options");
18
19
  const log_1 = require("./log");
19
20
  const parse_command_line_1 = require("./parse-command-line");
20
21
  const progress_bar_1 = require("./progress-bar");
21
22
  const setup_cache_1 = require("./setup-cache");
23
+ const user_passed_output_location_1 = require("./user-passed-output-location");
22
24
  const validate_ffmpeg_version_1 = require("./validate-ffmpeg-version");
23
25
  const render = async (remotionRoot) => {
24
26
  const startTime = Date.now();
@@ -38,9 +40,15 @@ const render = async (remotionRoot) => {
38
40
  process.exit(1);
39
41
  }
40
42
  log_1.Log.verbose('Asset dirs', downloadMap.assetDir);
41
- const { codec, proResProfile, concurrency, frameRange, shouldOutputImageSequence, overwrite, inputProps, envVariables, quality, browser, crf, pixelFormat, imageFormat, browserExecutable, ffmpegExecutable, ffprobeExecutable, scale, chromiumOptions, port, numberOfGifLoops, everyNthFrame, puppeteerTimeout, muted, enforceAudioTrack, publicDir, ffmpegOverride, } = await (0, get_cli_options_1.getCliOptions)({
43
+ const { codec, reason: codecReason } = (0, get_cli_options_1.getFinalCodec)({
44
+ downloadName: null,
45
+ outName: (0, user_passed_output_location_1.getUserPassedOutputLocation)(),
46
+ });
47
+ (0, get_cli_options_1.validateFfmpegCanUseCodec)(codec);
48
+ const { concurrency, frameRange, shouldOutputImageSequence, overwrite, inputProps, envVariables, quality, browser, imageFormat, browserExecutable, ffmpegExecutable, ffprobeExecutable, scale, chromiumOptions, port, everyNthFrame, puppeteerTimeout, publicDir, } = await (0, get_cli_options_1.getCliOptions)({
42
49
  isLambda: false,
43
50
  type: 'series',
51
+ codec,
44
52
  });
45
53
  const relativeOutputLocation = (0, get_filename_1.getOutputFilename)({
46
54
  codec,
@@ -50,7 +58,7 @@ const render = async (remotionRoot) => {
50
58
  });
51
59
  const absoluteOutputFile = (0, get_cli_options_1.getAndValidateAbsoluteOutputFile)(relativeOutputLocation, overwrite);
52
60
  const compositionId = (0, get_composition_id_1.getCompositionId)();
53
- log_1.Log.info(chalk_1.chalk.gray(`Composition = ${compositionId}, Codec = ${codec}, Output = ${relativeOutputLocation}`));
61
+ log_1.Log.info(chalk_1.chalk.gray(`Composition = ${compositionId}, Codec = ${codec} (${codecReason}), Output = ${relativeOutputLocation}`));
54
62
  log_1.Log.verbose('Browser executable: ', browserExecutable);
55
63
  await (0, validate_ffmpeg_version_1.checkAndValidateFfmpegVersion)({
56
64
  ffmpegExecutable,
@@ -95,10 +103,11 @@ const render = async (remotionRoot) => {
95
103
  inputProps,
96
104
  puppeteerInstance,
97
105
  envVariables,
98
- timeoutInMilliseconds: config_1.ConfigInternals.getCurrentPuppeteerTimeout(),
106
+ timeoutInMilliseconds: puppeteerTimeout,
99
107
  chromiumOptions,
100
108
  browserExecutable,
101
109
  downloadMap,
110
+ port,
102
111
  });
103
112
  const config = comps.find((c) => c.id === compositionId);
104
113
  if (!config) {
@@ -199,17 +208,14 @@ const render = async (remotionRoot) => {
199
208
  log_1.Log.info(chalk_1.chalk.green('\nYour image sequence is ready!'));
200
209
  return;
201
210
  }
202
- await (0, renderer_1.renderMedia)({
211
+ const options = await (0, get_render_media_options_1.getRenderMediaOptions)({
212
+ config,
203
213
  outputLocation: absoluteOutputFile,
214
+ serveUrl: urlOrBundle,
204
215
  codec,
205
- composition: config,
206
- crf,
207
- envVariables,
208
- ffmpegExecutable,
209
- ffprobeExecutable,
210
- frameRange,
211
- imageFormat,
212
- inputProps,
216
+ });
217
+ await (0, renderer_1.renderMedia)({
218
+ ...options,
213
219
  onProgress: (update) => {
214
220
  encodedDoneIn = update.encodedDoneIn;
215
221
  encodedFrames = update.encodedFrames;
@@ -219,26 +225,8 @@ const render = async (remotionRoot) => {
219
225
  updateRenderProgress();
220
226
  },
221
227
  puppeteerInstance,
222
- overwrite,
223
- concurrency,
224
- pixelFormat,
225
- proResProfile,
226
- quality,
227
- serveUrl: urlOrBundle,
228
228
  onDownload,
229
- dumpBrowserLogs: renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'verbose'),
230
- chromiumOptions,
231
- timeoutInMilliseconds: config_1.ConfigInternals.getCurrentPuppeteerTimeout(),
232
- scale,
233
- port,
234
- numberOfGifLoops,
235
- everyNthFrame,
236
- verbose: renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'verbose'),
237
229
  downloadMap,
238
- muted,
239
- enforceAudioTrack,
240
- browserExecutable,
241
- ffmpegOverride,
242
230
  });
243
231
  log_1.Log.info();
244
232
  log_1.Log.info();
package/dist/still.js CHANGED
@@ -9,6 +9,7 @@ const fs_1 = require("fs");
9
9
  const path_1 = __importDefault(require("path"));
10
10
  const chalk_1 = require("./chalk");
11
11
  const config_1 = require("./config");
12
+ const determine_image_format_1 = require("./determine-image-format");
12
13
  const get_cli_options_1 = require("./get-cli-options");
13
14
  const get_composition_id_1 = require("./get-composition-id");
14
15
  const log_1 = require("./log");
@@ -18,6 +19,7 @@ const setup_cache_1 = require("./setup-cache");
18
19
  const truthy_1 = require("./truthy");
19
20
  const user_passed_output_location_1 = require("./user-passed-output-location");
20
21
  const still = async (remotionRoot) => {
22
+ var _a, _b;
21
23
  const startTime = Date.now();
22
24
  const file = parse_command_line_1.parsedCli._[1];
23
25
  const fullPath = renderer_1.RenderInternals.isServeUrl(file)
@@ -27,40 +29,26 @@ const still = async (remotionRoot) => {
27
29
  log_1.Log.error('--frames flag was passed to the `still` command. This flag only works with the `render` command. Did you mean `--frame`? See reference: https://www.remotion.dev/docs/cli/');
28
30
  process.exit(1);
29
31
  }
30
- const userPassedOutput = (0, user_passed_output_location_1.getUserPassedOutputLocation)();
31
- if ((userPassedOutput === null || userPassedOutput === void 0 ? void 0 : userPassedOutput.endsWith('.jpeg')) ||
32
- (userPassedOutput === null || userPassedOutput === void 0 ? void 0 : userPassedOutput.endsWith('.jpg'))) {
33
- log_1.Log.verbose('Output file has a JPEG extension, setting the image format to JPEG.');
34
- config_1.Config.Rendering.setImageFormat('jpeg');
35
- }
36
- if (userPassedOutput === null || userPassedOutput === void 0 ? void 0 : userPassedOutput.endsWith('.png')) {
37
- log_1.Log.verbose('Output file has a PNG extension, setting the image format to PNG.');
38
- config_1.Config.Rendering.setImageFormat('png');
39
- }
40
- const { inputProps, envVariables, quality, browser, imageFormat, stillFrame, browserExecutable, chromiumOptions, scale, ffmpegExecutable, ffprobeExecutable, overwrite, puppeteerTimeout, port, publicDir, } = await (0, get_cli_options_1.getCliOptions)({
32
+ const { inputProps, envVariables, quality, browser, stillFrame, browserExecutable, chromiumOptions, scale, ffmpegExecutable, ffprobeExecutable, overwrite, puppeteerTimeout, port, publicDir, } = await (0, get_cli_options_1.getCliOptions)({
41
33
  isLambda: false,
42
34
  type: 'still',
35
+ codec: 'h264',
43
36
  });
44
37
  log_1.Log.verbose('Browser executable: ', browserExecutable);
45
38
  const compositionId = (0, get_composition_id_1.getCompositionId)();
39
+ const { format: imageFormat, source } = (0, determine_image_format_1.determineFinalImageFormat)({
40
+ cliFlag: (_a = parse_command_line_1.parsedCli['image-format']) !== null && _a !== void 0 ? _a : null,
41
+ configImageFormat: (_b = config_1.ConfigInternals.getUserPreferredImageFormat()) !== null && _b !== void 0 ? _b : null,
42
+ downloadName: null,
43
+ outName: (0, user_passed_output_location_1.getUserPassedOutputLocation)(),
44
+ isLambda: false,
45
+ });
46
46
  const relativeOutputLocation = (0, user_passed_output_location_1.getOutputLocation)({
47
47
  compositionId,
48
48
  defaultExtension: imageFormat,
49
49
  });
50
50
  const absoluteOutputLocation = (0, get_cli_options_1.getAndValidateAbsoluteOutputFile)(relativeOutputLocation, overwrite);
51
- log_1.Log.info(chalk_1.chalk.gray(`Output = ${relativeOutputLocation}, Format = ${imageFormat}, Composition = ${compositionId}`));
52
- if (imageFormat === 'none') {
53
- log_1.Log.error('No image format was selected - this is probably an error in Remotion - please post your command on Github Issues for help.');
54
- process.exit(1);
55
- }
56
- if (imageFormat === 'png' && !absoluteOutputLocation.endsWith('.png')) {
57
- log_1.Log.warn(`Rendering a PNG, expected a .png extension but got ${absoluteOutputLocation}`);
58
- }
59
- if (imageFormat === 'jpeg' &&
60
- !absoluteOutputLocation.endsWith('.jpg') &&
61
- !absoluteOutputLocation.endsWith('.jpeg')) {
62
- log_1.Log.warn(`Rendering a JPEG, expected a .jpg or .jpeg extension but got ${absoluteOutputLocation}`);
63
- }
51
+ log_1.Log.info(chalk_1.chalk.gray(`Output = ${relativeOutputLocation}, Format = ${imageFormat} (${source}), Composition = ${compositionId}`));
64
52
  const browserInstance = (0, renderer_1.openBrowser)(browser, {
65
53
  browserExecutable,
66
54
  chromiumOptions,
@@ -0,0 +1,2 @@
1
+ import type { ImageFormat } from '@remotion/renderer';
2
+ export declare const validateImageFormat: (imageFormat: ImageFormat, outName: string | null) => void;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateImageFormat = void 0;
4
+ const log_1 = require("./log");
5
+ const validateImageFormat = (imageFormat, outName) => {
6
+ if (imageFormat === 'png' && (outName === null || outName === void 0 ? void 0 : outName.endsWith('.png'))) {
7
+ log_1.Log.warn(`Rendering a PNG, expected a .png extension but got ${outName}`);
8
+ }
9
+ if (imageFormat === 'jpeg' &&
10
+ !(outName === null || outName === void 0 ? void 0 : outName.endsWith('.jpg')) &&
11
+ !(outName === null || outName === void 0 ? void 0 : outName.endsWith('.jpeg'))) {
12
+ log_1.Log.warn(`Rendering a JPEG, expected a .jpg or .jpeg extension but got ${outName}`);
13
+ }
14
+ };
15
+ exports.validateImageFormat = validateImageFormat;
@@ -0,0 +1,12 @@
1
+ declare type Environment = 'development' | 'production';
2
+ declare global {
3
+ namespace NodeJS {
4
+ interface ProcessVersions {
5
+ pnp?: string;
6
+ }
7
+ }
8
+ }
9
+ export declare const clearCache: (environment: Environment, inputProps: object | null) => Promise<void>;
10
+ export declare const getWebpackCacheName: (environment: Environment, inputProps: object | null) => string;
11
+ export declare const cacheExists: (environment: Environment, inputProps: object | null) => boolean;
12
+ export {};
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.cacheExists = exports.getWebpackCacheName = exports.clearCache = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const remotion_1 = require("remotion");
10
+ // Inlined from https://github.com/webpack/webpack/blob/4c2ee7a4ddb8db2362ca83b6c4190523387ba7ee/lib/config/defaults.js#L265
11
+ // An algorithm to determine where Webpack will cache the depencies
12
+ const getWebpackCacheDir = () => {
13
+ const cwd = process.cwd();
14
+ let dir = cwd;
15
+ for (;;) {
16
+ try {
17
+ if (fs_1.default.statSync(path_1.default.join(dir, 'package.json')).isFile()) {
18
+ break;
19
+ }
20
+ // eslint-disable-next-line no-empty
21
+ }
22
+ catch (e) { }
23
+ const parent = path_1.default.dirname(dir);
24
+ if (dir === parent) {
25
+ dir = undefined;
26
+ break;
27
+ }
28
+ dir = parent;
29
+ }
30
+ if (!dir) {
31
+ return path_1.default.resolve(cwd, '.cache/webpack');
32
+ }
33
+ if (process.versions.pnp === '1') {
34
+ return path_1.default.resolve(dir, '.pnp/.cache/webpack');
35
+ }
36
+ if (process.versions.pnp === '3') {
37
+ return path_1.default.resolve(dir, '.yarn/.cache/webpack');
38
+ }
39
+ return path_1.default.resolve(dir, 'node_modules/.cache/webpack');
40
+ };
41
+ const remotionCacheLocation = (environment, inputProps) => {
42
+ return path_1.default.join(getWebpackCacheDir(), (0, exports.getWebpackCacheName)(environment, inputProps));
43
+ };
44
+ const clearCache = (environment, inputProps) => {
45
+ var _a;
46
+ return ((_a = fs_1.default.promises.rm) !== null && _a !== void 0 ? _a : fs_1.default.promises.rmdir)(remotionCacheLocation(environment, inputProps), {
47
+ recursive: true,
48
+ });
49
+ };
50
+ exports.clearCache = clearCache;
51
+ const getWebpackCacheName = (environment, inputProps) => {
52
+ // In development, let's reset the cache when input props
53
+ // are changing, because they are injected using Webpack and if changed,
54
+ // it will get the cached version
55
+ if (environment === 'development') {
56
+ return `remotion-v3-${environment}-${(0, remotion_1.random)(JSON.stringify(inputProps))}`;
57
+ }
58
+ // In production, the cache is independent from input props because
59
+ // they are passed over URL params. Speed is mostly important in production.
60
+ return `remotion-v3-${environment}`;
61
+ };
62
+ exports.getWebpackCacheName = getWebpackCacheName;
63
+ const cacheExists = (environment, inputProps) => {
64
+ return fs_1.default.existsSync(remotionCacheLocation(environment, inputProps));
65
+ };
66
+ exports.cacheExists = cacheExists;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cli",
3
- "version": "3.2.27",
3
+ "version": "3.2.29",
4
4
  "description": "CLI for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -23,15 +23,15 @@
23
23
  "author": "Jonny Burger <jonny@remotion.dev>",
24
24
  "license": "SEE LICENSE IN LICENSE.md",
25
25
  "dependencies": {
26
- "@remotion/bundler": "3.2.27",
27
- "@remotion/media-utils": "3.2.27",
28
- "@remotion/player": "3.2.27",
29
- "@remotion/renderer": "3.2.27",
26
+ "@remotion/bundler": "3.2.29",
27
+ "@remotion/media-utils": "3.2.29",
28
+ "@remotion/player": "3.2.29",
29
+ "@remotion/renderer": "3.2.29",
30
30
  "better-opn": "2.1.1",
31
31
  "dotenv": "9.0.2",
32
32
  "memfs": "3.4.3",
33
33
  "minimist": "1.2.6",
34
- "remotion": "3.2.27",
34
+ "remotion": "3.2.29",
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": "662c69bcb2fee4d51553b2f8e61635fb4d6688b1"
74
+ "gitHead": "9a2ff4d68324af8d1fe55ebdf94bdadccf446a10"
75
75
  }