# Rerun Mp4

Ingest .mp4 video into Rerun chunk streams with rerun.experimental.Mp4Reader.

- Repository: https://github.com/rerun-io/rerun (11675 stars)
- Category: Media
- License: Apache-2.0
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add rerun-io/rerun --skill rerun-mp4 -g -a claude-code -y`
Codex: `npx skills add rerun-io/rerun --skill rerun-mp4 -g -a codex -y`
Cursor: `npx skills add rerun-io/rerun --skill rerun-mp4 -g -a cursor -y`
Gemini CLI: `npx skills add rerun-io/rerun --skill rerun-mp4 -g -a gemini-cli -y`

## Description

Ingest .mp4 video into Rerun chunk streams with rerun.experimental.Mp4Reader. Read when converting video into a VideoStream, choosing stream vs asset mode, transcoding (B-frames, output codec, GOP size) through FFmpeg, or aligning video PTS onto a recording's wall-clock timeline. Builds on rerun-chunk-processing (stream mechanics) and rerun-data-model (where the video belongs in the recording).

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Rerun mp4 ingestion

`Mp4Reader` turns one `.mp4` file into a lazy chunk stream on **one entity**:
compressed video samples, no decode to pixels, nothing re-encoded unless it has
to be. Everything is configured on the constructor; `stream()` takes no
arguments. Stream mechanics after `.stream()` (filter, map, merge, collect,
write) are in `rerun-chunk-processing`.

## The API

```python
from rerun.experimental import Mp4Reader, Mp4TranscodeOptions

reader = Mp4Reader(video_path, entity_path="/camera/front")  # mode="stream" by default
stream = reader.stream()  # lazy: nothing is decoded yet
```

Every parameter after `path` is keyword-only. One reader handles one file, for
several cameras, build one reader per file and `LazyChunkStream.merge(...)` them
(see below).

## Two modes

| `mode`               | emits                                                   | when                                                              |
| -------------------- | ------------------------------------------------------- | ----------------------------------------------------------------- |
| `"stream"` (default) | a codec chunk, per-GOP sample chunks, a keyframe marker | almost always, every frame is time-indexed and queryable         |
| `"asset"`            | the whole file as one blob, plus a frame index          | the codec cannot be a `VideoStream`, or the source starts mid-GOP |

Reach for stream mode; the next section covers exactly what it emits. Asset mode
copies the entire file into the recording as one blob, so nothing downstream can
look at a single frame without the whole asset. It is the fallback for codecs a
`VideoStream` cannot carry (`mp4v`, image-sequence mp4), and it is what `rerun
video.mp4` and the built-in file importer use.

## What stream mode emits

For `tests/assets/video/Big_Buck_Bunny_1080_1s_h264_nobframes.mp4` (30 frames,
one GOP) with `entity_path="/camera/front"`, the whole output is three chunks:

The rest: https://github.com/rerun-io/rerun/blob/HEAD/skills/rerun-mp4/SKILL.md
