Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0xsline OpenChatCut RenderTimeline

From Leeroopedia
Knowledge Sources
Domains Video_Rendering, Video_Export, Encoding
Last Updated 2026-10-22 14:00 GMT

Overview

Concrete wrapper around Remotion's `renderMedia` that renders a materialized timeline state to a video/audio file in a headless Chromium browser, with codec selection, H.264 encoder options, and progress reporting.

Description

The renderTimeline function is the low-level rendering primitive in `remotion/render.mjs`. It:

  • Validates the timeline state has an items array and the output location is specified.
  • Asserts materialization — all media references in the state must be local (same-origin) paths.
  • Loads the Remotion bundle via `getServeUrl()` (pre-built composition bundle).
  • Selects the composition with `withAbortableCompositionSelection`, passing the timeline as input props.
  • Renders frames via `renderMediaOptimized` in a headless Chromium instance.
  • Codec support: H.264 (default), VP8 (WebM), ProRes 422 HQ (mezzanine), MP3, WAV.
  • H.264 options: Passes `h264Profile` and `vaapiDevice` from hardware acceleration resolution.
  • ProRes options: Uses `proResProfile: 'hq'` and `imageFormat: 'png'` for mezzanine.
  • Progress: Forwards Remotion's progress callback to the caller's `onProgress`.
  • Cancel support: Honors `signal` and Remotion's `cancelSignal`.

This is a Wrapper Doc — it wraps `@remotion/renderer`'s `renderMedia` and `selectComposition` with OpenChatCut-specific composition IDs, input props, and hardware encoder selection.

Usage

  • Export rendering: Called by `renderExportPlan` during the render stage.
  • Clip rendering: Used for single-clip sub-timeline rendering (e.g., Motion Graphics with alpha).
  • Still rendering: `renderTimelineStills` variant for contact-sheet frame extraction.

Code Reference

Source Location

Signature

export async function renderTimeline({
  state,
  project,
  timelineId,
  outputLocation,
  onProgress,
  codec = 'h264',
  frameRange,
  scale,
  videoBitrate,
  h264Profile,
  vaapiDevice,
  signal,
}) -> Promise<{ outputLocation, encoder?, encoderFallbackReason? }>

Import

import { renderTimeline } from '../remotion/render.mjs';
// Or via the re-export:
import { renderTimeline } from '../server/plugins/export-rendering.ts';

I/O Contract

Inputs

Name Type Required Description
state TimelineState Yes Materialized timeline state (local paths only)
project ProjectDoc No Full project for nested timeline
timelineId string No Timeline to render (requires project)
outputLocation string Yes Absolute output file path
codec string No h264 (default), vp8, prores, mp3, wav
frameRange [number, number] No Inclusive frame range
scale number No Render scale factor (default 1)
videoBitrate number No Target bitrate in bps
h264Profile string No H.264 profile from hardware acceleration
vaapiDevice string No VAAPI device path
onProgress (progress: number) => void No Progress callback (0–1)
signal AbortSignal No Cancellation signal

Outputs

Name Type Description
outputLocation string The output file path
encoder string Optional: encoder profile used (e.g., 'nvenc', 'vaapi')
encoderFallbackReason string Optional: reason for encoder fallback

Usage Examples

Render H.264 Video

import { renderTimeline } from '../remotion/render.mjs';

const result = await renderTimeline({
  state: materializedTimeline,
  outputLocation: '/tmp/export.mp4',
  codec: 'h264',
  scale: 1,
  onProgress: (progress) => {
    console.log(`Render: ${Math.round(progress * 100)}%`);
  },
});

if (result.encoder) {
  console.log(`Used encoder: ${result.encoder}`);
}

Render ProRes Mezzanine

const result = await renderTimeline({
  state: materializedTimeline,
  outputLocation: '/tmp/master.mov',
  codec: 'prores',
  // ProRes ignores videoBitrate and uses proResProfile='hq'
});

Related Pages

Implements Principle

Requires Environment

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment