# Recreate a Reference Video

Turn a clip you like into a Motion SDK scene. Break it into shots, block it out, then match the look.

This is how the [benchmark scenes](https://github.com/brainfish-ai/motion/tree/main/examples/benchmarks) were made. Each one rebuilds a viral Three.js animation from its video alone, since none of the sources were published. It works the same for any reference.

### Break the Clip Into Shots

Find the cuts. Scene detection gives exact frames, so you can turn them into durations.

```bash title="Terminal"
ffmpeg -i reference.mp4 -vf "select='gt(scene,0.3)',showinfo" -f null - 2>&1 | grep pts_time
ffmpeg -i reference.mp4 -vf fps=1 frames/%03d.png
```

Write down each shot's framing and movement, the frame rate, the aspect ratio, and whether the clip loops.

### Set Up the Canvas, Timeline and Shots

Match the frame rate and aspect first. Then add one [shot](/docs/features/shots) per cut. Shot durations must add up to the timeline duration, and each cut should land on a whole frame. The validator checks both, with `shots_length` and `cut_between_frames`.

```json title="scene.json"
{
  "canvas": { "width": 1920, "height": 1080, "fps": 24 },
  "timeline": { "duration": 8 },
  "shots": [
    { "duration": 4, "camera": { "position": [30, 25, 30], "target": [0, 0, 0] }, "to": { "position": [24, 18, 26] } },
    { "duration": 4, "camera": { "position": [0, 1.6, 12], "target": [0, 1, 0], "fov": 35 } }
  ],
  "exports": { "x": { "preset": "x_16x9" } }
}
```

### Block Out the Scene

Put down big shapes before any detail. Use [prefabs](/docs/features/prefabs) and `repeat` for anything that appears more than once, like buildings, lamps or cars. A city block of 18 buildings is one node with `repeat.each`.

Render stills at each shot's midpoint and put them next to the reference frames.

```bash title="Terminal"
motion-sdk render scene.json -t 2 -o blockout-1.png
motion-sdk render scene.json -t 6 -o blockout-2.png
```

### Match the Look

Work from big to small. [Sky](/docs/features/sky) and [fog](/docs/features/fog) set the mood. Then [lighting](/docs/features/lighting) and shadows, then [materials](/docs/features/materials), then [post](/docs/features/post).

Three.js artifacts often have a washed-out look. Set `post.color_management` to `legacy` and `post.tone_mapping` to `none` to match it.

### Add Motion

Use [paths](/docs/features/paths) and signals for traffic and crowds, [timeline](/docs/features/timeline) tracks for one-off moves, and [particles](/docs/features/particles) for smoke, snow and sparks. Give expressions a `rand(k)` seed so every render is the same.

### Validate, Export and Compare

```bash title="Terminal"
motion-sdk validate scene.json --final
motion-sdk render scene.json --export x
ffmpeg -i reference.mp4 -i scene-x.mp4 -filter_complex hstack side-by-side.mp4
```

Look at the side-by-side, write down what's still off, and loop back to the step that owns it.

## Tips

- Keep the scene hand-written and small. The benchmark scenes are 146 to 402 lines. An earlier generated version of the city block was 4,551 lines and rendered slower.
- Prefer presets and expressions over long keyframe lists. They cost fewer tokens and leave less to get wrong.
- Write down what you can't match, and why. Every benchmark has a "where it falls short" list. That's how engine gaps get found.
- The [recreate-a-reference skill](/docs/agents/skills) gives an agent this whole loop.
