A powerful desktop application for automatically synchronizing foreign audio tracks to reference videos. Built with Electron, React, and TypeScript, powered by the AVSync Python engine with advanced visual anchor detection and precise audio timing algorithms.
- ๐จ Modern UI: Beautiful, intuitive interface with dark/light theme support
- ๐น Video Preview: Frame-by-frame navigation with visual sync point definition
- ๐ Batch Processing: Process multiple videos with automatic file matching
- ๐ Job Queue: Manage multiple processing jobs with real-time progress tracking
- ๐พ Persistent Settings: All parameters saved between sessions
- ๐ฏ Manual Sync Points: Define precise synchronization points visually
- ๐ Real-time Logs: Monitor processing with live log output
- ๐ฏ Visual Anchor Detection: Scene change detection and template matching
- ๐ Precise Audio Timing: Iterative audio processing with millisecond-level precision
- ๐ Multi-language Support: Automatic audio stream detection by language codes
- ๐ Quality Control: Generate side-by-side comparison images and CSV reports
- โก Parallel Processing: Multi-threaded frame matching for faster processing
- ๐๏ธ Flexible Configuration: Extensive customization options
- ๐พ Smart Caching: Cache visual anchors for faster re-processing
- Image Pairing Stage: Extracts scene change frames and matches them between reference and foreign videos
- Audio Synchronization Stage: Processes audio segments iteratively to match reference timing precisely
- Muxing Stage: Combines reference video, original audio, and synchronized foreign audio into final output
- Node.js 18+ and npm (for building the desktop app)
- Python 3.8+ with pip
- FFmpeg (full build with SoxR support)
- FFprobe
- MKVToolNix (mkvmerge, mkvextract)
git clone https://github.com/stinkybread/avsync.git
cd avsyncnpm install# Create virtual environment (recommended)
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate
# Install Python dependencies
pip install -r requirements.txtDownload FFmpeg (full build with SoxR) and MKVToolNix binaries and place them in resources/bin/:
FFmpeg (Recommended):
- Download from: https://ffbinaries.com/downloads
- Get the latest FFmpeg build for your platform
- Extract and copy
ffmpeg.exeandffprobe.exetoresources/bin/
MKVToolNix:
- Download from: https://mkvtoolnix.download/
- Copy
mkvmerge.exeandmkvextract.exetoresources/bin/
Your resources/bin/ folder should contain:
resources/bin/
โโโ ffmpeg.exe
โโโ ffprobe.exe
โโโ mkvmerge.exe
โโโ mkvextract.exe
# Activate venv if not already active
# Build AVSync executable with PyInstaller
python -m PyInstaller avsync.spec -y
# Copy built executable to resources
# Windows PowerShell:
Remove-Item -Path resources\avsync -Recurse -Force
Copy-Item -Path dist\avsync -Destination resources\avsync -Recurse -Forcenpm run buildnpm run devThis starts the Vite dev server and launches Electron in development mode with hot reload.
npm run build
npm run electronnpm run packageThis creates a distributable application in the release folder.
- Select reference video (the video with correct timing)
- Select foreign video (the video with audio to sync)
- Choose output location
- Adjust parameters as needed
- Add manual sync points if desired (optional)
- Click "Add to Queue"
- Select folders containing reference and foreign videos
- Configure file matching patterns
- Review matched files in the staging table
- Adjust per-job settings if needed
- Add all to queue
- View all queued jobs
- Start processing
- Monitor real-time progress and logs
- Abort, retry, or remove jobs as needed
- Scene Threshold: Scene change detection sensitivity (0.0-1.0, default: 0.25)
- Match Threshold: Template matching threshold (0.0-1.0, default: 0.7)
- Similarity Threshold: Perceptual hash difference (default: 4, -1 to disable)
- Reference Language: Language code for reference audio (default: eng)
- Foreign Language: Language code for foreign audio (default: spa)
- dB Threshold: Audio detection threshold (default: -40.0 dB)
- Min Segment Duration: Minimum segment length (default: 0.5s)
- Auto-detect: Automatically detect audio streams
- Foreign Audio Codec: Output codec (default: aac)
- Foreign Audio Bitrate: Output bitrate (default: 192k)
- Use Cache: Cache visual anchors for faster re-processing
- Skip Subtitles: Don't include subtitles in output
avsync/
โโโ electron/ # Electron main and preload scripts
โโโ src/ # React frontend source
โ โโโ components/ # React components
โ โโโ App.tsx # Main application component
โ โโโ main.tsx # React entry point
โโโ resources/ # Application resources
โ โโโ bin/ # External binaries (FFmpeg, etc.)
โ โโโ avsync/ # PyInstaller bundle
โโโ AVSync_v12.py # Python processing engine
โโโ avsync.spec # PyInstaller specification
โโโ package.json # Node.js dependencies
- โ Use videos with clear scene changes and visual landmarks
- โ Ensure good video quality for accurate frame matching
- โ Both videos should be essentially the same (same scenes, different audio)
- โ Avoid videos with different intros, extra ads, or missing scenes
- โ Ensure clear content boundaries in audio tracks
- โ Use similar audio quality between reference and foreign tracks
- โ Define manual sync points for problematic sections
- Lower scene threshold: Detects more frames (more anchor points)
- Higher match threshold: Stricter frame matching (fewer false positives)
- Longer min segment duration: Fewer, longer segments (more stable sync)
- Ensure binaries are in
resources/bin/ - Rebuild PyInstaller bundle:
python -m PyInstaller avsync.spec -y - Copy to resources: See Installation step 5
- Try lowering scene threshold (e.g., 0.15)
- Try lowering match threshold (e.g., 0.6)
- Verify videos actually correspond to each other
- Add manual sync points
- Download FFmpeg full build (not essentials)
- Use builds from https://ffbinaries.com/downloads
# Clean and rebuild
rm -rf node_modules dist dist-electron build
npm install
npm run build- Node.js 18+
- Python 3.8+
- Git
# Clone and install
git clone https://github.com/stinkybread/avsync.git
cd avsync
npm install
# Setup Python
python -m venv venv
venv\Scripts\activate # Windows
pip install -r requirements.txt
# Download binaries (see Installation step 4)
# Build Python engine
python -m PyInstaller avsync.spec -y
# Copy dist/avsync to resources/avsync
# Run in dev mode
npm run dev- Frontend: React 18, TypeScript, Vite
- Desktop: Electron 29
- Processing: Python 3.8+, OpenCV, SciPy, NumPy
- Bundling: PyInstaller, electron-builder
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Developer: Vaibhav Bhat
UI Design & Implementation: Claude (Anthropic)
Special Thanks:
- FFmpeg team for the multimedia framework
- OpenCV community for computer vision tools
- SciPy contributors for audio processing capabilities
- Electron and React teams
- ๐ Bug Reports: GitHub Issues
- ๐ก Feature Requests: GitHub Discussions
Made with โค๏ธ by Vaibhav Bhat

