@remotion/cli 3.3.25 → 3.3.26

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.
@@ -1,3 +1,5 @@
1
1
  import React from 'react';
2
+ declare type Props = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
2
3
  export declare const inputBaseStyle: React.CSSProperties;
3
- export declare const RemotionInput: (props: React.ClassAttributes<HTMLInputElement> & React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement | null>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
4
+ export declare const RemotionInput: React.ForwardRefExoticComponent<Pick<Props, "key" | keyof React.InputHTMLAttributes<HTMLInputElement>> & React.RefAttributes<HTMLInputElement>>;
5
+ export {};
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RenderModal = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ // TODO: refactor such that importing from '@remotion/renderer/src/get-extension-from-codec' is no longer needed
6
+ const get_extension_from_codec_1 = require("@remotion/renderer/src/get-extension-from-codec");
5
7
  const react_1 = require("react");
6
8
  const Button_1 = require("../../../preview-server/error-overlay/remotion-overlay/Button");
7
9
  const colors_1 = require("../../helpers/colors");
@@ -36,7 +38,14 @@ const reducer = (state, action) => {
36
38
  }
37
39
  return state;
38
40
  };
39
- const container = {};
41
+ const container = {
42
+ display: 'flex',
43
+ flexDirection: 'row',
44
+ alignItems: 'center',
45
+ padding: '12px 16px',
46
+ width: '100%',
47
+ borderBottom: '1px solid black',
48
+ };
40
49
  const optionRow = {
41
50
  display: 'flex',
42
51
  flexDirection: 'row',
@@ -86,6 +95,9 @@ const RenderModal = ({ compositionId, initialFrame, initialImageFormat, initialQ
86
95
  const [state, dispatch] = (0, react_1.useReducer)(reducer, initialState);
87
96
  const [frame, setFrame] = (0, react_1.useState)(() => initialFrame);
88
97
  const [imageFormat, setImageFormat] = (0, react_1.useState)(() => initialImageFormat);
98
+ const [videoCodec, setVideoCodec] = (0, react_1.useState)('h264');
99
+ const [videoImageFormat, setVideoImageFormat] = (0, react_1.useState)('jpeg');
100
+ const [renderMode, setRenderMode] = (0, react_1.useState)('still');
89
101
  const [quality, setQuality] = (0, react_1.useState)(() => initialQuality !== null && initialQuality !== void 0 ? initialQuality : 80);
90
102
  const [scale, setScale] = (0, react_1.useState)(() => initialScale);
91
103
  const [verbose, setVerboseLogging] = (0, react_1.useState)(() => initialVerbose);
@@ -98,22 +110,24 @@ const RenderModal = ({ compositionId, initialFrame, initialImageFormat, initialQ
98
110
  const onValueChange = (0, react_1.useCallback)((e) => {
99
111
  setOutName(e.target.value);
100
112
  }, []);
101
- const setPng = (0, react_1.useCallback)(() => {
102
- setImageFormat('png');
113
+ const getStringBeforeSuffix = (0, react_1.useCallback)((fileName) => {
114
+ const dotPos = fileName.lastIndexOf('.');
115
+ const bitBeforeDot = fileName.substring(0, dotPos);
116
+ return bitBeforeDot;
117
+ }, []);
118
+ const setCodec = (0, react_1.useCallback)((codec) => {
119
+ setVideoCodec(codec);
103
120
  setOutName((prev) => {
104
- if (prev.endsWith('.jpeg') || prev.endsWith('.jpg')) {
105
- return prev.replace(/.jpe?g$/g, '.png');
106
- }
107
- return prev;
121
+ const codecSuffix = (0, get_extension_from_codec_1.getFileExtensionFromCodec)(codec, 'final');
122
+ const newFileName = getStringBeforeSuffix(prev) + '.' + codecSuffix;
123
+ return newFileName;
108
124
  });
109
125
  }, []);
110
- const setJpeg = (0, react_1.useCallback)(() => {
111
- setImageFormat('jpeg');
126
+ const setStillFormat = (0, react_1.useCallback)((format) => {
127
+ setImageFormat(format);
112
128
  setOutName((prev) => {
113
- if (prev.endsWith('.png')) {
114
- return prev.replace(/.png$/g, '.jpeg');
115
- }
116
- return prev;
129
+ const newFileName = getStringBeforeSuffix(prev) + '.' + format;
130
+ return newFileName;
117
131
  });
118
132
  }, []);
119
133
  const onClickStill = (0, react_1.useCallback)(() => {
@@ -154,12 +168,12 @@ const RenderModal = ({ compositionId, initialFrame, initialImageFormat, initialQ
154
168
  (0, actions_1.addVideoRenderJob)({
155
169
  compositionId,
156
170
  outName,
157
- imageFormat,
171
+ imageFormat: videoImageFormat,
158
172
  quality: imageFormat === 'jpeg' ? quality : null,
159
173
  scale,
160
174
  verbose,
161
175
  // TODO: Make this configurable
162
- codec: 'h264',
176
+ codec: videoCodec,
163
177
  })
164
178
  .then(() => {
165
179
  dispatchIfMounted({ type: 'succeed' });
@@ -177,6 +191,8 @@ const RenderModal = ({ compositionId, initialFrame, initialImageFormat, initialQ
177
191
  scale,
178
192
  setSelectedModal,
179
193
  verbose,
194
+ videoCodec,
195
+ videoImageFormat,
180
196
  ]);
181
197
  const onQualityChangedDirectly = (0, react_1.useCallback)((newQuality) => {
182
198
  setQuality(newQuality);
@@ -227,36 +243,88 @@ const RenderModal = ({ compositionId, initialFrame, initialImageFormat, initialQ
227
243
  return [
228
244
  {
229
245
  label: 'PNG',
230
- onClick: setPng,
246
+ onClick: renderMode === 'still'
247
+ ? () => setStillFormat('png')
248
+ : () => setVideoImageFormat('png'),
231
249
  key: 'png',
232
- selected: imageFormat === 'png',
250
+ selected: renderMode === 'still'
251
+ ? imageFormat === 'png'
252
+ : videoImageFormat === 'png',
233
253
  },
234
254
  {
235
255
  label: 'JPEG',
236
- onClick: setJpeg,
256
+ onClick: renderMode === 'still'
257
+ ? () => setStillFormat('jpeg')
258
+ : () => setVideoImageFormat('jpeg'),
237
259
  key: 'jpeg',
238
- selected: imageFormat === 'jpeg',
260
+ selected: renderMode === 'still'
261
+ ? imageFormat === 'jpeg'
262
+ : videoImageFormat === 'jpeg',
263
+ },
264
+ ];
265
+ }, [imageFormat, renderMode, setStillFormat, videoImageFormat]);
266
+ const videoCodecOptions = (0, react_1.useMemo)(() => {
267
+ const codecs = [
268
+ 'h264',
269
+ 'h265',
270
+ 'vp8',
271
+ 'vp9',
272
+ 'mp3',
273
+ 'aac',
274
+ 'wav',
275
+ 'prores',
276
+ 'h264-mkv',
277
+ 'gif',
278
+ ];
279
+ return codecs.map((codec) => {
280
+ return {
281
+ label: codec,
282
+ onClick: () => setCodec(codec),
283
+ key: codec,
284
+ selected: videoCodec === codec,
285
+ };
286
+ });
287
+ }, [setCodec, videoCodec]);
288
+ const renderTabOptions = (0, react_1.useMemo)(() => {
289
+ return [
290
+ {
291
+ label: 'Still',
292
+ onClick: () => {
293
+ setRenderMode('still');
294
+ setStillFormat(imageFormat);
295
+ },
296
+ key: 'still',
297
+ selected: renderMode === 'still',
298
+ },
299
+ {
300
+ label: 'Video',
301
+ onClick: () => {
302
+ setRenderMode('video');
303
+ setCodec(videoCodec);
304
+ },
305
+ key: 'video',
306
+ selected: renderMode === 'video',
239
307
  },
240
308
  ];
241
- }, [imageFormat, setJpeg, setPng]);
309
+ }, [imageFormat, renderMode, setCodec, setStillFormat, videoCodec]);
242
310
  const onVerboseLoggingChanged = (0, react_1.useCallback)((e) => {
243
311
  setVerboseLogging(e.target.checked);
244
312
  }, []);
245
- return ((0, jsx_runtime_1.jsxs)(ModalContainer_1.ModalContainer, { onOutsideClick: onQuit, onEscape: onQuit, children: [(0, jsx_runtime_1.jsx)(ModalHeader_1.NewCompHeader, { title: `Render ${compositionId}` }), (0, jsx_runtime_1.jsxs)("div", { style: container, children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { block: true, y: 0.5 }), (0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "Format" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: imageFormatOptions }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "Output name" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput
313
+ return ((0, jsx_runtime_1.jsxs)(ModalContainer_1.ModalContainer, { onOutsideClick: onQuit, onEscape: onQuit, children: [(0, jsx_runtime_1.jsx)(ModalHeader_1.NewCompHeader, { title: `Render ${compositionId}` }), (0, jsx_runtime_1.jsx)("div", { style: container, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: renderTabOptions }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { block: true, y: 0.5 }), (0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: renderMode === 'still' ? 'Format' : 'Codec' }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: renderMode === 'still' ? imageFormatOptions : videoCodecOptions }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "Output name" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput
246
314
  // TODO: Validate and reject folders or weird file names
247
315
  , {
248
316
  // TODO: Validate and reject folders or weird file names
249
- warning: existence, style: input, type: "text", value: outName, onChange: onValueChange }), existence ? ((0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-end", message: "Will be overwritten" })) : null] }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "Frame" }), (0, jsx_runtime_1.jsxs)("div", { style: rightRow, children: [(0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger
250
- // TODO: Hide if it is a still
251
- , {
317
+ warning: existence, style: input, type: "text", value: outName, onChange: onValueChange }), existence ? ((0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { align: "flex-end", message: "Will be overwritten" })) : null] }) })] }), (0, jsx_runtime_1.jsx)("div", { style: optionRow, children: renderMode === 'still' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "Frame" }), (0, jsx_runtime_1.jsxs)("div", { style: rightRow, children: [(0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger
252
318
  // TODO: Hide if it is a still
253
- value: frame, onChange: onFrameChanged,
254
- // TODO: Actual frame
255
- placeholder: "0-100", onValueChange: onFrameSetDirectly, name: "frame", step: 1, min: 0,
256
- // TODO: Add actual frame
257
- max: Infinity }), ' '] })] }), (0, jsx_runtime_1.jsxs)(CollapsableOptions_1.CollapsableOptions, { showLabel: "Show advanced settings", hideLabel: "Hide advanced settings", children: [(0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "Scale" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { value: scale, onChange: onScaleChanged, placeholder: "0.1-10",
319
+ , {
320
+ // TODO: Hide if it is a still
321
+ value: frame, onChange: onFrameChanged,
322
+ // TODO: Actual frame
323
+ placeholder: "0-100", onValueChange: onFrameSetDirectly, name: "frame", step: 1, min: 0,
324
+ // TODO: Add actual frame
325
+ max: Infinity }), ' '] })] })) }), (0, jsx_runtime_1.jsxs)(CollapsableOptions_1.CollapsableOptions, { showLabel: "Show advanced settings", hideLabel: "Hide advanced settings", children: [(0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "Scale" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { value: scale, onChange: onScaleChanged, placeholder: "0.1-10",
258
326
  // TODO: Does not allow non-integer steps
259
327
  // TODO: Cannot click and type in 0.2
260
- onValueChange: onScaleSetDirectly, name: "scale", step: 0.05, min: MIN_SCALE, max: MAX_SCALE }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "Verbose logging" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsx)("input", { type: 'checkbox', checked: verbose, onChange: onVerboseLoggingChanged }) })] }), imageFormat === 'jpeg' && ((0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "JPEG Quality" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { value: quality, onChange: onQualityChanged, placeholder: "0-100", onValueChange: onQualityChangedDirectly, name: "quality", step: 1, min: MIN_QUALITY, max: MAX_QUALITY }) })] }))] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { block: true, y: 0.5 }), (0, jsx_runtime_1.jsxs)("div", { style: buttonRow, children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { autoFocus: true, onClick: onClickVideo, disabled: state.type === 'load', children: state.type === 'idle' ? 'Render video' : 'Rendering...' }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { block: true, x: 0.5 }), (0, jsx_runtime_1.jsx)(Button_1.Button, { autoFocus: true, onClick: onClickStill, disabled: state.type === 'load', children: state.type === 'idle' ? 'Render still' : 'Rendering...' })] })] })] }));
328
+ onValueChange: onScaleSetDirectly, name: "scale", step: 0.05, min: MIN_SCALE, max: MAX_SCALE }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "Verbose logging" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsx)("input", { type: 'checkbox', checked: verbose, onChange: onVerboseLoggingChanged }) })] }), renderMode === 'video' && ((0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "Image Format" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsx)(SegmentedControl_1.SegmentedControl, { items: imageFormatOptions }) })] })), (imageFormat === 'jpeg' || videoImageFormat === 'jpeg') && ((0, jsx_runtime_1.jsxs)("div", { style: optionRow, children: [(0, jsx_runtime_1.jsx)("div", { style: label, children: "JPEG Quality" }), (0, jsx_runtime_1.jsx)("div", { style: rightRow, children: (0, jsx_runtime_1.jsx)(InputDragger_1.InputDragger, { value: quality, onChange: onQualityChanged, placeholder: "0-100", onValueChange: onQualityChangedDirectly, name: "quality", step: 1, min: MIN_QUALITY, max: MAX_QUALITY }) })] }))] }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { block: true, y: 0.5 }), (0, jsx_runtime_1.jsx)("div", { style: buttonRow, children: renderMode === 'still' ? ((0, jsx_runtime_1.jsx)(Button_1.Button, { autoFocus: true, onClick: onClickStill, disabled: state.type === 'load', children: state.type === 'idle' ? 'Render still' : 'Rendering...' })) : ((0, jsx_runtime_1.jsx)(Button_1.Button, { autoFocus: true, onClick: onClickVideo, disabled: state.type === 'load', children: state.type === 'idle' ? 'Render video' : 'Rendering...' })) })] })] }));
261
329
  };
