A script that automatically creates lo-fi variants of randomly selected songs in a Spotify playlist and uploads them to the mewzaki YouTube channel. For best results, select songs that have around 80 BPM to avoid excessive distortion.
- The user provides a Spotify playlist URI and two songs are randomly selected to convert to their lofi-counterparts using
Spotipy
. - YouTube is queried using
youtubesearchpython
to determine links for each of the two songs. - The audio from the respective video from each link is downloaded to the audio_files_input directory using
yt-dlp
. - Each audio file has their vocals separated from their instrumental using
spleeter
, writing to new audio files in the audio_output directory. - The BPM for each track is calculated using
aubio
. - Randomly select a beat from the beats_library directory.
- Alter the vocals to match the BPM of the chosen beat using
pydub
. - Overlay the transformed vocals on top of the lofi-beat using
pydub
and write the final audio to a new mp3 file. - Combine the audio and the background video using
moviepy
. - Upload the video to the mewzaki YouTube channel using
google_auth
related API.
By using Windows Scheduler and converting the generate_vid_and_upload.py
script into a Batch file, we can set this script to run automatically through a desired time frame.
See the steps here for more info: How to Schedule Python Script using Windows Scheduler.
After each video is uploaded, the files used during processing should be discarded to free up space. This is especially important in the case where the script is run periodically, as storage can become a concern without manual maintenance.