vidmake v0.2.1
Download

Journal/remotion · migration · tutorialEntry 04 / 10

Porting a Remotion composition to vidmake

A typical Remotion video (spring, interpolate, Sequence, TransitionSeries, a mapped list, audio and a reusable component) next to its vidmake port, concept by concept, with notes on what doesn't carry over.

▸ blog-remotion-port1280×720 · 30 fps · 0:04.5Rendered by vidmake

vidmake borrows a lot from Remotion, and we're happy to say so. Remotion showed that video can be code: compositions with props, a frame-based clock, springs, sequences, transitions. vidmake keeps that model and changes the medium, from React components rendered in a browser to a JSON document rendered by a Rust binary, so that an agent can write it, check it and render it without a browser or a preview UI.

If you have Remotion projects, or an agent trained on a lot of Remotion code, the fastest way to learn vidmake is to port something. This post ports a typical short composition, side by side, and then covers what doesn't translate.

#The Remotion original

A 4.5-second launch clip: a logo springs in, a title fades in, a subtitle rises a moment later, then a slide transition to a numbered list of features. Music fades in under all of it. Here is the Remotion source, written the way we'd write it in a real project:

src/Root.tsxtsx
import {Composition} from 'remotion';import {Launch} from './Launch'; export const RemotionRoot: React.FC = () => (  <Composition    id="Launch"    component={Launch}    durationInFrames={135}    fps={30}    width={1280}    height={720}    defaultProps={{title: 'Launch day', features: ['Strict JSON', 'Inspect any frame', 'Render anywhere']}}  />);
src/Launch.tsxtsx
import React from 'react';import {AbsoluteFill, Audio, Easing, Img, Sequence, interpolate, spring, staticFile, useCurrentFrame, useVideoConfig} from 'remotion';import {TransitionSeries, linearTiming} from '@remotion/transitions';import {slide} from '@remotion/transitions/slide'; // Centers its children horizontally with their vertical center at `y`.const At: React.FC<{y: number; left?: number; children: React.ReactNode}> = ({y, left, children}) => (  <div style={{position: 'absolute', top: y, left: left ?? 0, right: left === undefined ? 0 : undefined,    transform: 'translateY(-50%)', display: 'flex', justifyContent: left === undefined ? 'center' : 'flex-start'}}>    {children}  </div>); // Fades in over 15 frames while moving `dx`/`dy` pixels into place.const FadeIn: React.FC<{dx?: number; dy?: number; children: React.ReactNode}> = ({dx = 0, dy = 0, children}) => {  const frame = useCurrentFrame();  const p = interpolate(frame, [0, 15], [0, 1], {extrapolateRight: 'clamp', easing: Easing.out(Easing.cubic)});  return <div style={{opacity: p, transform: `translate(${(1 - p) * dx}px, ${(1 - p) * dy}px)`}}>{children}</div>;}; const Intro: React.FC<{title: string}> = ({title}) => {  const frame = useCurrentFrame();  const {fps} = useVideoConfig();  const scale = spring({frame, fps, config: {damping: 12}});  const opacity = interpolate(frame, [20, 40], [0, 1], {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'});  return (    <AbsoluteFill style={{backgroundColor: '#f4f1ea'}}>      <At y={245}><Img src={staticFile('logo.svg')} style={{width: 140, transform: `scale(${scale})`}} /></At>      <At y={432}><div style={{fontFamily: 'Schibsted Grotesk', fontWeight: 860, fontSize: 110, letterSpacing: -5, color: '#161412', opacity}}>{title}</div></At>      <Sequence from={45}>        <At y={533}><FadeIn dy={40}><div style={{fontFamily: 'Schibsted Grotesk', fontSize: 26, color: '#4a4640'}}>Rendered from JSON</div></FadeIn></At>      </Sequence>    </AbsoluteFill>  );}; const Features: React.FC<{features: string[]}> = ({features}) => (  <AbsoluteFill style={{backgroundColor: '#fbf9f4'}}>    {features.map((feature, i) => (      <Sequence key={feature} from={i * 8} layout="none">        <At y={240 + i * 120} left={360}>          <FadeIn dx={40}>            <span style={{fontFamily: 'Schibsted Grotesk', fontWeight: 860, fontSize: 64, letterSpacing: -2, color: '#161412'}}>              <span style={{color: '#8a857a'}}>{String(i + 1).padStart(2, '0')}</span> {feature}            </span>          </FadeIn>        </At>      </Sequence>    ))}  </AbsoluteFill>); export const Launch: React.FC<{title: string; features: string[]}> = ({title, features}) => (  <AbsoluteFill style={{backgroundColor: '#f4f1ea'}}>    <Audio src={staticFile('music.mp3')} volume={(f) => interpolate(f, [0, 30], [0, 0.8], {extrapolateRight: 'clamp'})} />    <TransitionSeries>      <TransitionSeries.Sequence durationInFrames={75}>        <Intro title={title} />      </TransitionSeries.Sequence>      <TransitionSeries.Transition presentation={slide({direction: 'from-right'})} timing={linearTiming({durationInFrames: 15})} />      <TransitionSeries.Sequence durationInFrames={75}>        <Features features={features} />      </TransitionSeries.Sequence>    </TransitionSeries>  </AbsoluteFill>);

