Skip to content

C101 Lab: Your First Capture

This lab makes one short recording and then looks at it the way a pipeline’s first stages would: are the files complete, did every frame arrive on time, which sensor streams are there and at what rate, and does the clock hold steady across the session. It needs no special hardware. Any camera works; GoPro cameras, Android phones running OpenCamera Sensors, Project Aria (VRS) and ROS 2 rigs (MCAP) each get an extra step.

Every command below is copied from the tool’s own documentation, or follows its documented form with your own file names; the source is linked at each step. Square brackets mark values you fill in. The commands were run on FFmpeg 6.1 and on the sample files that ship with GoPro’s gpmf-parser repository.

Work through Lessons 1 to 4 first, and keep the checklist next to you.

Step 1: Set up and write down the settings

Section titled “Step 1: Set up and write down the settings”

Install FFmpeg, which provides ffprobe, and Python 3. Then write down, before you record:

  • the camera model and serial number;
  • resolution, frame rate and lens or field-of-view mode;
  • whether stabilisation is on, and whether audio is recorded.

These settings decide what the footage can be used for later. The serial number ties the footage to one unit’s calibration: units of the same model differ (RoboCap’s fleet spans 590–630 px in focal length), so footage is processed with its own unit’s numbers, never a model-wide default (Nominal versus per-unit calibration). For SLAM and calibration, stabilisation is a problem: it rotates and crops the image frame by frame, so the camera model changes from frame to frame (Action Cameras: lens modes, Lens Effects That Break a Calibration). If your camera lets you turn it off, do so and write it down.

On an Android phone with OpenCamera Sensors, the app’s README notes two settings: audio recording is disabled by default because “When recording video with audio recording enabled, MediaRecorder adds extra frames to the video to match the sound”, and it suggests disabling video stabilisation (OpenCamera Sensors; Smartphones for Capture).

Plan about ten minutes of a simple task at a table that you can see clearly, alone in a private space. Recording anyone else needs their consent: see Consent for Wearers and Bystanders.

Plan two sync events: switch a light on and off in clear view of the camera, once at the very start and once at the very end, and note the wall-clock time of each. A light is a visual event every camera that sees it records at once, with no travel delay, unlike sound (LED and light-flash sync). If you have a second recording device, such as a phone, show the light to both: step 8 then measures the offset and drift between them.

Put the camera on (a head strap, cap or glasses, whatever you have) and check in its preview that your hands and the task are in view. Then:

  1. Start recording.
  2. Make the first sync event.
  3. Do the task for about ten minutes. Turn your head at normal speed a few times, so the footage includes the head motion a pipeline has to handle.
  4. Make the second sync event.
  5. Stop recording.

Write down the start and stop times, anything that went wrong, and the file names the camera shows.

Copy the files from the camera to your computer, then compute a checksum of the original and of the copy and compare them before you delete anything from the camera. The field guide’s rule is to check every file before you delete the rig’s copy (Storage: integrity checks after copying). With GNU coreutils:

Terminal window
sha256sum [your_file.mp4] > [your_file.mp4].sha256
sha256sum -c [your_file.mp4].sha256

-c (--check) reads file names and checksums from the file you give it and reports “whether the checksums match the contents of the named files” (GNU coreutils: cksum common options). Run the first line in the camera’s folder and the second in the copy’s folder.

Why compare checksums: once the camera is cleared, the copy is the only one left, so it has to be shown identical to the original before the original goes. A matching SHA-256 shows the copy holds the same bytes as the original; any difference, even one byte, changes the checksum.

You should see [your_file.mp4]: OK.

For VRS files (Project Aria), the field guide lists vrs checksum-verbatim file.vrs for a byte-for-byte comparison and vrs check file.vrs, which “decodes every record in the VRS file and prints how many records were decoded successfully” (VRS CLI tool).

ffprobe reads any video file and reports its container and streams. These options are all from the ffprobe documentation: -v sets the log level, -show_format and -show_streams print the container and each stream, and -of (-output_format) chooses the output format.

