Av sync workflow

From aAAaqwq/AGI-Super-Team · View interactive version

Av sync workflow is an AI agent skill from the GitHub repository aAAaqwq/AGI-Super-Team. Audio-to-video synchronization workflow: analyze audio (beats, tempo, emotion, mood), find/match video clips to match scene and feeling, sync cuts to music beats, generate beat-marked videos. Use when user wants to: (1) turn a song into a music video, (2) sync video clips to music beats, (3) create

How to use this skill

Skill file

AV-Sync Workflow

Transform audio into a professionally edited video synchronized to beats, mood, and scene.

Workflow Overview

Audio → Analysis → Clip Matching → Beat Sync → Video Assembly → Export

Step 1: Analyze Audio

Use scripts/audio_analysis.py to extract:

python3 scripts/audio_analysis.py /path/to/song.mp3 --output /tmp/analysis.json

Output structure:

{
  "bpm": 120,
  "duration": 214,
  "beats": [0.0, 0.5, 1.0, ...],
  "sections": [
    {"type": "intro", "start": 0, "end": 15},
    {"type": "verse", "start": 15, "end": 45},
    {"type": "chorus", "start": 45, "end": 75}
  ],
  "mood": {"energy": 0.7, "valence": 0.6, "danceability": 0.8},
  "key_moments": [
    {"time": 45.0, "type": "chorus_drop", "intensity": 1.0}
  ]
}

Step 2: Gather Video Clips

User provides video clips OR search for stock footage:

Stock footage sources:

Download stock video:

# Via yt-dlp (for pexels/pixabay)
yt-dlp -f "best[height<=1080]" -o "/tmp/clip_%(id)s.%(ext)s" "https://pexels.com/video/12345"

# Via direct URL
ffmpeg -i "https://example.com/video.mp4" -c copy /tmp/clip.mp4

Step 3: Analyze Each Clip

For each clip, extract:

python3 scripts/video_analysis.py /tmp/clip.mp4 --output /tmp/clip_analysis.json

Step 4: Match Clips to Audio Sections

Algorithm: Map clips to audio sections based on:

  1. Emotion matching: High-energy chorus → energetic clips
  2. Scene continuity: Smooth transitions between scenes
  3. Beat alignment: Cut on beats for rhythm
  4. Length fit: Clip duration matches section duration
python3 scripts/match_clips.py \
  --audio-analysis /tmp/analysis.json \
  --clips /tmp/clip1.mp4,/tmp/clip2.mp4 \
  --clip-analyses /tmp/clip1_analysis.json,/tmp/clip2_analysis.json \
  --output /tmp/edit_plan.json

Step 5: Generate Beat-Synced Video

python3 scripts/assemble_video.py \
  --edit-plan /tmp/edit_plan.json \
  --audio /path/to/song.mp3 \
  --output /tmp/final_video.mp4 \
  --format mp4 \
  --codec h264 \
  --quality high

Reference Scripts

`scripts/audio_analysis.py`

Analyzes audio file using librosa. Extracts:

`scripts/video_analysis.py`

Analyzes video clip:

`scripts/match_clips.py`

Intelligent clip-to-audio matching:

`scripts/assemble_video.py`

Final video assembly:

Beat-Sync Cut Points

For every beat in the audio, consider:

Standard cut cadence:

Quick Start (Minimal)

If user provides just audio + one video:

# 1. Detect beats
python3 scripts/audio_analysis.py song.mp3 -o beats.json

# 2. Simple beat-sync assembly
python3 scripts/simple_sync.py --audio song.mp3 --clip video.mp4 --beats beats.json -o output.mp4

Quality Settings

| Quality | Resolution | Bitrate | Use Case |

|---------|------------|---------|----------|

| draft | 720p | 2Mbps | Quick preview |

| standard | 1080p | 5Mbps | Social media |

| high | 1080p | 10Mbps | YouTube |

| premium | 4K | 20Mbps | Final output |

Key Notes

Troubleshooting

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.