About 70 lines, two of them helper components that exist only to position and fade things.

#The vidmake port

00:00.0 · f 000
A typical Remotion composition ported to JSON: spring, interpolate, Sequence, a mapped list and a slide transitionDownload
blog-remotion-port.jsonjson
{  "fonts": [{ "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk.ttf" }],  "compositions": [{    "id": "Launch", "description": "A typical Remotion composition ported to JSON: spring, interpolate, Sequence, a mapped list and a slide transition",    "width": 1280, "height": 720, "fps": 30, "duration": 135,    "background": "#f4f1ea",    "props": { "title": "Launch day", "features": ["Strict JSON", "Inspect any frame", "Render anywhere"] },    "layers": [      { "id": "music", "type": "audio", "src": "assets/music.mp3", "volume": [[0, 0], [30, 0.8]] },      { "id": "scenes", "type": "group", "series": true, "children": [        { "id": "intro", "type": "group", "duration": 75, "transition": { "type": "slideLeft", "duration": 15 }, "children": [          { "id": "logo", "type": "image", "src": "assets/logo.svg", "width": 140, "y": "34%",            "scale": { "from": 0, "to": 1, "spring": { "damping": 12 } } },          { "id": "title", "type": "text", "text": "{{title}}", "font": "Schibsted Grotesk", "fontWeight": 860, "fontSize": 110,            "letterSpacing": -5, "fill": "#161412", "y": "60%", "opacity": [[20, 0], [40, 1]] },          { "id": "subtitle", "type": "text", "text": "Rendered from JSON", "font": "Schibsted Grotesk", "fontSize": 26,            "fill": "#4a4640", "y": "74%", "start": 45, "enter": "fadeUp" }        ] },        { "id": "list", "type": "group", "duration": 75, "children": [          { "id": "panel", "type": "rect", "fill": "#fbf9f4" },          { "id": "feature", "type": "text", "font": "Schibsted Grotesk", "fontWeight": 860, "fontSize": 64, "letterSpacing": -2,            "fill": "#161412", "anchor": "left", "x": 360,            "text": [{ "text": "${pad(i + 1, 2)}  ", "fill": "#8a857a" }, "${pick(i, {{features}})}"],            "repeat": { "count": 3, "layout": "column", "spacing": 120, "delay": 8 },            "enter": { "type": "fadeLeft", "duration": 15 } }        ] }      ] }    ]  }]}

About 30 lines. The structure is the same: one composition with default props, a series of two scenes with a transition, an audio layer. What disappeared is mostly positioning and fade plumbing, because in vidmake x and y place a layer's anchor (its center by default) and entrances are presets.

#Concept by concept

#Compositions and props