Terminal window
ffprobe -v error -show_format -show_streams -of json [your_file.mp4]

To see only the metadata tags, use the documentation’s own example argument for -show_entries:

Terminal window
ffprobe -v error -show_entries "stream_tags : format_tags" [your_file.mp4]

You should see one entry per stream with its codec_type (video, audio, data), r_frame_rate and avg_frame_rate, the duration, and tags such as creation_time. A tag like creation_time is one time for the whole file; the per-frame timestamps come in step 6.

On a GoPro, expect more than video and audio. GoPro’s documentation states: “Telemetry carrying MP4 files will have a minimum of four tracks: Video, audio, timecode and telemetry (GPMF).” The telemetry stream shows as codec_type=data with codec_tag_string=gpmd (Action Cameras: the GPMF track). The hero8.mp4 sample in GoPro’s repository shows video, audio, a tmcd timecode stream, the gpmd telemetry stream and one more data stream.

Inside MCAP, VRS and GPMF files Three file layouts side by side, top of file to bottom. MCAP: magic bytes, a header, then the data section holding schema and channel records and chunks; each chunk batches messages, each with log_time and publish_time, and is compressed with zstd or lz4; a message index follows each chunk; attachments, which can hold calibration, and metadata records sit outside chunks; a data end record; then a summary section with indexes and statistics, a summary offset section, a footer and the magic bytes again. VRS: file tags readable on open, then streams, each identified by a device type and instance such as 200-1 for a camera and 372-1 for motion data; each stream has tags and three record types, configuration, state and data, and the index is written last at the end of the file, so an interrupted recording can have it rebuilt. GPMF: an MP4 file with four tracks, video, audio, timecode and a meta track whose data format is gpmd; the telemetry is key-length-value items with four-character keys, a DEVC device block nesting STRM streams, sticky modifier keys such as SCAL, SIUN and TYPE, and sensor data such as ACCL and GYRO. MCAP VRS GPMF in a GoPro MP4 Magic + Header Data section Schema, Channel records Chunk (zstd / lz4)Messages: log_time, publish_timeMessage Index Chunk (zstd / lz4)Messages: log_time, publish_timeMessage Index Attachment (calibration), Metadata Data End record Summary: indexes, statistics Summary Offset, Footer, Magic File tags (read on open) Stream 200-1 (camera) stream tags Configuration records State records (often empty) Data records: images, IMU Stream 372-1 (motion) stream tags Configuration records State records (often empty) Data records: images, IMU Index, written last cut off? vrs fix-index rebuilds it MP4 tracks vide: video soun: audio tmcd: timecode meta: telemetry (gpmd) KLV: FourCC, type, size, repeat DEVC (device) STRM (stream) SCAL, SIUN, TYPE (sticky) ACCL samples STRM (stream) SCAL, SIUN, TYPE (sticky) GYRO samples lens model FOVL, readout SROT in global metadata
What is inside each file, top to bottom. MCAP batches timestamped messages into compressed chunks and writes indexes in a summary at the end. VRS keeps one stream per device, each with configuration, state and data records, and writes its index last, so a cut-off file can be repaired. A GoPro MP4 carries telemetry as a fourth track of nested key-length-value items. From the MCAP spec, the VRS docs and the gpmf-parser README.

For VRS and MCAP files, use their own tools instead:

  • vrs [file.vrs] with no sub-command prints the streams, record counts, the time range of the data records and records per second (VRS CLI tool).
  • mcap info [file.mcap] “Report statistics about an MCAP file”, and mcap doctor [file.mcap] “Check an MCAP file structure” (MCAP CLI guide). In a ROS 2 install, ros2 bag info [my_bag] also summarises a bag (Recording Formats).

A file can report 30 fps on average and still have frozen or skipped frames; the way to see this is to read every frame’s timestamp (Quality Control: dropped frames and frame timing). The field guide’s QC page describes a published script that does this with ffprobe and reports the mean gap, the 99th-percentile gap and the maximum gap against the target 1000 / fps milliseconds. It also warns that recent FFmpeg releases report pts_time in the frame section, not pkt_pts_time. FFmpeg 6.1 does: its frame section lists pts_time, pkt_dts_time, best_effort_timestamp_time and duration_time.

