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).
Step 2: Plan a short session
Section titled “Step 2: Plan a short session”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.
Step 3: Record
Section titled “Step 3: Record”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:
- Start recording.
- Make the first sync event.
- 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.
- Make the second sync event.
- Stop recording.
Write down the start and stop times, anything that went wrong, and the file names the camera shows.
Step 4: Copy and checksum the files
Section titled “Step 4: Copy and checksum the files”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:
sha256sum [your_file.mp4] > [your_file.mp4].sha256sha256sum -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).
Step 5: Inspect the container
Section titled “Step 5: Inspect the container”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.
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:
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.
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”, andmcap 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).
Step 6: Read every frame’s timestamp
Section titled “Step 6: Read every frame’s timestamp”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, sysfrom collections import Counterfrom 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:
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).
Step 7: Check the motion data
Section titled “Step 7: Check the motion data”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:
git clone https://github.com/gopro/gpmf-parsercd 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).
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.
- 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.
- 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).
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.
Step 9: Write the session record
Section titled “Step 9: Write the session record”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.
Sources
Section titled “Sources”- FFmpeg. ffprobe documentation.
- GoPro. gpmf-parser README and demo source (commit
9a71506; thehero8.mp4sample). - GNU coreutils manual: sha2 utilities and cksum common options.
- Meta. The vrs command line tool.
- Foxglove. MCAP CLI guide.
- MobileRoboticsSkoltech. OpenCamera Sensors README.
- Field guide: Quality Control for Egocentric Footage, Storage, Upload and Data Volume, Recording Formats, Action Cameras, Smartphones for Capture, Why Synchronisation Matters, Software and Visual Sync, Anatomy of a Capture Pipeline, Factory, On-Device and Online Calibration.