Auto-sync video with separately recorded audio using cross-correlation
Project description
audio-video-sync
Auto-sync video with separately recorded audio using cross-correlation.
Perfect for music covers where you record video on your phone and audio in a DAW separately.
Features
- Auto sync detection using cross-correlation (waveform + chromagram)
- Auto trim output to match replacement audio duration
- VFR to CFR conversion prevents sync drift on phone videos
- Hardware acceleration on macOS (VideoToolbox) - 4.7x faster
- Low confidence warning detects mismatched files
- Thumbnail generation from video frames with styled text overlay
Installation
# Requires FFmpeg
brew install ffmpeg # macOS
# Install from PyPI
pip install audio-video-sync
# Or with uv
uv tool install audio-video-sync
Usage
Sync video with audio
# Auto-detects sync and creates video_synced.mp4
avsync sync video.mp4 audio.wav
# Specify output file
avsync sync video.mp4 audio.wav -o output.mp4
Output video will be automatically trimmed to match the replacement audio's duration.
Generate thumbnails
# Generate clean + gradient style thumbnails
avsync thumb video.mp4 "Song Title" "Artist"
# Pick a specific style and frame time
avsync thumb video.mp4 "Song Title" -s clean -t 15
# Open result after generation
avsync thumb video.mp4 "Song Title" "Artist" --open
Extracts a frame from the video, applies a soft blur, and overlays styled text. Two styles available: clean (text with glow shadow) and gradient (dark vignette band with white text).
How It Works
- Extract audio from video using ffmpeg
- Cross-correlate using two methods:
- Waveform correlation: Compares raw audio. Precise when recordings are similar.
- Chromagram correlation: Compares pitch content. Robust to EQ, compression, reverb.
- Pick the best method based on confidence score
- Merge & trim video with synced audio, converting VFR to CFR
Use Case
You recorded a cover:
- Phone video has your performance + room noise
- DAW export has clean, polished audio
This tool finds the exact offset, syncs them, and outputs a video matching your audio's timing.
Requirements
- Python 3.10+
- FFmpeg installed and in PATH
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file audio_video_sync-0.3.0.tar.gz.
File metadata
- Download URL: audio_video_sync-0.3.0.tar.gz
- Upload date:
- Size: 93.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a6b9ee500a9bd58117bcd392071418d9e0b5bfdb7228015588613140c279779
|
|
| MD5 |
c057102926b6affd0f8f27a1a196063c
|
|
| BLAKE2b-256 |
7dbff3d35ecdabb0005acac94a6763d2cf6e2fb3656ec9c78688f9c31e8acb83
|
File details
Details for the file audio_video_sync-0.3.0-py3-none-any.whl.
File metadata
- Download URL: audio_video_sync-0.3.0-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23700dde571abb691c0c652ca2a2fb2438267438bf962f0b4bb90c7a0e70784d
|
|
| MD5 |
846fa627dd2984659ead94675d3f854c
|
|
| BLAKE2b-256 |
e26390db8da4e4df1c67a2158b080c1677f486c62edbe740271396f40d7d8204
|