rerun-mp4
できること
このスキルは、MP4の動画ファイルを、画像に変換せずにRerunの記録へ追加する方法をエージェントに示します。カメラの動画を他のデータと並べて見せたい人向けです。
使う場面
- ✓Rerunの記録にMP4のカメラ動画を追加したいとき。
- ✓動画について、ストリームモードとアセットモードのどちらを選ぶか決める必要があるとき。
- ✓動画のタイミングが記録の他のデータと合わず、直す必要があるとき。
スキルのリンク
https://github.com/rerun-io/rerun/blob/main/skills/rerun-mp4/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“MP4のカメラ動画をRerunの記録に追加して、センサーのデータと揃うようにするにはどうしますか。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このスキルは、エージェントが1つの動画ファイルのための読み取り機能をどう作り、どの設定を選ぶかを説明します。ストリームモードは各フレームを時間で検索できる状態に保ち、アセットモードはファイル全体を1つのまとまりとして保存します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
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
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:
[0] entity=/camera/front static=True rows=1 timelines=[] cols=['VideoStream:codec']
[1] entity=/camera/front static=False rows=30 timelines=['video'] cols=['VideoStream:sample']
[2] entity=/camera/front static=False rows=1 timelines=['video'] cols=['VideoStream:is_keyframe']
- One static chunk, one row, holding
VideoStream:codec. It carries no timeline — code that walks the stream must handle that (if chunk.is_static: continue). - One temporal chunk per GOP: a keyframe plus every sample that depends on it, up to (not including) the next keyframe. Samples only — the keyframe flags are not a column here.
- One trailing
is_keyframemarker chunk, holding a sparseTruerow at each keyframe's time and nothing else. Keeping it out of the sample chunks is what lets a keyframe-only query skip the sample payload, and whatcollect(optimize=…)accepts as canonical. It is list-per-row, so a row reads back as[True], notTrue. - Timeline
video,duration[ns], values are the mp4 PTS from the start of the video. - Every chunk on the same entity.
entity_path=None(the default) derives it from the file's absolute path, sofoo/video.mp4run from/databecomes/data/foo/video.mp4. Passentity_pathexplicitly in any real pipeline.
A short clip is often a single GOP, so "three chunks total" is the normal shape —
not a sign that something was dropped. chunk_by_gop=False emits one Rerun
chunk per sample instead (the marker chunk is unaffected). That is a debugging
shape — one chunk per frame is a poor storage layout, and it also makes a
following optimize pass 6× more expensive (measured below) — so leave the
default alone unless you are inspecting individual samples.
Distinguish the three by their columns, not by position or is_static: the codec
chunk is the static one, sample chunks carry VideoStream:sample, and the marker
chunk carries only VideoStream:is_keyframe.
Supported stream-mode codecs are exactly the five VideoCodec values: H264,
H265, AV1, VP8, VP9.
Transcoding through FFmpeg
VideoStream cannot yet model DTS != PTS, so an H.264/H.265 source with
container-level B-frame reordering cannot be emitted directly. The reader
handles that itself: it re-encodes through FFmpeg with -bf 0, streams the
result back as a fragmented mp4, and turns each fragment into one GOP chunk, so
only one GOP is resident at a time. This is automatic and invisible in the API —
the output has the same shape as a clean source.
よくある質問
ストリームモードとアセットモードの違いは何ですか?
ストリームモードが既定で、各フレームを時間で検索できる状態に保ちます。アセットモードは、動画をストリームにできない場合に使い、ファイル全体を1つのブロブとして保存します。
動画を再エンコードできますか?
はい。FFmpegによるトランスコードに対応し、Bフレーム、出力のコーデック、キーフレームの間隔などの設定を扱います。
複数のカメラはどう使いますか?
動画ファイルごとに読み取り機能を一つずつ作り、その結果のストリームをあとで統合します。
詳細
作者による元の説明
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).
repo: rerun-io/rerun
人気
- GitHubのスター
- 12k
- ランキング
- #11556
- ライセンス
- Apache-2.0
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
investigate-puffin
12kPuffinプロファイラーの記録(.puffinファイル)を調べ、遅いコード箇所を見つけ、変更前後のトレースを比較するようエージェントを支援します。
rerun-blueprint
12kブループリントを書いてRerunビューアーの見た目を変える方法を、レイアウト、ビュー、非表示の列を含めてエージェントに教えます。
rerun-catalog-queries
12k往復回数、データ量、遅いデータセットの読み取りに関するヒントを使い、PythonからRerunカタログへのクエリを速くするようエージェントを支援します。
rerun-chunk-processing
12kreaderとlensを使ってMCAP、Parquet、動画、RRDのファイルを録画に変換するRerunのデータパイプラインを作る方法をエージェントに教えます。
似ているスキル
taste-application
280kエージェントが、特定のスタイルの動画を作成するのを助けます。参考動画の編集のリズムを真似したり、新しいシーンを生成したり、色味を調整したりして、他の素材と合わせて編集できます。
taste-distillation
280kエージェントが動画を分析して、スタイルパックを作成できるようにします。色味、カットのリズム、ビジュアル要素などを含み、同じ雰囲気の新しい動画を作るときに再利用できます。
ui-demo
280kエージェントに、洗練されたUIのデモ動画を録画させます。チュートリアルの作成や、Webアプリの動作の紹介に役立ちます。