Skip to main content

render

The render command produces a recording of a ractive as a static (traditional mp4/webm) video file.

You will need to have ffmpeg installed and in your $PATH. In case you have issues installing it, this guide may help.

The syntax is

npx rp-master render <url> <outfile>

For example,

npx rp-master render -a ./audio/audio.mp4 http://localhost:8080 out.mp4

To avoid passing command line options every time, you can create an rp-master.config.js file. This should export an object with a render key containing the options for this command. Here is an example:

// rp-master.config.js
const os = require("os");
module.exports = {
render: {
audioFile: "./audio/audio.mp4",
concurrency: os.cpus().length,
imageFormat: "png"
},
thumbs: {
/* ... */
}
};

You can specify a different location for the configuration file using the --config option.

General options#

--browser-executable, -x#

Path to a Chrome/Chromium executable. If not specified and a suitable executable cannot be found, one will be downloaded during rendering.

--concurrency, -n#

How many threads to use. Defaults to half of the available CPUs.

--config#

Path to a configuration file to load options from. Defaults to ./rp-master.config.js.

What to render#

--audio-file, -a#

Path to audio file. If not specified, the video will not have audio.

--duration, -d#

Duration, specify as [[hh:]mm:]ss[.ms]. Cannot be used with --end.

--end, -e#

End time, specify as [[hh:]mm:]ss[.ms]. Defaults to null, meaning the end of the video. Cannot be used with --duration.

--sequence, -S#

Boolean flag to output an image sequence instead of a video. If set, <outfile> will be interpreted as a directory (and created if it does not already exist). This is useful if you want to run ffmpeg on the images yourself.

--start, -s#

Start time, specify as [[hh:]mm:]ss[.ms]. Defaults to 0, meaning the start of the video.

info

--start, --duration, and --end apply to both the audio file (if any) and the video. At this time, it is not possible to configure these separately.

Frame formatting#

--height, -h#

Video height. Defaults to 800.

--image-format, -F#

Image format for the frames, either jpeg or png. Defaults to jpeg.

--quality, -q#

Value between 0 and 100 for quality of the frames. Only applies when --image-format is jpeg.

--width, -w#

Video width. Defaults to 1280.

Video options#

The exact command that we pass to ffmpeg is

ffmpeg
-framerate <fps> -i <frames-dir> \ # frames
-ss <start> -t <duration> [audio-args] -i <audio-file> \ # audio
-pix_fmt <pixel-format> -y [video-args] <outfile> # video

See the ffmpeg documentation for available options. The -y flag (which tells ffmpeg to overwrite the output file without asking) cannot currently be overridden. If no audio file is specified, the third line will not be included.

--audio-args, -A#

Additional flags to pass to ffmpeg, applying to the audio file. If no audio file is specified, this has no effect.

--fps, -r#

Frames per second. Defaults to 30.

--pixel-format, -P#

Pixel format for ffmpeg. Defaults to yuv420p.

tip

If outfile is an mp4 video, formats other than 4:2:0 will not work reliably, c.f. Encoding for dumb players.

--video-args, -V#

Additional flags to pass to ffmpeg, applying to the video outfile.