Skip to main content

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

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

# Basic usage - auto-detects sync and creates video_synced.mp4
avsync video.mp4 audio.wav

# Specify output file
avsync video.mp4 audio.wav -o output.mp4

Output video will be automatically trimmed to match the replacement audio's duration.

How It Works

  1. Extract audio from video using ffmpeg
  2. 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.
  3. Pick the best method based on confidence score
  4. 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

audio_video_sync-0.2.1.tar.gz (81.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

audio_video_sync-0.2.1-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file audio_video_sync-0.2.1.tar.gz.

File metadata

  • Download URL: audio_video_sync-0.2.1.tar.gz
  • Upload date:
  • Size: 81.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for audio_video_sync-0.2.1.tar.gz
Algorithm Hash digest
SHA256 6dc132b6d2e90bb11d58edfd65532460349599b9b3cf73f2723e20f89dea14f4
MD5 404d8d4cd9b6b846e51665cbac226021
BLAKE2b-256 cf89d10bbc8e971425add4b552a164fe8b71cfd4941b1fc47c83c32ff8e03548

See more details on using hashes here.

File details

Details for the file audio_video_sync-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for audio_video_sync-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3cac2e2bf168cf6ade52b0ca55c422e9a1fb9c7fb3b098fc2c515d56c4f62018
MD5 bba7193ecfcf58129126d09612614a6a
BLAKE2b-256 b04001b82ee4a902fcffc6ebcc073e8ad7e94b3d909728209d769c6126960435

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page