reframe-handheld / docs /TIME_ALIGNMENT.md
Ziegelll's picture
ReFrame-Handheld v0.1: 1,651 demonstrations in verified archive shards
1c4ef86
|
Raw History Blame Contribute Delete
2.74 kB

Time semantics

The release preserves timestamps and offers optional record-time matching. It does not certify exposure synchronization or force all streams onto one frame grid.

Three distinct time quantities

  1. Header time is the original timestamp written by the acquisition software. It may use a device clock or a host clock, and meanings can vary across batches.
  2. Bag record time is the recorder's timestamp. A common per-episode origin is subtracted to obtain record_time_ns for all streams.
  3. Video PTS controls playback within a single MP4. It starts at that stream's first valid image, is quantized to microseconds, and is mapped back to source time by the frame table.

For each valid frame, the current encoder satisfies:

video_pts * 1000
  = record_time_ns - stream_start_record_time_ns
    + video_pts_adjustment_ns

The formula assumes the stored time base of 1/1,000,000 seconds. Original nanoseconds are unchanged. If equal timestamps or quantization would produce non-increasing PTS, the encoder increases playback PTS by one microsecond and records the difference. The complete exported set has a maximum absolute adjustment of 500 ns. This number measures encoding time quantization, not capture-time accuracy.

Optional matching

nearest_by_record_time finds the nearest valid auxiliary video frame using bag record time, with a configurable maximum difference (20 ms by default). It returns source/video indices and a signed record-time difference, or null for a missing camera, outside coverage or an excessive difference.

It does not establish a device-clock model, jointly pair left/right exposure groups, interpolate motion, or enforce causality. A selected auxiliary frame can occur after the main-frame record time. A future causal application should use a past-only policy. Missing images must not be represented by frame index zero.

Record-time differences and header-minus-record-time offsets cannot be relabelled as exposure-time errors. No fixed latency corrections were fitted during this export. All metadata states capture_time_validated=false. Users needing physical synchronization should establish timestamp semantics and independently validate a clock model using suitable evidence.

Playback and gaps

Starting several independent MP4 players together does not synchronize them: each file starts at its own first image. The frame table preserves each stream's offset from the common origin. Per-stream image counts can differ; in particular, left/right frame indices are not guaranteed to form exposure pairs. Source timestamps remain the basis for gap analysis. Any future composite preview is a derived visualization and should provide its selection rule separately.