Remotion Tutorials

Master CLI Rendering

Your complete guide to rendering videos from the command line. Learn essential commands, output formats, quality settings, batch rendering, and automation techniques for production-ready video workflows.

Commands Formats Quality Batch Automation
01

Basic Commands

Get started with the essential Remotion CLI commands for rendering videos and generating stills from your compositions.

Tip

The Render Command

The core command for rendering videos is npx remotion render <composition-id>. This renders your composition to the default out folder as an MP4 file.

Rule

Specifying Output Path

Control where your video is saved by adding an output path: npx remotion render MyVideo ./output/video.mp4. You can also use the --output flag for clarity.

Remotion CLI Documentation
This project

Quick Render Example

Render a composition named 'Intro' to a specific location: npx remotion render Intro ./renders/intro-final.mp4

Tip

Rendering Stills

Generate a single frame as an image with npx remotion still MyVideo output.png. Use --frame=30 to specify which frame to capture.

Rule

Passing Props

Pass custom props to your composition using --props='{ "title": "Hello" }' for inline JSON, or --props=./props.json to load from a file.

Remotion Props Documentation
Tip

Environment Variables

Load environment variables from a file with --env-file=.env.production. This is useful for managing API keys and configuration across environments.

02

Output Formats

Choose the right video codec and container format for your use case, from web-optimized MP4 to professional ProRes masters.

Rule

Video Codecs

Select your codec with the --codec flag. Each codec offers different tradeoffs between quality, file size, and compatibility.

CodecFormatBest For
h264MP4Web, universal playback
h265MP4Smaller files, modern devices
vp8WebMWeb, open format
vp9WebMHigh quality web video
proresMOVProfessional editing
Remotion Encoding Guide
Tip

H.264 for Web

Use --codec=h264 for maximum compatibility. This is the default codec and works on virtually all devices and platforms.

This project

ProRes for Editing

For professional workflows, render with ProRes: npx remotion render MyVideo --codec=prores --prores-profile=hq. Available profiles: 4444-xq, 4444, hq, standard, light, proxy.

Rule

Audio Codecs

Set the audio codec independently with --audio-codec. Options include aac (default, best compatibility), mp3, and wav (uncompressed).

Remotion Audio Documentation
Tip

Image Sequences

Export as individual frames instead of a video with --sequence. Customize naming with --image-sequence-pattern='frame_[frame].[ext]'.

This project

WebM for Modern Web

For modern browsers with smaller file sizes: npx remotion render MyVideo output.webm --codec=vp9

03

Quality Settings

Fine-tune video quality, compression, and file size to achieve the perfect balance for your delivery requirements.

Rule

Constant Rate Factor (CRF)

CRF controls the quality-to-size ratio. Lower values mean higher quality and larger files. The scale is 0-51, with 23 being the default.

  • CRF 18: High quality, larger file
  • CRF 23: Balanced (default)
  • CRF 28: Lower quality, smaller file
FFmpeg CRF Guide
Tip

Setting CRF

Use --crf=18 for high-quality renders where file size isn't a concern. For web delivery, --crf=23 offers a good balance.

This project

High Quality Master

Create a high-quality master file: npx remotion render MyVideo master.mp4 --crf=18 --image-format=png

Rule

Video Bitrate

For precise file size control, use bitrate instead of CRF: --video-bitrate=5M for 5 Mbps or --video-bitrate=2500K for 2.5 Mbps.

Remotion Encoding Guide
Tip

Audio Bitrate

Control audio quality with --audio-bitrate=320k for high quality or --audio-bitrate=192k for standard quality. Higher bitrates preserve audio fidelity.

This project

Web-Optimized Output

Optimize for web delivery: npx remotion render MyVideo web.mp4 --codec=h264 --crf=23 --audio-codec=aac --audio-bitrate=192k

04

Batch Rendering

Render multiple compositions efficiently using scripts, loops, and parallel processing techniques.

Tip

Shell Script Approach

Create a shell script to render multiple compositions sequentially. This is the simplest approach for batch rendering a known set of videos.

This project

Batch Script Example

Create a render-all.sh script that renders each composition with consistent settings. Run with bash render-all.sh to process all videos.

  • npx remotion render Intro ./out/intro.mp4
  • npx remotion render Main ./out/main.mp4
  • npx remotion render Outro ./out/outro.mp4
Rule

Concurrency Control

Control CPU usage with --concurrency. Use --concurrency=4 for 4 threads, --concurrency=50% for half your cores, or --concurrency=100% for maximum speed.

Remotion Performance Guide
Tip

Props-Based Batch Rendering

Render the same composition with different props by creating multiple JSON files and looping through them: for f in props/*.json; do npx remotion render MyVideo --props="$f"; done

This project

Parallel Rendering

Use GNU Parallel for concurrent batch rendering: parallel npx remotion render {} ::: Comp1 Comp2 Comp3. This renders multiple compositions simultaneously.

Rule

Memory Management

For large batches, reduce concurrency to prevent out-of-memory errors: --concurrency=2 --image-format=jpeg. JPEG frames use less memory than PNG.

Remotion Troubleshooting Guide
05

Automation

Integrate Remotion rendering into automated workflows, CI/CD pipelines, and programmatic video generation systems.

Rule

Exit Codes

The CLI returns exit code 0 on success and non-zero on failure. Use this in scripts to detect errors: npx remotion render MyVideo || echo 'Render failed'

Remotion CLI Reference
Tip

CI/CD Integration

Add rendering to your CI pipeline by installing dependencies and running the render command. Use --gl=angle on Linux servers without GPU for software rendering.

This project

GitHub Actions Workflow

In your workflow file, install dependencies with npm ci, then render with npx remotion render MyVideo --gl=angle. Upload artifacts to store the output.

Rule

Programmatic Rendering

Use the @remotion/renderer package for Node.js integration. The renderMedia() function provides full control over rendering with TypeScript support.

Remotion Renderer API
Tip

Progress Callbacks

When using the Node.js API, pass an onProgress callback to track rendering progress. This enables progress bars and status updates in your application.

This project

Webhook Integration

Trigger renders via webhooks by creating an API endpoint that calls renderMedia(). Return the video URL or upload to cloud storage when complete.

Keep Learning

Related tips

Continue exploring with these related guides and tutorials.

Ready to render at scale?

Now that you've mastered CLI rendering, explore Lambda deployment for serverless video generation or browse our template library for your next project.