Youtube-dl add metadata during audio conversion

You can add FFmpegMetadata in the postprocessors lists.

options = {
    'format':'bestaudio/best',
    'extractaudio':True,
    'audioformat':'mp3',
    'outtmpl':'%(id)s.%(ext)s',     #name the file the ID of the video
    'noplaylist':True,
    'nocheckcertificate':True,
    'proxy':"",
    'addmetadata':True,
    'postprocessors': [{
            'key': 'FFmpegExtractAudio',
            'preferredcodec': 'mp3',
            'preferredquality': '192',
        },
        {
            'key': 'FFmpegMetadata'
        }]

Since someone upvoted my question, I'll mention that I did not end up finding a way to do this with youtube-dl, but thats ok because its easy to do with EasyID3:

from mutagen.easyid3 import EasyID3

metatag = EasyID3(pathToMp3File)
metatag['title'] = "Song Title"
metatag['artist'] = "Song Artist"
metatag.RegisterTextKey("track", "TRCK")
metatag['track'] = 7
metatag.save()

More info about how to use it here


There is the youtube-dl option: --add-metadata see the post-processing documentation. The documentation says that it will add metadata to the video file, but this will also work for audio files. I've used it to download the m4a audio file for a video, so it should also work for mp3. This option adds Artist, Track Title, Date and Comment tags.

I found that I needed to download FFmpeg for this to work, I just put the ffmpeg.exe file in the same directory as youtube-dl.exe (this is on a windows system).

I just noticed you mentioned you'd noticed this option. From testing it appears that it's using the Video Uploader for the Artist Tag, the actual Video name as the Title tag, the Video publish date as the Date tag and the Video comment for the Comment tag. So for music videos this is probably not ideal.