MCAP video ingest#

Upload a video topic from an MCAP file with add_mcap_video(). The topic must use the foxglove.CompressedVideo schema with H.264 frames. Frame times come from the file.

The examples also need pip install mcap huggingface_hub.

Connect the client#

This guide assumes you have installed the client and setup your API keys.

from nominal.core import NominalClient

client = NominalClient.from_profile("default")

Find the video topics#

This example downloads a sample flight simulator recording and lists its video topics with the mcap library:

from huggingface_hub import hf_hub_download
from mcap.reader import make_reader

path = hf_hub_download(repo_id="nominal-io/xplane", filename="xplane.mcap", repo_type="dataset")

with open(path, "rb") as f:
    summary = make_reader(f).get_summary()
    video_topics = [
        channel.topic
        for channel in summary.channels.values()
        if summary.schemas[channel.schema_id].name == "foxglove.CompressedVideo"
    ]
print(video_topics)

Upload a topic#

dataset = client.create_dataset("X-Plane simulation")
file = dataset.add_mcap_video(path, channel="cockpit_cam", topic="video")
file.poll_until_ingestion_completed()

To review it, attach the dataset to a run as in Video ingest. For the file’s protobuf-encoded topics, use add_mcap().