262
330
  exports.RenderModal = RenderModal;
@@ -20,11 +20,13 @@ export declare const addVideoRenderJob: ({ compositionId, outName, imageFormat,
20
20
  verbose: boolean;
21
21
  codec: Codec;
22
22
  }) => Promise<undefined>;
23
- export declare const unsubscribeFromFileExistenceWatcher: ({ file }: {
23
+ export declare const unsubscribeFromFileExistenceWatcher: ({ file, clientId, }: {
24
24
  file: string;
25
+ clientId: string;
25
26
  }) => Promise<undefined>;
26
- export declare const subscribeToFileExistenceWatcher: ({ file, }: {
27
+ export declare const subscribeToFileExistenceWatcher: ({ file, clientId, }: {
27
28
  file: string;
29
+ clientId: string;
28
30
  }) => Promise<boolean>;
29
31
  export declare const openInFileExplorer: ({ directory }: {
30
32
  directory: string;
@@ -51,12 +51,15 @@ const addVideoRenderJob = ({ compositionId, outName, imageFormat, quality, scale
51
51
  });
52
52
  };
53
53
  exports.addVideoRenderJob = addVideoRenderJob;
54
- const unsubscribeFromFileExistenceWatcher = ({ file }) => {
55
- return (0, exports.callApi)('/api/unsubscribe-from-file-existence', { file });
54
+ const unsubscribeFromFileExistenceWatcher = ({ file, clientId, }) => {
55
+ return (0, exports.callApi)('/api/unsubscribe-from-file-existence', { file, clientId });
56
56
  };
57
57
  exports.unsubscribeFromFileExistenceWatcher = unsubscribeFromFileExistenceWatcher;
58
- const subscribeToFileExistenceWatcher = async ({ file, }) => {
59
- const { exists } = await (0, exports.callApi)('/api/subscribe-to-file-existence', { file });
58
+ const subscribeToFileExistenceWatcher = async ({ file, clientId, }) => {
59
+ const { exists } = await (0, exports.callApi)('/api/subscribe-to-file-existence', {
60
+ file,
61
+ clientId,
62
+ });
60
63
  return exists;
61
64
  };
62
65
  exports.subscribeToFileExistenceWatcher = subscribeToFileExistenceWatcher;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ declare type PreviewServerState = {
3
+ type: 'init';
4
+ } | {
5
+ type: 'connected';
6
+ clientId: string;
7
+ } | {
8
+ type: 'disconnected';
9
+ };
10
+ export declare const PreviewServerConnectionCtx: React.Context<PreviewServerState>;
11
+ export declare const previewServerConnectionRef: React.RefObject<{
12
+ set: (jobs: PreviewServerState) => void;
13
+ }>;
14
+ export declare const PreviewServerConnection: React.FC<{
15
+ children: React.ReactNode;
16
+ }>;
17
+ export {};
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.PreviewServerConnection = exports.previewServerConnectionRef = exports.PreviewServerConnectionCtx = void 0;
27
+ const jsx_runtime_1 = require("react/jsx-runtime");
28
+ const react_1 = __importStar(require("react"));
29
+ exports.PreviewServerConnectionCtx = react_1.default.createContext({
30
+ type: 'init',
31
+ });
32
+ exports.previewServerConnectionRef = (0, react_1.createRef)();
33
+ const PreviewServerConnection = ({ children }) => {
34
+ const [state, setState] = react_1.default.useState({
35
+ type: 'init',
36
+ });
37
+ (0, react_1.useImperativeHandle)(exports.previewServerConnectionRef, () => {
38
+ return {
39
+ set: (newState) => {
40
+ setState(newState);
41
+ },
42
+ };
43
+ }, []);
44
+ return ((0, jsx_runtime_1.jsx)(exports.PreviewServerConnectionCtx.Provider, { value: state, children: children }));
45
+ };
46
+ exports.PreviewServerConnection = PreviewServerConnection;
@@ -4,20 +4,29 @@ exports.useFileExistence = void 0;
4
4
  const react_1 = require("react");
5
5
  const event_source_1 = require("../../event-source");
6
6
  const actions_1 = require("../components/RenderQueue/actions");
7
+ const client_id_1 = require("./client-id");
7
8
  const useFileExistence = (outName) => {
8
9
  const [exists, setExists] = (0, react_1.useState)(false);
10
+ const state = (0, react_1.useContext)(client_id_1.PreviewServerConnectionCtx);
11
+ const clientId = state.type === 'connected' ? state.clientId : undefined;
9
12
  const currentOutName = (0, react_1.useRef)('');
10
13
  currentOutName.current = outName;
11
14
  (0, react_1.useEffect)(() => {
12
- (0, actions_1.subscribeToFileExistenceWatcher)({ file: outName }).then((_exists) => {
15
+ if (!clientId) {
16
+ return;
17
+ }
18
+ (0, actions_1.subscribeToFileExistenceWatcher)({
19
+ file: outName,
20
+ clientId,
21
+ }).then((_exists) => {
13
22
  if (currentOutName.current === outName) {
14
23
  setExists(_exists);
15
24
  }
16
25
  });
17
26
  return () => {
18
- (0, actions_1.unsubscribeFromFileExistenceWatcher)({ file: outName });
27
+ (0, actions_1.unsubscribeFromFileExistenceWatcher)({ file: outName, clientId });
19
28
  };
20
- }, [outName]);
29
+ }, [clientId, outName]);
21
30
  (0, react_1.useEffect)(() => {
22
31
  const listener = (event) => {
23
32
  if (event.type !== 'watched-file-deleted') {
@@ -1,3 +1,4 @@
1
+ import type { StaticFile } from 'remotion';
1
2
  export declare type EventSourceEvent = {
2
3
  type: 'new-input-props';
3
4
  newProps: object;
@@ -6,4 +7,7 @@ export declare type EventSourceEvent = {
6
7
  } | {
7
8
  type: 'new-env-variables';
8
9
  newEnvVariables: Record<string, string>;
10
+ } | {
11
+ type: 'new-public-folder';
12
+ files: StaticFile[];
9
13
  };
@@ -11,6 +11,9 @@ const openEventSource = () => {
11
11
  newEvent.type === 'new-env-variables') {
12
12
  window.location.reload();
13
13
  }
14
+ if (newEvent.type === 'new-public-folder') {
15
+ window.remotion_staticFiles = newEvent.files;
16
+ }
14
17
  });
15
18
  source.addEventListener('open', () => {
16
19
  var _a;
@@ -1,10 +1,13 @@
1
- export declare const subscribeToFileExistenceWatchers: ({ file: relativeFile, remotionRoot, }: {
1
+ export declare const subscribeToFileExistenceWatchers: ({ file: relativeFile, remotionRoot, clientId, }: {
2
2
  file: string;
3
3
  remotionRoot: string;
4
+ clientId: string;
4
5
  }) => {
5
6
  exists: boolean;
6
7
  };
7
- export declare const unsubscribeFromFileExistenceWatchers: ({ file, remotionRoot, }: {
8
+ export declare const unsubscribeFromFileExistenceWatchers: ({ file, remotionRoot, clientId, }: {
8
9
  file: string;
9
10
  remotionRoot: string;
11
+ clientId: string;
10
12
  }) => void;
13
+ export declare const unsubscribeClientFileExistenceWatchers: (clientId: string) => void;
@@ -3,12 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.unsubscribeFromFileExistenceWatchers = exports.subscribeToFileExistenceWatchers = void 0;
6
+ exports.unsubscribeClientFileExistenceWatchers = exports.unsubscribeFromFileExistenceWatchers = exports.subscribeToFileExistenceWatchers = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const file_watcher_1 = require("../file-watcher");
9
9
  const live_events_1 = require("./live-events");
10
10
  const fileExistenceWatchers = {};
11
- const subscribeToFileExistenceWatchers = ({ file: relativeFile, remotionRoot, }) => {
11
+ const subscribeToFileExistenceWatchers = ({ file: relativeFile, remotionRoot, clientId, }) => {
12
12
  const file = path_1.default.resolve(remotionRoot, relativeFile);
13
13
  const { unwatch, exists } = (0, file_watcher_1.installFileWatcher)({
14
14
  file,
@@ -33,14 +33,30 @@ const subscribeToFileExistenceWatchers = ({ file: relativeFile, remotionRoot, })
33
33
  }
34
34
  },
35
35
  });
36
- fileExistenceWatchers[file] = unwatch;
36
+ if (!fileExistenceWatchers[clientId]) {
37
+ fileExistenceWatchers[clientId] = {};
38
+ }
39
+ fileExistenceWatchers[clientId][file] = unwatch;
37
40
  return { exists };
38
41
  };
39
42
  exports.subscribeToFileExistenceWatchers = subscribeToFileExistenceWatchers;
40
- const unsubscribeFromFileExistenceWatchers = ({ file, remotionRoot, }) => {
41
- var _a;
43
+ const unsubscribeFromFileExistenceWatchers = ({ file, remotionRoot, clientId, }) => {
44
+ var _a, _b;
42
45
  const actualPath = path_1.default.resolve(remotionRoot, file);
43
- (_a = fileExistenceWatchers[actualPath]) === null || _a === void 0 ? void 0 : _a.call(fileExistenceWatchers);
44
- delete fileExistenceWatchers[actualPath];
46
+ if (!fileExistenceWatchers[clientId]) {
47
+ return;
48
+ }
49
+ (_b = (_a = fileExistenceWatchers[clientId])[actualPath]) === null || _b === void 0 ? void 0 : _b.call(_a);
50
+ delete fileExistenceWatchers[clientId][actualPath];
45
51
  };
46
52
  exports.unsubscribeFromFileExistenceWatchers = unsubscribeFromFileExistenceWatchers;
53
+ const unsubscribeClientFileExistenceWatchers = (clientId) => {
54
+ if (!fileExistenceWatchers[clientId]) {
55
+ return;
56
+ }
57
+ Object.values(fileExistenceWatchers[clientId]).forEach((unwatch) => {
58
+ unwatch();
59
+ });
60
+ delete fileExistenceWatchers[clientId];
61
+ };
62
+ exports.unsubscribeClientFileExistenceWatchers = unsubscribeClientFileExistenceWatchers;
@@ -1,12 +1,17 @@
1
1
  import type { StaticFile } from 'remotion';
2
- export declare const initPublicFolderWatch: ({ publicDir, remotionRoot, onUpdate, }: {
2
+ export declare const initPublicFolderWatch: ({ publicDir, onUpdate, staticHash, }: {
3
3
  publicDir: string;
4
4
  remotionRoot: string;
5
5
  onUpdate: () => void;
6
+ staticHash: string;
6
7
  }) => void;
7
- export declare const watchPublicFolder: ({ publicDir, remotionRoot, onUpdate, }: {
8
+ export declare const fetchFolder: ({ publicDir, staticHash, }: {
9
+ publicDir: string;
10
+ staticHash: string;
11
+ }) => void;
12
+ export declare const watchPublicFolder: ({ publicDir, onUpdate, staticHash, }: {
8
13
  publicDir: string;
9
- remotionRoot: string;
10
14
  onUpdate: () => void;
15
+ staticHash: string;
11
16
  }) => void;
12
17
  export declare const getFiles: () => StaticFile[];
@@ -3,32 +3,33 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getFiles = exports.watchPublicFolder = exports.initPublicFolderWatch = void 0;
6
+ exports.getFiles = exports.watchPublicFolder = exports.fetchFolder = exports.initPublicFolderWatch = void 0;
7
7
  const bundler_1 = require("@remotion/bundler");
8
8
  const fs_1 = require("fs");
9
9
  const path_1 = __importDefault(require("path"));
10
- const write_files_definition_file_1 = require("./write-files-definition-file");
11
10
  let files = [];
12
- const initPublicFolderWatch = ({ publicDir, remotionRoot, onUpdate, }) => {
13
- fetchFolder({ publicDir, remotionRoot });
14
- (0, exports.watchPublicFolder)({ publicDir, remotionRoot, onUpdate });
11
+ const initPublicFolderWatch = ({ publicDir, onUpdate, staticHash, }) => {
12
+ (0, exports.fetchFolder)({ publicDir, staticHash });
13
+ (0, exports.watchPublicFolder)({ publicDir, onUpdate, staticHash });
15
14
  };
16
15
  exports.initPublicFolderWatch = initPublicFolderWatch;
17
- const fetchFolder = ({ publicDir, remotionRoot, }) => {
16
+ const fetchFolder = ({ publicDir, staticHash, }) => {
18
17
  files = bundler_1.BundlerInternals.readRecursively({
19
18
  folder: '.',
20
19
  startPath: publicDir,
20
+ staticHash,
21
+ limit: 1000,
21
22
  }).map((f) => {
22
23
  return {
23
24
  ...f,
24
- path: f.path.split(path_1.default.sep).join('/'),
25
+ name: f.name.split(path_1.default.sep).join('/'),
25
26
  };
26
27
  });
27
- (0, write_files_definition_file_1.writeFilesDefinitionFile)(files, remotionRoot);
28
28
  };
29
- const watchPublicFolder = ({ publicDir, remotionRoot, onUpdate, }) => {
29
+ exports.fetchFolder = fetchFolder;
30
+ const watchPublicFolder = ({ publicDir, onUpdate, staticHash, }) => {
30
31
  (0, fs_1.watch)(publicDir, { recursive: true }, () => {
31
- fetchFolder({ publicDir, remotionRoot });
32
+ (0, exports.fetchFolder)({ publicDir, staticHash });
32
33
  onUpdate();
33
34
  });
34
35
  };
@@ -69,11 +69,13 @@ export declare type OpenInFileExplorerRequest = {
69
69
  };
70
70
  export declare type SubscribeToFileExistenceRequest = {
71
71
  file: string;
72
+ clientId: string;
72
73
  };
73
74
  export declare type SubscribeToFileExistenceResponse = {
74
75
  exists: boolean;
75
76
  };
76
77
  export declare type UnsubscribeFromFileExistenceRequest = {
77
78
  file: string;
79
+ clientId: string;
78
80
  };
79
81
  export {};
@@ -50,6 +50,8 @@ const processVideoJob = async ({ job, remotionRoot, entryPoint, onProgress, addC
50
50
  shouldOutputImageSequence: false,
51
51
  addCleanupCallback,
52
52
  outputLocationFromUI: job.outName,
53
+ uiCodec: job.codec,
54
+ uiImageFormat: job.imageFormat,
53
55
  });
54
56
  // TODO: Allow cancel signal
55
57
  // TODO: Accept CLI options
@@ -10,8 +10,7 @@ const handleAddRender = ({ input, entryPoint, remotionRoot, }) => {
10
10
  remotionRoot,
11
11
  job: {
12
12
  cleanup: [],
13
- // TODO: Allow to change codec
14
- codec: 'h264',
13
+ codec: input.codec,
15
14
  compositionId: input.compositionId,
16
15
  deletedOutputLocation: false,
17
16
  type: 'video',
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.subscribeToFileExistence = void 0;
4
4
  const file_existence_watchers_1 = require("../file-existence-watchers");
5
- const subscribeToFileExistence = ({ input: { file }, remotionRoot }) => {
6
- // TODO: What if the user reloads the page? The file watcher doesn't get cleared
5
+ const subscribeToFileExistence = ({ input: { file, clientId }, remotionRoot }) => {
7
6
  const { exists } = (0, file_existence_watchers_1.subscribeToFileExistenceWatchers)({
8
7
  file,
9
8
  remotionRoot,
9
+ clientId,
10
10
  });
11
11
  return Promise.resolve({ exists });
12
12
  };
@@ -3,7 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.unsubscribeFromFileExistence = void 0;
4
4
  const file_existence_watchers_1 = require("../file-existence-watchers");
5
5
  const unsubscribeFromFileExistence = ({ input, remotionRoot }) => {
6
- (0, file_existence_watchers_1.unsubscribeFromFileExistenceWatchers)({ file: input.file, remotionRoot });
6
+ (0, file_existence_watchers_1.unsubscribeFromFileExistenceWatchers)({
7
+ file: input.file,
8
+ clientId: input.clientId,
9
+ remotionRoot,
10
+ });
7
11
  return Promise.resolve(undefined);
8
12
  };
9
13
  exports.unsubscribeFromFileExistence = unsubscribeFromFileExistence;
@@ -1,6 +1,6 @@
1
1
  import type { IncomingMessage, ServerResponse } from 'http';
2
2
  import type { LiveEventsServer } from './live-events';
3
- export declare const handleRoutes: ({ hash, hashPrefix, request, response, liveEventsServer, getCurrentInputProps, getEnvVariables, remotionRoot, userPassedPublicDir, }: {
3
+ export declare const handleRoutes: ({ hash, hashPrefix, request, response, liveEventsServer, getCurrentInputProps, getEnvVariables, remotionRoot, publicDir, }: {
4
4
  hash: string;
5
5
  hashPrefix: string;
6
6
  request: IncomingMessage;
@@ -9,5 +9,5 @@ export declare const handleRoutes: ({ hash, hashPrefix, request, response, liveE
9
9
  getCurrentInputProps: () => object;
10
10
  getEnvVariables: () => Record<string, string>;
11
11
  remotionRoot: string;
12
- userPassedPublicDir: string | null;
12
+ publicDir: string;
13
13
  }) => void | Promise<void>;
@@ -14,6 +14,7 @@ const get_file_source_1 = require("./error-overlay/react-overlay/utils/get-file-
14
14
  const open_in_editor_1 = require("./error-overlay/react-overlay/utils/open-in-editor");
15
15
  const get_package_manager_1 = require("./get-package-manager");
16
16
  const project_info_1 = require("./project-info");
17
+ const public_folder_1 = require("./public-folder");
17
18
  const serve_static_1 = require("./serve-static");
18
19
  const update_available_1 = require("./update-available");
19
20
  const handleUpdate = async (remotionRoot, _, response) => {
@@ -27,13 +28,14 @@ const static404 = (response) => {
27
28
  response.writeHead(404);
28
29
  response.end('The static/ prefix has been changed, this URL is no longer valid.');
29
30
  };
30
- const handleFallback = async ({ remotionRoot, hash, response, getCurrentInputProps, getEnvVariables, }) => {
31
+ const handleFallback = async ({ remotionRoot, hash, response, getCurrentInputProps, getEnvVariables, publicDir, }) => {
31
32
  var _a;
32
33
  const [edit] = await editorGuess;
33
34
  const displayName = (0, open_in_editor_1.getDisplayNameForEditor)(edit ? edit.command : null);
34
35
  response.setHeader('content-type', 'text/html');
35
36
  response.writeHead(200);
36
37
  const packageManager = (0, get_package_manager_1.getPackageManager)(remotionRoot, undefined);
38
+ (0, public_folder_1.fetchFolder)({ publicDir, staticHash: hash });
37
39
  response.end(bundler_1.BundlerInternals.indexHtml({
38
40
  staticHash: hash,
39
41
  baseDir: '/',
@@ -43,6 +45,7 @@ const handleFallback = async ({ remotionRoot, hash, response, getCurrentInputPro
43
45
  remotionRoot,
44
46
  previewServerCommand: packageManager === 'unknown' ? null : packageManager.startCommand,
45
47
  numberOfAudioTags: (_a = parse_command_line_1.parsedCli['number-of-shared-audio-tags']) !== null && _a !== void 0 ? _a : (0, number_of_shared_audio_tags_1.getNumberOfSharedAudioTags)(),
48
+ publicFiles: (0, public_folder_1.getFiles)(),
46
49
  includeFavicon: true,
47
50
  title: 'Remotion Preview',
48
51
  }));
@@ -124,7 +127,7 @@ const handleFavicon = (_, response) => {
124
127
  const readStream = (0, fs_1.createReadStream)(filePath);
125
128
  readStream.pipe(response);
126
129
  };
127
- const handleRoutes = ({ hash, hashPrefix, request, response, liveEventsServer, getCurrentInputProps, getEnvVariables, remotionRoot, userPassedPublicDir, }) => {
130
+ const handleRoutes = ({ hash, hashPrefix, request, response, liveEventsServer, getCurrentInputProps, getEnvVariables, remotionRoot, publicDir, }) => {
128
131
  const url = new URL(request.url, 'http://localhost');
129
132
  if (url.pathname === '/api/update') {
130
133
  return handleUpdate(remotionRoot, request, response);
@@ -150,9 +153,6 @@ const handleRoutes = ({ hash, hashPrefix, request, response, liveEventsServer, g
150
153
  return liveEventsServer.router(request, response);
151
154
  }
152
155
  if (url.pathname.startsWith(hash)) {
153
- const publicDir = userPassedPublicDir
154
- ? path_1.default.resolve(remotionRoot, userPassedPublicDir)
155
- : path_1.default.join(remotionRoot, 'public');
156
156
  return (0, serve_static_1.serveStatic)(publicDir, hash, request, response);
157
157
  }
158
158
  if (url.pathname.startsWith(hashPrefix)) {
@@ -164,6 +164,7 @@ const handleRoutes = ({ hash, hashPrefix, request, response, liveEventsServer, g
164
164
  response,
165
165
  getCurrentInputProps,
166
166
  getEnvVariables,
167
+ publicDir,
167
168
  });
168
169
  };
169
170
  exports.handleRoutes = handleRoutes;
@@ -1,6 +1,8 @@
1
1
  import type { WebpackOverrideFn } from 'remotion';
2
2
  import type { LiveEventsServer } from './live-events';
3
- export declare const startServer: (entry: string, userDefinedComponent: string, options: {
3
+ export declare const startServer: (options: {
4
+ entry: string;
5
+ userDefinedComponent: string;
4
6
  webpackOverride: WebpackOverrideFn;
5
7
  getCurrentInputProps: () => object;
6
8
  getEnvVariables: () => Record<string, string>;
@@ -8,8 +10,11 @@ export declare const startServer: (entry: string, userDefinedComponent: string,
8
10
  maxTimelineTracks?: number;
9
11
  remotionRoot: string;
10
12
  keyboardShortcutsEnabled: boolean;
13
+ publicDir: string;
11
14
  userPassedPublicDir: string | null;
12
15
  poll: number | null;
16
+ hash: string;
17
+ hashPrefix: string;
13
18
  }) => Promise<{
14
19
  port: number;
15
20
  liveEventsServer: LiveEventsServer;
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.startServer = void 0;
7
7
  const bundler_1 = require("@remotion/bundler");
8
8
  const renderer_1 = require("@remotion/renderer");
9
- const crypto_1 = __importDefault(require("crypto"));
10
9
  const fs_1 = __importDefault(require("fs"));
11
10
  const http_1 = __importDefault(require("http"));
12
11
  const os_1 = __importDefault(require("os"));
@@ -17,12 +16,12 @@ const dev_middleware_1 = require("./dev-middleware");
17
16
  const hot_middleware_1 = require("./hot-middleware");
18
17
  const live_events_1 = require("./live-events");
19
18
  const routes_1 = require("./routes");
20
- const startServer = async (entry, userDefinedComponent, options) => {
19
+ const startServer = async (options) => {
21
20
  var _a, _b, _c, _d;
22
21
  const tmpDir = await fs_1.default.promises.mkdtemp(path_1.default.join(os_1.default.tmpdir(), 'react-motion-graphics'));
23
22
  const [, config] = bundler_1.BundlerInternals.webpackConfig({
24
- entry,
25
- userDefinedComponent,
23
+ entry: options.entry,
24
+ userDefinedComponent: options.userDefinedComponent,
26
25
  outDir: tmpDir,
27
26
  environment: 'development',
28
27
  webpackOverride: (_a = options === null || options === void 0 ? void 0 : options.webpackOverride) !== null && _a !== void 0 ? _a : config_1.ConfigInternals.getWebpackOverrideFn(),
@@ -37,8 +36,6 @@ const startServer = async (entry, userDefinedComponent, options) => {
37
36
  poll: options.poll,
38
37
  });
39
38
  const compiler = (0, bundler_1.webpack)(config);
40
- const hashPrefix = '/static-';
41
- const hash = `${hashPrefix}${crypto_1.default.randomBytes(6).toString('hex')}`;
42
39
  const wdmMiddleware = (0, dev_middleware_1.wdm)(compiler);
43
40
  const whm = (0, hot_middleware_1.webpackHotMiddleware)(compiler);
44
41
  const liveEventsServer = (0, live_events_1.makeLiveEventsRouter)();
@@ -57,15 +54,15 @@ const startServer = async (entry, userDefinedComponent, options) => {
57
54
  })
58
55
  .then(() => {
59
56
  return (0, routes_1.handleRoutes)({
60
- hash,
61
- hashPrefix,
57
+ hash: options.hash,
58
+ hashPrefix: options.hashPrefix,
62
59
  request,
63
60
  response,
64
61
  liveEventsServer,
65
62
  getCurrentInputProps: options.getCurrentInputProps,
66
63
  getEnvVariables: options.getEnvVariables,
67
64
  remotionRoot: options.remotionRoot,
68
- userPassedPublicDir: options.userPassedPublicDir,
65
+ publicDir: options.publicDir,
69
66
  });
70
67
  })
71
68
  .catch((err) => {
package/dist/preview.js CHANGED
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.previewCommand = void 0;
7
7
  const better_opn_1 = __importDefault(require("better-opn"));
8
+ const crypto_1 = __importDefault(require("crypto"));
8
9
  const path_1 = __importDefault(require("path"));
9
10
  const chalk_1 = require("./chalk");
10
11
  const config_1 = require("./config");
@@ -14,6 +15,8 @@ const get_input_props_1 = require("./get-input-props");
14
15
  const get_network_address_1 = require("./get-network-address");
15
16
  const log_1 = require("./log");
16
17
  const parse_command_line_1 = require("./parse-command-line");
18
+ const get_absolute_public_dir_1 = require("./preview-server/get-absolute-public-dir");
19
+ const public_folder_1 = require("./preview-server/public-folder");
17
20
  const start_server_1 = require("./preview-server/start-server");
18
21
  const noop = () => undefined;
19
22
  let liveEventsListener = null;
@@ -79,16 +82,40 @@ const previewCommand = async (remotionRoot, args) => {
79
82
  });
80
83
  });
81
84
  });
82
- const { port, liveEventsServer } = await (0, start_server_1.startServer)(path_1.default.resolve(__dirname, 'previewEntry.js'), fullPath, {
85
+ const publicDir = (0, get_absolute_public_dir_1.getAbsolutePublicDir)({
86
+ userPassedPublicDir: config_1.ConfigInternals.getPublicDir(),
87
+ remotionRoot,
88
+ });
89
+ const hashPrefix = '/static-';
90
+ const staticHash = `${hashPrefix}${crypto_1.default.randomBytes(6).toString('hex')}`;
91
+ (0, public_folder_1.initPublicFolderWatch)({
92
+ publicDir,
93
+ remotionRoot,
94
+ onUpdate: () => {
95
+ waitForLiveEventsListener().then((listener) => {
96
+ listener.sendEventToClient({
97
+ type: 'new-public-folder',
98
+ files: (0, public_folder_1.getFiles)(),
99
+ });
100
+ });
101
+ },
102
+ staticHash,
103
+ });
104
+ const { port, liveEventsServer } = await (0, start_server_1.startServer)({
105
+ entry: path_1.default.resolve(__dirname, 'previewEntry.js'),
106
+ userDefinedComponent: fullPath,
83
107
  getCurrentInputProps: () => inputProps,
84
108
  getEnvVariables: () => envVariables,
85
109
  port: desiredPort,
86
110
  maxTimelineTracks: config_1.ConfigInternals.getMaxTimelineTracks(),
87
111
  remotionRoot,
88
112
  keyboardShortcutsEnabled: config_1.ConfigInternals.getKeyboardShortcutsEnabled(),
89
- userPassedPublicDir: config_1.ConfigInternals.getPublicDir(),
113
+ publicDir,
90
114
  webpackOverride: config_1.ConfigInternals.getWebpackOverrideFn(),
91
115
  poll: config_1.ConfigInternals.getWebpackPolling(),
116
+ userPassedPublicDir: config_1.ConfigInternals.getPublicDir(),
117
+ hash: staticHash,
118
+ hashPrefix,
92
119
  });
93
120
  setLiveEventsListener(liveEventsServer);
94
121
  const networkAddress = (0, get_network_address_1.getNetworkAddress)();
@@ -1,6 +1,6 @@
1
- import type { Browser, BrowserExecutable, ChromiumOptions, FfmpegExecutable, FrameRange, ImageFormat, LogLevel } from '@remotion/renderer';
1
+ import type { Browser, BrowserExecutable, ChromiumOptions, Codec, FfmpegExecutable, FrameRange, ImageFormat, LogLevel } from '@remotion/renderer';
2
2
  import type { JobProgressCallback } from '../preview-server/render-queue/job';
3
- export declare const renderCompFlow: ({ remotionRoot, fullEntryPoint, ffmpegExecutable, ffprobeExecutable, indent, logLevel, browserExecutable, browser, chromiumOptions, scale, shouldOutputImageSequence, publicDir, inputProps, envVariables, puppeteerTimeout, port, height, width, remainingArgs, compositionIdFromUi, entryPointReason, overwrite, quiet, concurrency, frameRange, everyNthFrame, configFileImageFormat, outputLocationFromUI, quality, onProgress, addCleanupCallback, }: {
3
+ export declare const renderCompFlow: ({ remotionRoot, fullEntryPoint, ffmpegExecutable, ffprobeExecutable, indent, logLevel, browserExecutable, browser, chromiumOptions, scale, shouldOutputImageSequence, publicDir, inputProps, envVariables, puppeteerTimeout, port, height, width, remainingArgs, compositionIdFromUi, entryPointReason, overwrite, quiet, concurrency, frameRange, everyNthFrame, configFileImageFormat, outputLocationFromUI, quality, onProgress, addCleanupCallback, uiCodec, uiImageFormat, }: {
4
4
  remotionRoot: string;
5
5
  fullEntryPoint: string;
6
6
  entryPointReason: string;
@@ -32,4 +32,6 @@ export declare const renderCompFlow: ({ remotionRoot, fullEntryPoint, ffmpegExec
32
32
  quality: number | undefined;
33
33
  onProgress: JobProgressCallback;
34
34
  addCleanupCallback: (cb: () => Promise<void>) => void;
35
+ uiCodec: Codec | null;
36
+ uiImageFormat: ImageFormat | null;
35
37
  }) => Promise<void>;
@@ -9,17 +9,21 @@ const fs_1 = __importDefault(require("fs"));
9
9
  const os_1 = __importDefault(require("os"));
10
10
  const path_1 = __importDefault(require("path"));
11
11
  const chalk_1 = require("../chalk");
12
+ const config_1 = require("../config");
12
13
  const get_cli_options_1 = require("../get-cli-options");
13
14
  const get_composition_with_dimension_override_1 = require("../get-composition-with-dimension-override");
14
15
  const get_filename_1 = require("../get-filename");
16
+ const get_final_output_codec_1 = require("../get-final-output-codec");
15
17
  const get_render_media_options_1 = require("../get-render-media-options");
16
18
  const image_formats_1 = require("../image-formats");
17
19
  const log_1 = require("../log");
20
+ const parse_command_line_1 = require("../parse-command-line");
18
21
  const progress_bar_1 = require("../progress-bar");
19
22
  const setup_cache_1 = require("../setup-cache");
20
23
  const truthy_1 = require("../truthy");
21
24
  const user_passed_output_location_1 = require("../user-passed-output-location");
22
- const renderCompFlow = async ({ remotionRoot, fullEntryPoint, ffmpegExecutable, ffprobeExecutable, indent, logLevel, browserExecutable, browser, chromiumOptions, scale, shouldOutputImageSequence, publicDir, inputProps, envVariables, puppeteerTimeout, port, height, width, remainingArgs, compositionIdFromUi, entryPointReason, overwrite, quiet, concurrency, frameRange, everyNthFrame, configFileImageFormat, outputLocationFromUI, quality, onProgress, addCleanupCallback, }) => {
25
+ const renderCompFlow = async ({ remotionRoot, fullEntryPoint, ffmpegExecutable, ffprobeExecutable, indent, logLevel, browserExecutable, browser, chromiumOptions, scale, shouldOutputImageSequence, publicDir, inputProps, envVariables, puppeteerTimeout, port, height, width, remainingArgs, compositionIdFromUi, entryPointReason, overwrite, quiet, concurrency, frameRange, everyNthFrame, configFileImageFormat, outputLocationFromUI, quality, onProgress, addCleanupCallback, uiCodec, uiImageFormat, }) => {
26
+ var _a;
23
27
  const downloads = [];
24
28
  const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
25
29
  addCleanupCallback(() => renderer_1.RenderInternals.cleanDownloadMap(downloadMap));
@@ -90,10 +94,12 @@ const renderCompFlow = async ({ remotionRoot, fullEntryPoint, ffmpegExecutable,
90
94
  args: remainingArgs,
91
95
  compositionIdFromUi,
92
96
  });
93
- // TODO: Should use codec from UI if explicitly specified
94
- const { codec, reason: codecReason } = (0, get_cli_options_1.getFinalCodec)({
97
+ const { codec, reason: codecReason } = (0, get_final_output_codec_1.getFinalOutputCodec)({
98
+ cliFlag: parse_command_line_1.parsedCli.codec,
99
+ configFile: (_a = config_1.ConfigInternals.getOutputCodecOrUndefined()) !== null && _a !== void 0 ? _a : null,
95
100
  downloadName: null,
96
101
  outName: (0, user_passed_output_location_1.getUserPassedOutputLocation)(argsAfterComposition),
102
+ uiCodec,
97
103
  });
98
104
  (0, get_cli_options_1.validateFfmepgCanUseCodec)(codec, remotionRoot);
99
105
  renderer_1.RenderInternals.validateEvenDimensionsWithCodec({
@@ -159,8 +165,11 @@ const renderCompFlow = async ({ remotionRoot, fullEntryPoint, ffmpegExecutable,
159
165
  onProgress({ progress, message });
160
166
  return renderProgress.update(output);
161
167
  };
162
- // TODO: Should take the one from the UI instead
163
- const imageFormat = (0, image_formats_1.getImageFormat)(shouldOutputImageSequence ? undefined : codec, configFileImageFormat);
168
+ const imageFormat = (0, image_formats_1.getImageFormat)({
169
+ codec: shouldOutputImageSequence ? undefined : codec,
170
+ configFileImageFormat,
171
+ uiImageFormat,
172
+ });
164
173
  if (shouldOutputImageSequence) {
165
174
  fs_1.default.mkdirSync(absoluteOutputFile, {
166
175
  recursive: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cli",
3
- "version": "3.3.25",
3
+ "version": "3.3.26",
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.25",
26
- "@remotion/media-utils": "3.3.25",
27
- "@remotion/player": "3.3.25",
28
- "@remotion/renderer": "3.3.25",
25
+ "@remotion/bundler": "3.3.26",
26
+ "@remotion/media-utils": "3.3.26",
27
+ "@remotion/player": "3.3.26",
28
+ "@remotion/renderer": "3.3.26",
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.25",
34
+ "remotion": "3.3.26",
35
35
  "semver": "7.3.5",
36
36
  "source-map": "0.6.1"
37
37
  },
@@ -44,8 +44,8 @@
44
44
  "@types/minimist": "^1.2.2",
45
45
  "@types/node": "^16.7.5",
46
46
  "@types/prompts": "^2.4.1",
47
- "@types/react": "18.0.23",
48
- "@types/react-dom": "18.0.0",
47
+ "@types/react": "18.0.26",
48
+ "@types/react-dom": "18.0.10",
49
49
  "@types/semver": "^7.3.4",
50
50
  "@types/webpack-env": "^1.16.0",
51
51
  "@typescript-eslint/eslint-plugin": "5.18.0",
@@ -71,5 +71,5 @@
71
71
  "publishConfig": {
72
72
  "access": "public"
73
73
  },
74
- "gitHead": "48e46dd2ede8fe903bf0139cebd6f546d7f2b5e0"
74
+ "gitHead": "8efe8771f7c2b1d22bd50e8c81cc37ae054dfae9"
75
75
  }