Accessing the UI
Start the application and access the web interface:Start the Application
Run the main script from your terminal:The application will automatically open in your default browser at
http://127.0.0.1:5050.Workflow Overview
The UI follows a 3-step wizard pattern:All uploaded files are temporarily stored in your system’s temp directory under
video_synchronization/raw/. Synchronized outputs are saved to video_synchronization/synced/.Step 1: Upload Videos
The first step involves selecting and uploading your video files.Supported Formats
MP4
.mp4 files (recommended)MOV
.mov Apple QuickTimeAVI
.avi legacy formatUpload Process
- Click “Select Video Files” button
- Choose 2 or more videos from your file system
- Wait for upload completion (progress shown in the file grid)
- Click “Continue to Preview” when all files are uploaded
Implementation Details
The upload endpoint (/api/upload) validates file types and stores them securely:
werkzeug.utils.secure_filename() to prevent path traversal attacks (ui.py:768-769).
Step 2: Preview Original Videos
Before synchronization, verify that all videos loaded correctly.Preview Features
Multi-Video Grid Layout
Multi-Video Grid Layout
Videos are displayed in a responsive grid (2 columns on desktop). Each video cell shows:
- Video player with standard controls (play, pause, seek, volume)
- Filename label below the player
video-grid CSS class with grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) (ui.py:115-117)Auto-play & Muted
Auto-play & Muted
All videos start playing automatically in muted mode to help you quickly verify content without audio interference.HTML attributes:
autoplay muted playsinline (ui.py:259)Navigation Controls
Navigation Controls
This step does not apply any synchronization. It simply loads the raw uploaded files for verification.
Starting Synchronization
When you click “Start Synchronization”:- The button is disabled and shows “Synchronizing…”
- A background thread initiates the sync process (ui.py:735-736)
- You’re automatically redirected to Step 3 when processing begins
Step 3: Review Synchronized Results
This is the most feature-rich step, providing real-time progress monitoring and synchronized playback controls.Real-Time Progress Monitoring
While synchronization is processing, you’ll see:Progress Bar
Visual progress indicator showing completion percentage (0-100%)Implementation: Polls
/api/progress every 1 second (ui.py:580)Status Messages
Current operation displayed above the progress bar:
- “Initializing visual synchronization…”
- “Extracting motion energy from videos…”
- “Applying offsets to videos…”
- “Complete!”
Log Viewer Features
The integrated log viewer provides transparency into the synchronization process:- Log Levels
- Auto-Scroll
- Clear Logs
Filter logs by severity:
- All: Show all messages (default)
- Info: General progress updates
- Warnings: Non-fatal issues
- Errors: Critical failures
Synchronized Playback Controls
Once processing completes (progress = 100%), the results section reveals:Video Grid
Synchronized videos displayed in the same multi-view grid layout. All videos have been trimmed/padded to start at the same temporal moment.Playback Controls
Play/Pause
Toggle playback for all videos simultaneouslyImplementation: ui.py:481-510
Mute/Unmute
Toggle audio for all videos at onceButton shows current state: ”🔊 Unmute All” or ”🔇 Mute All” (ui.py:512-528)
Restart
Reset all videos to the beginning and start playing (ui.py:493-501)
Universal Seek Bar
The most powerful feature for verifying synchronization:How the Universal Seek Bar Works
How the Universal Seek Bar Works
Purpose: Scrub through all videos simultaneously to verify temporal alignment.Behavior:
- Displays current playback time and total duration (format:
MM:SS) - Drag the slider to seek all videos to the same timestamp
- Updates in real-time during playback (every 100ms)
- Prevents automatic updates while dragging to avoid jitter
- Sets
currentTimeproperty on all<video>elements synchronously (ui.py:555-566) - Uses
isDraggingflag to prevent conflicting updates (ui.py:533) - Max value set to video duration after metadata loads (ui.py:542-544)
Exporting Results
Download All (ZIP)
Bundles all synchronized videos into a single ZIP archive.Endpoint:
/api/download_all (ui.py:816-836)Filename pattern: {original_name}_synced.{ext}Start Over
Clears the current session and returns to Step 1.Note: Previous uploads are not deleted from temp storage until you exit the application.
Advanced Features
Session Logging
All operations are logged to a rotating file for debugging:- Location:
logs/video_sync.login the project directory - Rotation: 10MB per file, 5 backups retained (ui.py:39-40)
- Format:
TIMESTAMP - LOGGER_NAME - LEVEL - MESSAGE
Each session is assigned a unique ID (e.g.,
req_a4b2c9d1) visible in log messages for tracing operations (ui.py:597).Temporary File Management
Files are stored in system temp directories:Sync Indicator Images
After synchronization, visual “bounding box” images are generated inresults/ (persists across sessions) to visualize the sync quality:
Troubleshooting
Upload fails with 'File type not allowed'
Upload fails with 'File type not allowed'
Cause: You selected a file with an unsupported extension.Solution: Convert your video to
.mp4, .mov, or .avi using FFmpeg:Progress bar stuck at 0%
Progress bar stuck at 0%
Cause: Synchronization thread crashed (check
logs/video_sync.log).Common reasons:- FFmpeg not in PATH
- Corrupted video file
- Insufficient disk space in temp directory
Videos out of sync despite 100% completion
Videos out of sync despite 100% completion
Cause: Synchronization completed, but accuracy is poor.Diagnosis: Check the confidence scores in the logs. Low confidence (< 0.5) indicates unreliable alignment.Solutions:
- Try switching
SYNC_METHODinsrc/config.py(visual ↔ audio) - Ensure videos have overlapping temporal content
- Verify videos have detectable motion or audio
Log viewer shows 'Waiting for logs...'
Log viewer shows 'Waiting for logs...'
Cause: No log messages have been emitted yet, or logs were cleared.Solution: Wait for synchronization to start. First logs appear when you click “Start Synchronization” in Step 2.
Keyboard Shortcuts
Future versions may add:Space: Play/PauseM: Mute/UnmuteR: Restart←/→: Frame-by-frame seek
Next Steps
Configuration
Learn how to customize synchronization methods, directories, and advanced settings
Interpreting Results
Understand confidence scores, error metrics, and how to validate synchronization quality