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)
- Low confidence warning detects mismatched files
- Manual offset / dry-run for when you already know the sync point
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
# Detect only (no encode)
avsync sync video.mp4 audio.wav --dry-run
# Skip detection with a known offset (seconds)
avsync sync video.mp4 audio.wav --offset 17.2
# Analyze more audio / disable hardware encode
avsync sync video.mp4 audio.wav --analyze 60 --no-hwaccel
Output video will be automatically trimmed to match the replacement audio's duration.
How It Works
- Extract audio from video using ffmpeg
- Cross-correlate using two methods with comparable confidence scores:
- Waveform correlation: Compares raw audio. Precise when recordings are similar.
- Chromagram correlation: Compares pitch content band-by-band. Robust to EQ, compression, reverb.
- Pick the best method based on normalized confidence
- Merge & trim video with synced audio (sample-accurate trim), 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 and ffprobe installed and in PATH
License
MIT
Metadata
Release files for audio-video-sync 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| audio_video_sync-0.5.0.tar.gz | 98.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| audio_video_sync-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 109.8 kB
Release files / audio_video_sync-0.5.0.tar.gz
| Download URL | audio_video_sync-0.5.0.tar.gz |
|---|---|
| Size | 98.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81623176cbe6784e537dda56a6bb9699164f6ce0a25d568d1fd9f8572fa8bc8b
|
|
BLAKE2b-256 checksum How to use checksums |
567c2550e5ec8dc55f9788a7dad77cdd3aacfc7e18ea559a6c096b7649e99d5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / audio_video_sync-0.5.0-py3-none-any.whl
| Download URL | audio_video_sync-0.5.0-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2afc652760d90de076a24ef927ce05c755abde058f42f4bda8a858c9d553742f
|
|
BLAKE2b-256 checksum How to use checksums |
c721bc30fc7c0191f1a306277848d16f12210cacd6e97c3e56d06f5d82a2a640
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|