tsx
<Composition id="Launch" component={Launch} durationInFrames={135} fps={30} width={1280} height={720}  defaultProps={{title: 'Launch day', features: [...]}} />

{{title}} anywhere in the composition is replaced by the prop, and --props '{"title":"Ship it"}' or -p title="Ship it" overrides it at render time, like Remotion's input props. Durations in vidmake are frames when they are bare numbers, so 135 here is durationInFrames={135}. We set it explicitly because "duration": "auto" would take the full length of the 12-second music file, the same reason you would pass durationInFrames instead of deriving it from the audio in calculateMetadata.

#spring() and interpolate()

tsx
const scale = spring({frame, fps, config: {damping: 12}});const opacity = interpolate(frame, [20, 40], [0, 1], {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'});

vidmake's spring is the same damped-spring physics with the same defaults (damping 10, stiffness 100, mass 1), so the logo settles exactly as it does in Remotion. You can check that without rendering:

vidmake trace blog-remotion-port.json -l logo --every 3 --to 30
$ vidmake trace blog-remotion-port.json -l logo --every 3 --to 30
 FRAME    TIME        X        Y       W       H    ROT  SCALE  OPAC  NOTES
     0   0.00s    640.0    244.8   140.0   140.0    0.0   0.00  1.00  
     3   0.10s    640.0    244.8   140.0   140.0    0.0   0.32  1.00  
     6   0.20s    640.0    244.8   140.0   140.0    0.0   0.78  1.00  
     9   0.30s    640.0    244.8   140.0   140.0    0.0   1.04  1.00  
    12   0.40s    640.0    244.8   140.0   140.0    0.0   1.09  1.00  
    15   0.50s    640.0    244.8   140.0   140.0    0.0   1.06  1.00  
    18   0.60s    640.0    244.8   140.0   140.0    0.0   1.02  1.00  
    21   0.70s    640.0    244.8   140.0   140.0    0.0   1.00  1.00  
    24   0.80s    640.0    244.8   140.0   140.0    0.0   0.99  1.00  
    27   0.90s    640.0    244.8   140.0   140.0    0.0   0.99  1.00  
    30   1.00s    640.0    244.8   140.0   140.0    0.0   1.00  1.00

Note the scale passing 1.09 at frame 12 and settling back, as an underdamped spring should. Keyframes hold their first and last values outside their range, which matches interpolate with both extrapolations set to 'clamp'. Remotion's default is 'extend', which keeps going past the last keyframe. If you rely on that, use an expression with mapu(), the unclamped version of map().

#Sequence and the fade helpers

<Sequence from={45}> becomes "start": 45 on the layer. Inside a Remotion sequence, useCurrentFrame() restarts at 0. In vidmake, every animation time inside a layer is local to that layer, so the same thing happens with no wrapper. The whole FadeIn component, 15 frames with an ease-out cubic and a 40 px move, is what the built-in fadeUp and fadeLeft presets do by default, so it becomes "enter": "fadeUp".

#features.map() and TransitionSeries

tsx
{features.map((feature, i) => (  <Sequence key={feature} from={i * 8} layout="none">...</Sequence>))}

repeat is vidmake's Array.map: three copies, laid out in a column 120 px apart, each starting 8 frames after the last. pick(i, {{features}}) reads the prop array, and pad(i + 1, 2) is String(i + 1).padStart(2, '0'). One difference: the count is a literal 3 rather than features.length, so if the array changes length, change the count too.

<TransitionSeries> maps to a group with "series": true. Each child needs a fixed duration, and a child's transition overlaps it with the next one, so the total is 75 + 75 − 15 = 135 frames, the same arithmetic as Remotion. slide({direction: 'from-right'}) is slideLeft: the new scene pushes the old one to the left. vidmake transitions take a type and a duration with built-in easing, so there is no separate linearTiming or springTiming.

#Audio

<Audio volume={(f) => interpolate(...)}> becomes "volume": [[0, 0], [30, 0.8]], keyframes in frames from the layer's start. fadeIn and fadeOut cover the most common case in one field each.

#Components become compositions

The other half of most Remotion projects is reusable components with props. In vidmake, a reusable piece is a composition, and a use layer renders it with its own props:

tsx
<Sequence durationInFrames={75}>  <LowerThird name="Ada Okafor" role="Motion design" color="#c92a26" /></Sequence><Sequence from={75} durationInFrames={75}>  <LowerThird name="Lin Bao" role="Rendering" color="#1f5fb0" /></Sequence>
00:00.0 · f 000
A React component becomes a composition: one lowerThird, used twice with different props over muted videoDownload

The lowerThird composition declares its props with defaults and uses {{name}}, {{role}} and {{color}} in its layers. A use layer defaults to the referenced composition's size and duration and is clipped to its box, so the component's exit presets play out at the end of each 2.5-second slot. The background stands in for <OffthreadVideo muted> with a CSS filter; in vidmake, saturation, brightness and blur are layer fields.

#What doesn't port

vidmake is not a React renderer, and some Remotion projects depend on that:

  • Arbitrary DOM and CSS. There's no HTML. Text, shapes, images, video and groups cover most motion graphics, and layout covers the flexbox stacking that title cards need, but a design that relies on CSS grid, tables or an existing component library has to be rebuilt from layers.
  • Third-party React and canvas libraries: Three.js through @remotion/three, Lottie, charting libraries. Charts are usually easy to rebuild from shapes (see Animated charts from data); 3D scenes and Lottie files are not supported.
  • Fetching data during render. delayRender() and an async calculateMetadata have no equivalent. Fetch first, then pass the data in with --props-file. That's also easier to test.
  • Web fonts by URL. Fonts are files: add them to fonts in the project, or use an installed family (vidmake fonts lists them).

And some things work differently on purpose:

  • There is no Studio. You look at work with vidmake storyboard and vidmake still, check positions with vidmake inspect, and check motion with vidmake trace. For an agent this is the point. For a person it's a different habit, and a storyboard of twelve frames turns out to show more than scrubbing does.
  • Randomness is seeded by default. rand(seed), noise() and wiggle() return the same value for the same inputs, like Remotion's random(seed). There's no unseeded Math.random() to accidentally reach for.
  • Rendering is one command with no browser. npx remotion render becomes vidmake render project.json -o out/launch.mp4, and --props, --frames, --scale and --codec work as you'd expect.

#Porting checklist

  1. One <Composition> per entry in compositions, with defaultProps as props.
  2. Replace interpolate with keyframes or tweens, spring() with "spring": {...}, and hand-written fade components with enter/exit presets.
  3. Replace <Sequence from> with start (and duration), <Series>/<TransitionSeries> with a "series": true group.
  4. Replace .map() over arrays with repeat, reading the data with pick(i, {{prop}}).
  5. Turn reusable components into compositions and render them with use layers.
  6. Run vidmake validate, then vidmake storyboard, then compare a few frames against the Remotion render with vidmake still -f <frame>.

The full mapping table is on the Remotion page, and the components and series pages cover the two biggest structural changes.

View .md Ask Claude Ask ChatGPT

Keep reading

showcasemotion

Four reels, thirty seconds each

A Swiss poster, a piece of generative op-art, a data poem and a risograph collage. Each is a single vidmake JSON file, written, checked and rendered by an agent, using nothing but the four stock assets.

Read

releasemotion

What's new in vidmake 0.5

Markers name the beats of a video, decoration draws underlines, strike-throughs and highlights from the glyphs, design tokens and named easings bring a brand's system into a project, and WOFF2 fonts, synthetic italics, skewX, themed SVG icons, repeat origins and wipe edges close the gaps an agent hit making a 20-second ad.

Read

releaseaudio

What's new in vidmake 0.2.1

vidmake analyze shows the beats and loudness curves that audio-reactive expressions will see, rich-text spans take fontWeight, italic and font, drawMode: "total" draws many strokes with one pen, and source builds report the right version.

Read