Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Youtube-dl add metadata during audio conversion

Sorry if this question is misguided. I'm using youtube-dl to download song videos as mp3's before adding them to itunes. The problem is that the videos dont seem to contain the metadata in there. I read what i could about --add-metadata option but from what i understand this option is only used to add the ids if they are already in the video? I know the artist and song title so Id like a way to add it in directly if possible. Something to the effect --add-metadata-artist "Pink Floyd" Is that possible with the current configuration options?I saw this related issue but it didnt really help https://github.com/rg3/youtube-dl/issues/1570 Here are my current configuration settings:

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',
        }]
    }
like image 341
stackPusher Avatar asked Oct 05 '16 23:10

stackPusher


People also ask

How to add metadata to a YouTube video file?

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.

How to download audio from YouTube videos on Linux?

Please make sure that you have installed youtube-dl on your Linux distribution first. If you only want to download audio from a YouTube video, you can use the -x option with youtube-dl. This extract-audio option converts the video files to audio-only files. The file is saved in the same directory from where you ran the youtube-dl command.

What is youtube-dl and how to use it?

youtube-dl is a versatile command line tool for downloading videos from YouTube and many other websites. I use it for making back up of my own YouTube videos. By default, you use youtube-dl for downloading videos. How about extracting only the audio with youtubde-dl? That’s very simple actually. Let me show you the steps.

How to download YouTube videos from YouTube with Python?

youtube-dl is a command-line program to download videos from YouTube.com and many other sites. It requires the Python interpreter, so it is not platform-specific; and works on Unix-like, Mac, and Windows systems. There is also an executable version available for Windows.


1 Answers

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.

like image 135
ptha Avatar answered Sep 28 '22 09:09

ptha