render
The render command produces a recording of a Liqvid video as a "solid" (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
liqvid render
liqvid render -a <audio-file> -o <output>
liqvid render -u <url>
For example,
liqvid render -a ./audio/audio.mp4 -o out.mp4 -u http://localhost:8080
To avoid passing command line options every time, you can create a liqvid.config.ts file. This should export an object with a render key containing the options for this command. Here is an example:
// liqvid.config.ts
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.
What to render
--audio-file, -a
Path to audio file. If not specified, the video will not have audio.
--output, -o
Output filename. Defaults to ./video.mp4.
--url, -u
URL of video to render. Defaults to http://localhost:3000/dist/.
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 ./liqvid.config.ts.
Input options
--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.
--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.
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.