Skip to content

AnchorOrg/audio-video-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Audio-Video Synchronization Tool

A Python tool that automatically synchronizes audio tracks with video files by analyzing waveform patterns and finding optimal alignment points.

Features

  • Automatic audio waveform analysis
  • Cross-correlation based synchronization
  • Confidence scoring for sync quality
  • Support for MP3, WAV, and various video formats
  • Preserves original video quality

Requirements

  • Python 3.x
  • FFmpeg
  • NumPy
  • SciPy

Installation

  1. Install FFmpeg:
# macOS
brew install ffmpeg

# Ubuntu/Debian
sudo apt-get install ffmpeg

# Windows
# Download from https://ffmpeg.org/download.html
  1. Install Python dependencies:
pip install numpy scipy

Usage

  1. Place your video file and audio file in the same directory as sync_audio.py

  2. Update the filenames in the script if needed (default expects video_audio.wav and audio file)

  3. Run the synchronization:

python sync_audio.py

The script will:

  • Extract audio from the video
  • Analyze both audio waveforms
  • Find the optimal synchronization offset
  • Create a new video file with synchronized audio

How It Works

The tool uses cross-correlation to find matching patterns between two audio signals:

  1. Audio Extraction: Extracts audio from the video file
  2. Waveform Analysis: Loads and normalizes both audio signals
  3. Cross-Correlation: Computes correlation between audio segments
  4. Offset Detection: Identifies the time offset with highest correlation
  5. Video Generation: Creates new video with properly aligned audio

Output

  • synchronized_video.mp4 - Video with synchronized audio
  • Console output showing offset and confidence score

License

MIT

About

Automatic audio-video synchronization tool using waveform analysis

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages