separate music and voice, to sing song from our side.
# Step 1: Install dependencies
!pip install -q yt-dlp spleeter
!apt-get -qq install ffmpeg
#-----------
# Step 2: Set the YouTube video URL (with full vocals+music)
youtube_url = "https://www.youtube.com/watch?v=pPqt5_NBoLw"
# Step 3: Download audio (MP3)
import yt_dlp
import os
output_path = "/content/song.%(ext)s"
ydl_opts = {
'format': 'bestaudio/best',
'outtmpl': output_path,
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
}
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
ydl.download([youtube_url])
# Step 4: Use Spleeter to split audio into vocals and accompaniment
!mkdir -p /content/output
!spleeter separate -p spleeter:2stems -o /content/output /content/song.mp3