Understanding Synchronization Offsets
What Are Offsets?
An offset is the temporal shift (in seconds) applied to each video to align them to a common reference point.How Offsets Are Calculated
How Offsets Are Calculated
Process:Source: ui.py:706
- One video is designated as the reference (typically the first uploaded file)
- All other videos are analyzed to determine their temporal shift relative to the reference
- Positive offsets mean the video starts after the reference
- Negative offsets mean the video starts before the reference
Viewing Calculated Offsets
Offsets are logged during synchronization and visible in the UI log viewer:logs/video_sync.log (ui.py:707).
Confidence Scores
Confidence scores quantify the reliability of the calculated offsets.Score Interpretation
Correlation strength between synchronized signals.Scale:
- 0.8 - 1.0: Excellent (high certainty, strong correlation)
- 0.5 - 0.8: Good (reliable, moderate correlation)
- 0.2 - 0.5: Fair (acceptable, but verify manually)
- 0.0 - 0.2: Poor (unreliable, likely incorrect)
What Affects Confidence?
Visual Sync Confidence Factors
Visual Sync Confidence Factors
High confidence when:
- Videos contain synchronized, visible motion (people walking, objects moving)
- Motion events are distinct and non-repetitive
- Cameras have overlapping fields of view
- Lighting conditions are consistent
- Minimal motion (static scenes, sleeping subjects)
- Repetitive motion (oscillating fan, pendulum)
- Cameras pointed at completely different scenes
- Extreme lighting differences (indoor vs. outdoor)
Audio Sync Confidence Factors
Audio Sync Confidence Factors
High confidence when:
- Clear, impulsive sounds (claps, door slams, music beats)
- Low background noise
- Similar microphone quality across cameras
- Synchronized audio events in overlapping time
- Continuous, non-distinct sounds (white noise, wind)
- High background noise or echo
- Mismatched audio quality (studio mic vs. camera mic)
- Videos have no overlapping audio content
Viewing Confidence Scores
Confidence scores are emitted during the offset estimation phase:visual_sync_debug/ (ui.py:701).
Validating Synchronization Quality
Manual Verification Methods
Use the Universal Seek Bar
Drag the seek bar to jump to action-heavy moments:
- Clap or hand wave at the start of recording
- Door closing, object dropping
- People entering/exiting frame
Check Sync Indicator Images
After synchronization, bounding box overlay images are saved to
results/:What to look for:- Bounding boxes should align around the same objects across camera views
- Timestamps should match within ±0.1 seconds
Compare Audio Waveforms (Advanced)
Export synchronized videos and load them into an audio editor (Audacity, Adobe Audition):
- Import all
_synced.mp4files - Zoom in on a sharp audio transient (clap, snap)
- Verify waveform peaks align within 1-2 samples
This method requires external tools but provides sample-level accuracy validation.
Automated Validation (Evaluation Suite)
For rigorous accuracy assessment, use the built-in evaluation pipeline:- Quick Start
- Metrics Explained
- Interpreting Plots
Common Synchronization Issues
Offsets are correct, but playback is still out of sync
Offsets are correct, but playback is still out of sync
Cause: Sub-frame rounding errors or player buffering issues.Diagnosis:
- Check if offset precision is < 0.01s (10ms)
- Test in a different video player (VLC, MPV)
- Verify all videos have the same frame rate
- Re-encode videos to a common frame rate before synchronization:
Confidence score is low (< 0.2)
Confidence score is low (< 0.2)
Cause: Insufficient overlapping content or poor signal quality.Diagnosis:
- Check if videos were recorded at the same time
- Verify audio tracks exist (for audio sync)
- Inspect motion content (for visual sync)
- Switch methods: Try
SYNC_METHOD = "audio"if using visual, or vice versa - Add synchronization markers: Re-record with a visible/audible cue (clap, flash)
- Increase max_offset_sec: If videos have large time gaps (ui.py:669, 696)
One video is reversed/mirrored
One video is reversed/mirrored
Cause: Synchronization algorithms are not rotation/flip invariant.Solution: Pre-process videos to correct orientation:
Sync works for some videos but not others
Sync works for some videos but not others
Cause: Temporal overlap is insufficient or one camera has drastically different content.Diagnosis:
- Compare video durations and start times
- Check if one camera has a blocked view or lens cap
- Verify audio tracks aren’t muted on specific cameras
- Exclude problematic videos from the upload set
- Synchronize videos in smaller groups (e.g., front cameras vs. side cameras)
- Manually trim videos to overlapping time windows before upload
Progress bar reaches 100%, but no videos appear
Progress bar reaches 100%, but no videos appear
Cause: Solutions:
apply_video_offsets() failed during FFmpeg re-encoding.Diagnosis: Check logs for FFmpeg errors:- Verify FFmpeg installation:
ffmpeg -version - Check disk space in
OUTPUT_DIR - Try re-encoding input videos to a standard codec:
Understanding FFmpeg Processing
Synchronization is applied using FFmpeg’stpad (video) and adelay (audio) filters.
How Offsets Are Applied
apply_video_offsets function)
Verifying FFmpeg Output
Check synchronized video properties:Export Format Details
Filename Convention
Synchronized videos follow this pattern:camera1.mp4→camera1_synced.mp4interview_cam2.mov→interview_cam2_synced.mov
ZIP Archive Structure
The “Download All (ZIP)” button creates:BytesIO)
The ZIP does not include original raw videos or debug artifacts. Only the final synchronized outputs are bundled.
Advanced Analysis Techniques
Extracting Motion Energy Timeseries
For visual sync, motion energy plots are saved tovisual_sync_debug/:
Interpret Motion Energy Plot
X-axis: Time (seconds)
Y-axis: Motion magnitude (arbitrary units)What to look for:
Y-axis: Motion magnitude (arbitrary units)What to look for:
- Peaks should align across all camera traces
- Flat regions indicate no motion (problematic for sync)
- Similar peak magnitudes suggest good overlap
Frame-Level Accuracy Testing
To verify sub-frame synchronization:Interpreting Evaluation Metrics
When running the evaluation suite, key metrics to focus on:Accuracy Metrics
Mean Absolute Error: Average magnitude of offset errors.Good values:
- Audio: < 0.05s (sub-frame accuracy at 30fps)
- Visual: < 0.1s (3-frame accuracy at 30fps)
-
0.5s: Indicates fundamental synchronization failure
Root Mean Squared Error: Penalizes large errors more than MAE.Interpretation: If RMSE >> MAE, you have outlier cases with very poor sync.
Cross-Method Agreement
Absolute difference between audio and visual offset estimates.Good values: < 0.2s (methods agree)Poor values: > 1.0s (methods fundamentally disagree, indicates one is wrong)
Resource Usage
Maximum RAM usage during synchronization.Typical values:
- Audio: 500-1000 MB
- Visual: 1500-3000 MB (higher due to frame decoding)
Maximum CPU utilization.Typical values: 80-200% (single-core + FFmpeg subprocess)
Best Practices for High-Quality Sync
Add Synchronization Markers
At the start of recording:
- Visual: Hold a clapperboard or make a sharp hand gesture
- Audio: Clap loudly or use a tone generator
Ensure Temporal Overlap
Start all cameras before the action begins and stop after it ends. Aim for at least 30 seconds of overlapping content.
Match Camera Settings
Use consistent:
- Frame rate (30fps or 60fps across all cameras)
- Resolution (1080p or 4K)
- Codec (H.264 preferred)
Next Steps
Using the UI
Learn the upload and review workflow
Configuration
Customize synchronization methods and parameters