Skills

Rerun Mp4

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

Install

npx skills add rerun-io/rerun --skill rerun-mp4 -g -a claude-code -y
Repository
rerun-io/rerun11.7k
Category
Media
Updated
3d ago
License
Apache-2.0
Context cost
Mediumabout 3,000 tokens
Runs scripts
No, instructions only

What it does

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).

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

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

modeemitswhen
"stream" (default)a codec chunk, per-GOP sample chunks, a keyframe markeralmost always, every frame is time-indexed and queryable
"asset"the whole file as one blob, plus a frame indexthe 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:

Read the whole SKILL.md on GitHub

More in Media