I am extracting audio only from youtube videos using youtube-dl
. I would like to write the metadata (i.e. Artist Name and Song Title) into the mp3 file after downloading. My attempt to accomplish this starts with this code:
@echo off
set dl=https://www.youtube.com/watch?v=2Y6Nne8RvaA
youtube-dl --metadata-from-title "%(artist)s - %(title)s" --extract-audio --audio-format mp3 -o "%%(title)s.%%(ext)s" --add-metadata %dl%
pause
The output from this code is:
[youtube] 2Y6Nne8RvaA: Downloading webpage
[youtube] 2Y6Nne8RvaA: Downloading video info webpage
[youtube] 2Y6Nne8RvaA: Extracting video information
[download] Destination: Kungs vs Cookin' on 3 Burners - This Girl.webm
[download] 100% of 3.33MiB in 00:02
[fromtitle] Could not interpret title of video as "(title)s"
[ffmpeg] Adding metadata to 'Kungs vs Cookin' on 3 Burners - This Girl.webm'
[ffmpeg] Destination: Kungs vs Cookin' on 3 Burners - This Girl.mp3
Deleting original file Kungs vs Cookin' on 3 Burners - This Girl.webm (pass -k t
o keep)
Press any key to continue . . .
As you can see, the code adds the metadata to .webm
filename, but not to the .mp3
file. It is useless to write this to the .webm
file because the this file is deleted upon completion of the process. I want this metadata to be written to the .mp3
file so that when I view songs in a folder, it will look like the following:
This format is useful to me because I can then directly input these files into iTunes and the metadata will be intact!
I'm running Windows 7, 64bit, Python 3.5.