npx remotion 渲染
根据入口点和合成 ID 渲染视频或音频,并将其保存到输出位置。
🌐 Render a video or audio based on the entry point, the composition ID and save it to the output location.
npx remotion render <entry-point|serve-url>? <composition-id> <output-location>你可以将 Serve URL 或 入口点 作为第一个参数传入,否则入口点将会被 确定 。
🌐 You may pass a Serve URL or an entry point as the first argument, otherwise the entry point will be determined.
如果未传递 composition-id,Remotion 将会要求你选择一个组合。
如果未传递 output-location,媒体将被渲染到 out 文件夹中。
🌐 If composition-id is not passed, Remotion will ask you to select a composition.
If output-location is not passed, the media will be rendered into the out folder.
标志
🌐 Flags
除了通过命令行参数选择视频和输出位置外,还支持以下标志:
🌐 Besides choosing a video and output location with the command line arguments, the following flags are supported:
--props
Input Props to pass to the selected composition of your video. Must be a serialized JSON string (--props='{"hello": "world"}') or a path to a JSON file (./path/to/props.json).
Windows 终端不支持内联 JSON 字符串,因为它会移除 " 字符,请改用文件名。
--heightv3.2.40
Overrides the height of the composition.
--widthv3.2.40
Overrides the width of the composition.
--fpsv4.0.424
Overrides the frames per second of the composition.
--durationv4.0.424
Overrides the duration in frames of the composition.
--concurrency
How many CPU threads to use. Minimum 1. The maximum is the amount of threads you have (In Node.JS os.cpus().length). You can also provide a percentage value (e.g. 50%).
--pixel-format
Sets the pixel format in FFmpeg. See the FFmpeg docs for an explanation. Acceptable values: "yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le".
--image-formatv1.4.0
The image format to use when rendering frames for a video. Must be one of "png", "jpeg", "none". Default: "jpeg". JPEG is faster, but does not support transparency.
--image-sequence-pattern v4.0.313
Pattern for naming image sequence files. Supports [frame] for the zero-padded frame number and [ext] for the file extension.
--configv1.2.0
Specify a location for the Remotion config file.
--env-filev2.2.0
Specify a location for a dotenv file. Default .env.
--jpeg-qualityv4.0.0
用于 JPEG 渲染质量的 0 到 100 之间的值 (/docs/config#setjpegquality)。在渲染 PNG 帧时不起作用。
--qualityv1.4.0
--quality在 v4.0.0 中重命名为 --jpeg-quality
🌐 Renamed to --jpeg-quality in v4.0.0
--output v4.0.0
设置输出文件路径,作为 output-location 位置参数的替代方式。
🌐 Sets the output file path, as an alternative to the output-location positional argument.
--overwrite
即使文件已存在也要写入输出。。此标志默认启用,使用 --overwrite=false 可将其禁用。
--sequencev1.4.0
Pass this flag to output an image sequence instead of a video. The default image format is JPEG. See setImageSequence() for more details.
--codecv1.4.0
h264 或 h265 或 png 或 vp8 或 vp9 或 mp3 或 aac 或 wav 或 prores 或 h264-mkv。如果你不提供 --codec,它将使用 H.264 编码器。
--audio-codecv3.3.42
Set the format of the audio that is embedded in the video. Not all codec and audio codec combinations are supported and certain combinations require a certain file extension and container format. See the table in the docs to see possible combinations.
--audio-bitratev3.2.32
Specify the target bitrate for the generated video. The syntax for FFmpeg's -b:a parameter should be used. FFmpeg may encode the video in a way that will not result in the exact audio bitrate specified. Example values: 512K for 512 kbps, 1M for 1 Mbps. Default: 320k
--video-bitratev3.2.32
Specify the target bitrate for the generated video. The syntax for FFmpeg's-b:v parameter should be used. FFmpeg may encode the video in a way that will not result in the exact video bitrate specified. Example values: 512K for 512 kbps, 1M for 1 Mbps.
--buffer-sizev4.0.78
The value for the -bufsize flag of FFmpeg. Should be used in conjunction with the encoding max rate flag.
--max-ratev4.0.78
The value for the -maxrate flag of FFmpeg. Should be used in conjunction with the encoding buffer size flag.
--prores-profilev2.1.6
Set the ProRes profile. This option is only valid if the codec has been set to prores. Possible values: "4444-xq", "4444", "hq", "standard", "light", "proxy". Default: "hq". See here for an explanation of possible values.
--x264-presetv4.2.2
Sets a x264 preset profile. Only applies to videos rendered with h264 codec.Possible values:
superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo.Default:
medium
--crfv1.4.0
设置输出的恒定速率因子 (CRF)。最小值为 0。如果你希望保持最佳质量而不太在意文件大小,请使用此速率控制模式。如果已设置 --video-bitrate,则无法设置此选项。
如果启用硬件加速,则无法设置 crf。请改用--video-bitrate 选项。
--browser-executablev1.5.0
Set a custom Chrome or Chromium executable path. By default Remotion will try to find an existing version of Chrome on your system and if not found, it will download one. This flag is useful if you don't have Chrome installed in a standard location and you want to prevent downloading an additional browser or need support for the H264 codec.
--chrome-modev4.0.248
One of headless-shell, chrome-for-testing. Default headless-shell. Use chrome-for-testing to take advantage of GPU drivers on Linux.
--scale
按你传入的因子缩放输出帧。 例如,一个 1280x720 像素的帧在缩放因子为 1.5 时将变为 1920x1080 像素的帧。矢量元素,如字体和 HTML 标记,将以更高的细节渲染。scale 必须大于 0 且小于等于 16。默认值:1。
--framesv2.0.0
Render a subset of a video. Pass a single number to render a still, or a range (e.g. 0-9) to render a subset of frames. Pass 100- to render from frame 100 to the end.
--every-nth-framev3.1.0
This option may only be set when rendering GIFs. It determines how many frames are rendered, while the other ones get skipped in order to lower the FPS of the GIF. For example, if the fps is 30, and everyNthFrame is 2, the FPS of the GIF is 15.
例如,仅每隔第二帧、每隔第三帧,依此类推。仅适用于渲染 GIF。在这里查看更多详情。
🌐 For example only every second frame, every third frame and so on. Only works for rendering GIFs. See here for more details.
--mutedv3.2.1
禁用音频输出。 此选项仅可在渲染视频时使用。
--enforce-audio-trackv3.2.1
--disallow-parallel-encodingv4.0.315
不允许渲染器同时进行帧渲染和编码。这使渲染过程更节省内存,但可能会更慢。
🌐 Disallows the renderer from doing rendering frames and encoding at the same time. This makes the rendering process more memory-efficient, but possibly slower.
--number-of-gif-loopsv3.1.0
Allows you to set the number of loops as follows:null(or omitting in the CLI) plays the GIF indefinitely.0disables looping1loops the GIF once (plays twice in total)2loops the GIF twice (plays three times in total) and so on.
--color-spacev4.0.28
Color space to use for the video. Acceptable values: "default"(default since 5.0), "bt601" (same as "default", since v4.0.424), "bt709" (since v4.0.28), "bt2020-ncl" (since v4.0.88), "bt2020-cl" (since v4.0.88), .For best color accuracy, it is recommended to also use
"png" as the image format to have accurate color transformations throughout.Only since v4.0.83, colorspace conversion is actually performed, previously it would only tag the metadata of the video.
--hardware-accelerationv4.0.228
One of
"disable", "if-possible", or "required"
. Default "disable". Encode using a hardware-accelerated encoder if
available. If set to "required" and no hardware-accelerated encoder is
available, then the render will fail.
--bundle-cachev2.0.0
Enable or disable Webpack caching. This flag is enabled by default, use --bundle-cache=false to disable caching.
--log
设置日志级别。增加或减少输出量。可接受的值:error、warn、info(默认)、verbose
--port
Set a custom HTTP server port for the Studio or the render process. If not defined, Remotion will try to find a free port.
--public-dirv3.2.13
The path of the URL where the bundle is going to be hosted. By default it is /, meaning that the bundle is going to be hosted at the root of the domain (e.g. https://localhost:3000/). If you are deploying to a subdirectory (e.g. /sites/my-site/), you should set this to the subdirectory.
--timeout
定义单个帧最多可以花多长时间来处理所有 delayRender() 调用 在超时之前,单位为毫秒。默认值:30000。
🌐 Define how long a single frame may take to resolve all delayRender() calls before it times out in milliseconds. Default: 30000.
不要将其与部署 Lambda 函数时的 --timeout 标志 混淆。
--ignore-certificate-errorsv2.6.5
Results in invalid SSL certificates in Chrome, such as self-signed ones, being ignored.
--disable-web-securityv2.6.5
This will most notably disable CORS in Chrome among other security features.
--disable-headlessv2.6.5
Deprecated - will be removed in 5.0.0. With the migration to Chrome Headless Shell, this option is not functional anymore.--disable-headlessIf disabled, the render will open an actual Chrome window where you can see the render happen. The default is headless mode.
--dark-modev4.0.381
Whether Chromium should pretend to be in dark mode by emulating the media feature 'prefers-color-scheme: dark'. Default is false.
--gl
Changelog
- From Remotion v2.6.7 until v3.0.7, the default for Remotion Lambda was
swiftshader, but from v3.0.8 the default isswangle(Swiftshader on Angle) since Chrome 101 added support for it. - From Remotion v2.4.3 until v2.6.6, the default was
angle, however it turns out to have a small memory leak that could crash long Remotion renders.
Select the OpenGL renderer backend for Chromium.
Accepted values:
"angle""egl""swiftshader""swangle""vulkan"(from Remotion v4.0.41)"angle-egl"(from Remotion v4.0.51)
The default is null, letting Chrome decide, except on Lambda where the default is "swangle"
--user-agentv3.3.83
Lets you set a custom user agent that the headless Chrome browser assumes.
--media-cache-size-in-bytesv4.0.352
Specify the maximum size of the cache that <Video> and <Audio> from @remotion/media may use combined, in bytes. The default is half of the available system memory when the render starts.
--offthreadvideo-cache-size-in-bytesv4.0.23
From v4.0, Remotion has a cache for <OffthreadVideo> frames. The default is null, corresponding to half of the system memory available when the render starts.This option allows to override the size of the cache. The higher it is, the faster the render will be, but the more memory will be used.
The used value will be printed when running in verbose mode.
Default:
null
--offthreadvideo-video-threadsv4.0.261
The number of threads that<OffthreadVideo> can start to extract frames. The default is 2. Increase carefully, as too many threads may cause instability.
--enable-multiprocess-on-linuxv4.0.42
Removes the --single-process flag that gets passed to Chromium on Linux by default. This will make the render faster because multiple processes can be used, but may cause issues with some Linux distributions or if window server libraries are missing.Default:
false until v4.0.136, then true from v4.0.137 on because newer Chrome versions don't allow rendering with the --single-process flag. This flag will be removed in Remotion v5.0.
--reprov4.0.88
Create a ZIP that you can submit to Remotion if asked for a reproduction.
--binaries-directoryv4.0.120
The directory where the platform-specific binaries and libraries that Remotion needs are located. Those include an ffmpeg and ffprobe binary, a Rust binary for various tasks, and various shared libraries. If the value is set to null, which is the default, then the path of a platform-specific package located at node_modules/@remotion/compositor-* is selected.This option is useful in environments where Remotion is not officially supported to run like bundled serverless functions or Electron.
--experimental-rspackv4.0.426
Uses Rspack instead of Webpack as the bundler for the Studio or bundle.
--for-seamless-aac-concatenationv4.0.123
If enabled, the audio is trimmed to the nearest AAC frame, which is required for seamless concatenation of AAC files. This is a requirement if you later want to combine multiple video snippets seamlessly.This option is used internally. There is currently no documentation yet for to concatenate the audio chunks.
--separate-audio-tov4.0.123
If set, the audio will not be included in the main output but rendered as a separate file at the location you pass. It is recommended to use an absolute path. If a relative path is passed, it is relative to the Remotion Root.
--metadatav4.0.216
Metadata to be embedded in the video. See here for which metadata is accepted.The parameter must be in the format of
--metadata key=value and can be passed multiple times.
--ffmpeg-executable
--ffmpeg-executable在 v4.0 中移除
🌐 removed in v4.0
设置自定义 ffmpeg 可执行文件。如果未定义,将在 PATH 中搜索 ffmpeg 可执行文件。
--ffprobe-executable v3.0.17
--ffprobe-executable在 v4.0 中移除
🌐 removed in v4.0
设置自定义 ffprobe 可执行文件。如果未定义,将在 PATH 中搜索 ffprobe 可执行文件。