Skip to main content

Overview

The config.py module contains all configuration settings and directory paths used throughout the video synchronization project.

Configuration Variables

Synchronization Method

SYNC_METHOD
str
default:"\"visual\""
Synchronization method to use. Options:
  • "visual": Motion-based synchronization
  • "audio": GCC-PHAT audio-based synchronization

Directory Paths

TEMP_BASE
str
Base temporary directory for all processing files. Defaults to system temp directory + /video_synchronization.Automatically set using:
os.path.join(tempfile.gettempdir(), "video_synchronization")
PROJECT_ROOT
str
Absolute path to the project root directory (where main.py is located).Automatically set using:
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
VIDEO_DIR
str
Directory for raw uploaded video files.Path: {TEMP_BASE}/raw
OUTPUT_DIR
str
Directory for synchronized output videos.Path: {TEMP_BASE}/synced
AUDIO_DIR
str
Directory for extracted audio files (used in audio sync mode).Path: {TEMP_BASE}/audio
VISUAL_SYNC_OUTPUT_DIR
str
Directory for visual sync debug output files.Path: {TEMP_BASE}/visual_sync_debug
RESULTS_DIR
str
Directory for sync indicator images (persists across sessions).Path: {PROJECT_ROOT}/results

Directory Initialization

All directories are automatically created on module import with exist_ok=True:
os.makedirs(VIDEO_DIR, exist_ok=True)
os.makedirs(OUTPUT_DIR, exist_ok=True)
os.makedirs(AUDIO_DIR, exist_ok=True)
os.makedirs(VISUAL_SYNC_OUTPUT_DIR, exist_ok=True)
os.makedirs(RESULTS_DIR, exist_ok=True)

Usage Example

from src import config

# Access configuration
print(f"Sync method: {config.SYNC_METHOD}")
print(f"Video directory: {config.VIDEO_DIR}")
print(f"Output directory: {config.OUTPUT_DIR}")

# Use paths in your code
video_path = os.path.join(config.VIDEO_DIR, "camera1.mp4")
output_path = os.path.join(config.OUTPUT_DIR, "camera1_synced.mp4")

Build docs developers (and LLMs) love