Save this as frame_gaps.py. It asks ffprobe for the video stream’s frame rate and every frame’s pts_time, then prints the gap statistics and how often each gap occurs:

import json, subprocess, sys
from collections import Counter
from fractions import Fraction
path = sys.argv[1]
def probe(entries):
out = subprocess.run(
["ffprobe", "-v", "error", "-select_streams", "v:0",
"-show_entries", entries, "-of", "json", path],
capture_output=True, text=True, check=True).stdout
return json.loads(out)
stream = probe("stream=r_frame_rate,avg_frame_rate")["streams"][0]
fps = float(sys.argv[2]) if len(sys.argv) > 2 else float(Fraction(stream["r_frame_rate"]))
t = sorted(float(f["pts_time"]) for f in probe("frame=pts_time")["frames"] if "pts_time" in f)
gaps = [(b - a) * 1000 for a, b in zip(t, t[1:])]
s = sorted(gaps)
r, avg = stream['r_frame_rate'], stream['avg_frame_rate']
p99 = s[int(0.99 * (len(s) - 1))]
print(f'frames: {len(t)}, first {t[0]:.3f} s, last {t[-1]:.3f} s')
print(f'r_frame_rate {r}, avg_frame_rate {avg}')
print(f'target gap: {1000 / fps:.3f} ms')
print(f'mean {sum(s) / len(s):.3f} ms, p99 {p99:.3f} ms, max {s[-1]:.3f} ms')
print('gap in ms, rounded to 0.1, and its count:')
for g, n in sorted(Counter(round(g, 1) for g in gaps).items()):
print(f' {g:8.1f} : {n}')

Run it, optionally with the frame rate you set on the camera:

Terminal window
python3 frame_gaps.py [your_file.mp4] [your_fps]

-select_streams v:0 picks the first video stream, and -show_entries frame=pts_time decodes the stream and prints each frame’s presentation time (ffprobe documentation). On a long file this takes a while.

You should see almost every gap at the target. On GoPro’s hero8.mp4 sample, all 378 gaps are 33.4 ms at 29.97 fps.

Reading it. A mean on target with a large maximum is a freeze; a high 99th percentile is recurring stutter (Quality Control). A gap of about twice the target is one missing frame interval. Some recorders hide drops by repeating frames instead: on Android, MediaRecorder’s audio-matching frames mean that frame index × (1/30 s) is not a reliable time (Smartphones: variable frame timing), and from HERO9 a GoPro logs MSKP, the “Number frames skips or duplicated from sensor image captured to encoded frame. Normally 0.” (GPMF keys).

What you can check depends on the camera.

GoPro: the GPMF telemetry track. Build GoPro’s demo tool as the gpmf-parser README gives it, then run it on your file:

Terminal window
git clone https://github.com/gopro/gpmf-parser
cd gpmf-parser/demo/
make
./gpmfdemo [path/to/your_file.mp4]

The README says this “will return a brief overview of what metadata is stored in the given video file”. In the demo’s source (demo/GPMF_demo.c), computed sample rates are shown by default; -h lists the other switches.

You should see the video frame rate and frame count, then a line per stream such as ACCL sampling rate = …Hz and GYRO sampling rate = …Hz. On the hero8.mp4 sample, ACCL and GYRO both compute to about 202.47 Hz and GPS5 to about 18.17 Hz. That the measured rates differ from the nominal ones is expected: GPMF stores no sample rate per sensor because “Camera internal sensors or data via a connected Bluetooth device, will have timing errors in the range ±1%”, and the clock is worked out after capture against the MP4’s own timing (Action Cameras: timestamping IMU samples).

