Skip to content

sajtii/yt-mp3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

yt-mp3

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.

Why did I create this script?

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.

Requirements

  • FFmpeg

    • 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'))

      More info about Chocolatey

      • After installing Chocolatey, run:choco install ffmpeg
    • On Linux, install the ffmpeg package using your distribution’s package manager.

    • On macOS, use Homebrew:brew install ffmpeg

  • Python

    • 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.
  • yt-dlp, Pillow, Mutagen

    • If Python is installed, run:pip install yt-dlp pillow mutagen

Usage

  • Download and unzip (if zipped) the script.
  • Open cmd, Terminal, PowerShell, or your preferred shell.
  • cd into the folder where the script is
  • python 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) crop
  • Your downloaded songs will appear in a folder called Downloads next to the script.

Additional commands

  • 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.
  • e or exit: Exits the script. Alternatively, close the window.

About

A YouTube-to-MP3 converter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages