A Python script to download music from YouTube (not YouTube Music) that meets my needs. It downloads, extracts, and converts the best audio available for free users into MP3 format and embeds the video thumbnail as cover art after processing it into a square.
Built on top of yt-dlp, it uses pillow to process images and mutagen to embed the cover art.
I was tired of online YouTube-to-MP3 converters, their low-quality audio, and their inability to embed cover art, which is important to me. Why? Because it looks nice on media players and on my smartwatch, which I use frequently to control music
yt-dlp itself is hard to use, and I couldn’t find a way to process thumbnails the way I wanted, so I created a script that does everything for me.
-
-
The easiest way to install FFmpeg on Windows is to use Chocolatey, but first you have to install that. Open Windows PowerShell as administrator (not cmd, not terminal) and paste the following command:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))- After installing Chocolatey, run:
choco install ffmpeg
- After installing Chocolatey, run:
-
On Linux, install the
ffmpegpackage using your distribution’s package manager. -
On macOS, use Homebrew:
brew install ffmpeg
-
-
- On Windows, if you’ve installed Chocolatey, you can use it to install Python:
choco install python. Alternatively, download Python manually. During installation, ensure you check the "Add to PATH" box; otherwise, running the script will be difficult.
- On Windows, if you’ve installed Chocolatey, you can use it to install Python:
-
- If Python is installed, run:
pip install yt-dlp pillow mutagen
- If Python is installed, run:
- Download and unzip (if zipped) the script.
- Open cmd, Terminal, PowerShell, or your preferred shell.
cdinto the folder where the script ispython ytmp3.py
If > appears, you’re ready to go.
- Paste a YouTube video or playlist link
- Choose how to process the cover art (four options are available)

- Your downloaded songs will appear in a folder called
Downloadsnext to the script.
idc: Toggles a switch. When enabled, all cover art is processed at full size without prompting for a decision. Useful for large playlists if you don’t care about customizing cover art or are fine with full-sized images.eorexit: Exits the script. Alternatively, close the window.