Android with OpenCamera Sensors. Each recording writes CSV files next to the video in DCIM/OpenCamera: {VIDEO_NAME}_gyro.csv and {VIDEO_NAME}_accel.csv with a timestamp (ns) per sample, and {VIDEO_NAME}_timestamps.csv with the timestamp of every video frame (Smartphones for Capture). Compare the number of rows in _timestamps.csv with the frame count from step 6, and compute the gyroscope’s rate from its first and last timestamps. Frame and IMU timestamps are only comparable if the camera’s SENSOR_INFO_TIMESTAMP_SOURCE is REALTIME; the app’s README says this can be checked on the preview message when RecSync is enabled: “Timestamp source” should read “realtime” (Camera and IMU timestamps on Android).

Other cameras. If the camera records no motion data, note that. A pipeline that needs head pose from SLAM will want an IMU on the same clock as the camera (Lesson 3).

The IMU fills the gaps between camera frames A 200 millisecond timeline. The camera takes a frame every 33 milliseconds, at 30 frames per second. The IMU reports every 5 milliseconds, at 200 Hz, so several inertial measurements fall between each pair of frames and carry the motion across the gap. Camera30 fps IMU200 Hz between frames, only the IMU knows how the head moved 200 ms shown
Camera frames are tens of milliseconds apart. The IMU reports many times in between, so it carries the motion across each gap, and through blur.

Step 8: Find the sync events and measure the clock

Section titled “Step 8: Find the sync events and measure the clock”

Step through the video around each light event, for example in a player that shows frame times, and note the time of the first frame in which the light has changed. To find the frame times, use the pts_time list from step 6.

  1. One device. Compare the time between the two light events in the video with the time between them on your wall-clock notes. Hand-written times are far coarser than a frame, so this checks the file’s timeline for gross errors, not the clock’s drift.
  2. Two devices. Find both events in both recordings. The offset at each event is the difference between the two devices’ times for it. Drift is the change in offset divided by the time between the events. The field guide’s worked example: an offset of 1240 ms at the start and 1312 ms sixty minutes later is (1312 − 1240) ms ÷ 3,600,000 ms = 20 × 10⁻⁶, or 20 ppm (Why Synchronisation Matters).
Clock drift between two cameras over an hour A plot of the time offset between camera B and camera A against recording time. A cluster of QR readings at the start gives an offset of about 1240 ms, and a cluster at the end, sixty minutes later, about 1312 ms. A straight line through both clusters gives the offset for every frame in between; the 72 ms of drift corresponds to the clocks disagreeing by 20 parts per million. 13201300128012601240 015304560 Recording time (minutes) Offset, B minus A (ms) QR at the start QR at the end Every frame in between reads its offset off this line 72 ms of drift
Clock drift between two cameras over an hour. Sync readings at the start give an offset of about 1240 ms and readings at the end, sixty minutes later, about 1312 ms. A straight line through both gives the offset for every frame in between; 72 ms of drift in an hour means the clocks run 20 parts per million apart.

A single event only syncs to the nearest frame, so expect each offset to be uncertain by up to one frame unless the exposures are synchronised (Why Synchronisation Matters). At 50 ppm, ten minutes give 30 ms of drift, about one frame at 30 fps, so a short session shows little of it; course C203 measures drift properly.

Write a short record for the session, as a pipeline’s ingest stage would expect. A JSON file next to the video works. Include:

  • date, operator, location type, task description;
  • camera model, serial number and settings from step 1;
  • file names and their SHA-256 checksums from step 4;
  • streams found in step 5 and sensor rates from step 7;
  • frame-gap results from step 6;
  • sync-event times, and offset and drift if you measured them in step 8;
  • anything that went wrong.

The fields mirror what published pipelines record: EgoVerse tags every upload with fields such as operator, lab, task, embodiment, scene and objects, and Egocentric-10K pairs each clip with a .json holding duration_sec, width, height, fps, size_bytes and codec (Anatomy of a Capture Pipeline, stage 5; Quality Control: manifests). An ingest script can then check each field against the file itself.

You are done when you have the files, matching checksums, a frame-gap report, a list of the streams and their rates, and the session record. Keep them: the prompts page has prompts that review each one.