Skip to main content

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
  • 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

# 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.

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

# JPEG output, open after generation
avsync thumb video.mp4 "Song Title" "Artist" -o cover.jpg --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). Output is resized to a 1280px long edge by default (YouTube-friendly).

How It Works

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

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.4.0.tar.gz (110.0 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.4.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: audio_video_sync-0.4.0.tar.gz
  • Upload date:
  • Size: 110.0 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.4.0.tar.gz
Algorithm Hash digest
SHA256 d38909b98675287bbfc0e6438fb9f6a0d13eded7c179d948b664723f2aa96609
MD5 ab0effa6c2d0b5918ab6b9438c8ff4df
BLAKE2b-256 46357c018b1a395c4c3265bf41dc7c3f954696820746fa29d55273eafb37c757

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for audio_video_sync-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c3b22aff61891446b80012874508b050e999540a9a00819438ebfe34467ffe2
MD5 4e35b2a3f0a4cc6ef7ecf720ec15d82d
BLAKE2b-256 71faf7f8bcc36214bd8c361d56a01504dc8c0bff0c8c1ac0f93b62ae37f114bb

See more details on using hashes here.

Release history Release notifications | RSS feed

0.5.0

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

This release

0.4.0 This release

2 files

0.3.1

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page