Rendering

Render GenMotion videos to MP4, WebM, GIF, MOV or PNG frames. Frame ranges, 4K output, quality, parallel rendering, GPU mode and audio mixing.

npx genmotion render turns a project into a video file. In the Studio, Export does the same thing with the same engine.

Terminal
npx genmotion render                      # exports/<project>.mp4
npx genmotion render teaser.webm          # format from the extension
npx genmotion render --codec gif --frames 0-89
npx genmotion render --scale 2            # 3840×2160 from a 1080p project

Options#

FlagWhat it does
--codec <mp4|webm|gif|mov|png>Output format. Default: from the extension, else mp4. png writes a folder of frames
--frames <range>Part of the video: 0-89, 1s-3s, 120- (inclusive)
--scale <n>Output size multiplier, e.g. 2 for 4K from 1080p
--quality <0-100>Encoder quality. Default 80
--crf <n>Exact x264/VP9 CRF. Overrides --quality
--concurrency <n>Parallel browser tabs. Default half your cores, at most 8
--gl <swiftshader|gpu>WebGL backend. Default swiftshader
--no-audioSkip the audio mix

How a render works#

  1. 1

    Serve#

    The project is served over a loopback HTTP server. The page is the same one the dev studio shows.

  2. 2

    Capture#

    Headless Chromium seeks each frame. The engine waits for textures, fonts and media to finish loading before the frame is captured, so nothing renders half-loaded.

  3. 3

    Encode#

    Frames are piped straight into ffmpeg. With --concurrency, the frame range is split across tabs and the segments are joined without re-encoding.

  4. 4

    Mix#

    Audio from project.json is mixed in once, with trims, fades and volume applied.

Speed and consistency#

The default WebGL backend, SwiftShader, renders on the CPU. It's slower, but it produces the same pixels on every machine, which is what you want in CI and for review diffs. --gl gpu uses your graphics card and is much faster for heavy scenes.

Parallel rendering produces exactly the same frames as rendering in order, because every frame is a function of time alone. Raising --concurrency never changes the result.

Formats#

FormatUse it for
MP4 (H.264)Everywhere: websites, social, decks
WebM (VP9)Web embeds with a smaller file
GIFREADMEs, docs, chat
MOVEditing in Final Cut or Premiere
PNG framesCompositing, or your own encoder