renderStill()
Part of the @remotion/renderer
package. Available from v2.3.
Renders a single frame to an image and writes it to the specified output location.
If you want to render a video, use renderMedia() instead.
Example usage
You first need to bundle the project and fetch the compositions. Read the code snippet on the site for server-side rendering for an example how to come up with the bundleLocation
and composition
variables.
ts
awaitrenderStill ({composition ,serveUrl :bundleLocation ,output : "/tmp/still.png",inputProps : {custom : "data",},});
ts
awaitrenderStill ({composition ,serveUrl :bundleLocation ,output : "/tmp/still.png",inputProps : {custom : "data",},});
Arguments
Takes an object with the following properties:
composition
VideoConfig
An object describing a composition using id
, width
, height
, fps
and durationInFrames
, defaultProps
and props
.
Call selectComposition()
or getCompositions()
to get an array of possible configs.
serveUrl
Either a local path pointing to a Remotion Webpack bundle generated by bundle()
or a URL where the bundle is hosted.
output
An absolute path to where the frame should be rendered to.
inputProps?
optional
Custom props which will be passed to the component. Useful for rendering videos with dynamic content. Can be an object of any shape.
frame?
optional - default: 0
Which frame should be rendered based on its number. Frames are zero-indexed.
From v3.2.27, negative values are allowed, with -1
being the last frame.
imageFormat?
optional - default: "png"
Which output format the image should have, either png
, jpeg
, webp
or pdf
.
scale?
optional
Scales the output dimensions by a factor. See Scaling to learn more about this feature.
jpegQuality?
optional - default: undefined
Sets the JPEG quality - must be an integer between 0 and 100 and can only be passed if imageFormat
is set to jpeg
.
puppeteerInstance?
optional - default null
An already open Puppeteer Browser
instance. Reusing a browser across multiple function calls can speed up the rendering process. You are responsible for opening and closing the browser yourself. If you don't specify this option, a new browser will be opened and closed at the end.
envVariables?
optional - default {}
An object containing key-value pairs of environment variables which will be injected into your Remotion project and which can be accessed by reading the global process.env
object.
logLevel?
v4.0.0
One of verbose
, info
, warn
, error
. Determines how much is being logged to the console.
verbose
will also log console.log
's from the browser.
overwrite?
optional - default true
Whether the file should be overwritten if the output already exists.
browserExecutable?
v2.3.1
optional
A string defining the absolute path on disk of the browser executable that should be used. By default Remotion will try to detect it automatically and download one if none is available.
onBrowserLog?
v3.3.93
optional
Gets called when your project calls console.log
or another method from console. See the documentation for renderFrames
for more information.
timeoutInMilliseconds?
v2.6.3
optional
A number describing how long the render may take to resolve all delayRender()
calls before it times out. Default: 30000
cancelSignal?
v3.0.15
optional
A token that allows the render to be cancelled. See: makeCancelSignal()
chromiumOptions?
v2.6.5
optional
Allows you to set certain Chromium / Google Chrome flags. See: Chromium flags.
Chromium flags need to be set at browser launch. If you pass an instance using puppeteerInstance
, options passed to renderStill()
will not apply, but rather the flags that have been passed to openBrowser()
.
disableWebSecurity
boolean - default false
This will most notably disable CORS among other security features.
ignoreCertificateErrors
boolean - default false
Results in invalid SSL certificates, such as self-signed ones, being ignored.
headless
boolean - default true
If disabled, the render will open an actual Chrome window where you can see the render happen.
gl
string
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"
null
- Chromiums default
Default: null
.
Default for Lambda rendering: "swangle"
.
userAgent
v3.3.83
Lets you set a custom user agent that the headless Chrome browser assumes.
dumpBrowserLogs?
dumpBrowserLogs?
optional - default false
, deprecated in v4.0
Deprecated in favor of logLevel
.
quality?
quality?
Renamed to jpegQuality
in v4.0.0
.
Return Value
The return value is a promise that resolves to an object with the following keys:
buffer
: (available from v3.3.9) ABuffer
that only exists if nooutput
option was provided. Otherwise null.