Automatically create music mix videos from YouTube songs or local audio files. Downloads tracks, merges them with crossfade transitions, adds a looping background video with audio visualization, and generates AI-powered mix descriptions.
- Download songs from YouTube URLs
- Support for local MP3 and WAV files
- Merge multiple songs with smooth 5-second crossfade transitions
- Create audio visualization bars that react to the music
- Use any video as a looping background
- Generate timestamps for the tracklist
- AI-powered mix descriptions using Perplexity API
- Automatic cleanup of temporary files
- Python 3.8+
- FFmpeg installed and in system PATH
- Perplexity API key (for mix descriptions)
- Required Python packages:
pip install -r requirements.txt- Clone the repository:
git clone https://github.com/T1M00R/ytmusicmixer.git
cd ytmusicmixer- Install dependencies:
pip install -r requirements.txt- Create project structure and environment file:
mkdir -p backgrounds temp output audio
touch .env- Configure environment:
Add your Perplexity API key to
.env:
PERPLEXITY_API_KEY=your_api_key_here- Add your media:
- Place your background video in the
backgroundsfolder asbg.mp4 - Place your WAV files in the
audiofolder - Recommended background video: looping video in 1920x1080p resolution
- Run the program:
python youtube_mix_creator.pyTo test the AI description generation without creating a video:
python test_description.pyThis will:
- Test the Perplexity API connection
- Generate descriptions for different music genres
- Save results to
output/mix_description.txt
The program creates:
output/final_mix.mp4: The final music mix video with visualizationoutput/timestamps.txt: Timestamps for each song in the mixoutput/mix_description.txt: AI-generated mix description and tags
Edit config.py to customize:
- Output directories
- Background video path
- Temporary file cleanup settings
- Audio file handling
-
FFmpeg not found:
- Make sure FFmpeg is installed and in your system PATH
- Windows: Download from https://ffmpeg.org/download.html
- Linux:
sudo apt install ffmpeg - macOS:
brew install ffmpeg
-
API errors:
- Verify your Perplexity API key in
.env - Check internet connection
- Ensure API key has sufficient credits
- Verify your Perplexity API key in
-
Video creation errors:
- Ensure background video is readable and not corrupted
- Check available disk space
- Verify audio files are valid WAV format
MIT License - See LICENSE file for details
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
