YouTube-dl - Give each download a custom album name
Asked Answered
C

3

6

I'm wondering if theres a way to give a custom album name to every download i make on YouTube-dl. You see I download a lot of podcast videos from YouTube and extract the audio for offline use.

I've already managed to specify the download location and also alter the title format using the following command: youtube-dl -x -o /Downloaded/%%(title)s.%%(ext)s.%%(album)s %URL% by making use of the youtube-dl documentation page.

However I would also like to add to that, the ability to give each download an album name of 'Podcasts'. I've found an album tag in the youtube-dl documentation but that appears to take an exsisting album name from the orignal source. Instead i want to put my own album name instead.

Like this picture, where the Album field is labelled with 'Podcasts':

enter image description here

Is this possible with YouTube-dl?

Setup directory:

enter image description here

Chucklehead answered 25/1, 2018 at 14:19 Comment(0)
G
6

you can specify tags using the postprocessor args option. From the help:

--postprocessor-args ARGS Give these arguments to the postprocessor

The postprocessor in this case is FFmpeg. So you can add an ffmpeg param to set the album tag like this:

--postprocessor-args "-metadata album=Podcasts"

So your full command line would then be:

youtube-dl -x --postprocessor-args "-metadata album=Podcasts" -o /Downloaded/%%(title)s.%%(ext)s.%%(album)s %URL%

More info about the MP3 metadata tags you can set this way can be found on the ffmpeg wiki. I have only tested this when transcoding to MP3 (--audio-format mp3).

Gosh answered 12/10, 2018 at 17:11 Comment(2)
Is it possible to do -metadata album=%(playlist)s so that the playlist name is written to album field? This writes (literally) %(playlist)s to album field, without replacing itPrincipate
in the current version of youtube-dl it is not possible. However, I created a pull request with changes to make this behavior possible. It works for me. Unfortunately, the code still hasn't been accepted. If you don't mind, please inform the developers of the usefulness of the pull request.Gosh
B
1

Here is a work around but be warned it will add the album metadata to all mp3 files in that folder.

youtube-dl -c -x --audio-format mp3 -o %%(title)s.%%(ext)s [url]
for %%a in ("*.mp3") do ffmpeg -i "%%a" -i metadata.txt -map_metadata 1 -c:a copy -id3v2_version 3 -write_id3v1 1 "%%~na.mp3" -y

This is the metadata file: (Save as metadata.txt)

;FFMETADATA1
title=
artist=
album_artist=
composer=
publisher=
performer=
album=Podcasts
date=
track=
genre=
copyright=
disc=

Edit the metadata lines as needed.

Brainwashing answered 26/1, 2018 at 3:3 Comment(4)
I also can't seem to get it to work with mp3 files. I have the metadata text file in the same directory as my youtube-dl batch script. And the command I use with the for loop (in the batch script) goes as follows: youtube-dl -f best -x --audio-format mp3 -o /Downloaded/%%(title)s.%%(ext)s %URL% for %%a in ("*.mp3") do ffmpeg -i "%%a" -i metadata.txt -map_metadata 1 -c:a copy -id3v2_version 3 -write_id3v1 1 "%%~na.mp3" -yChucklehead
If the path for ffmpeg hasn't been set, you'll have to change this: ffmpeg to ffmpeg.exe on the second line. Some formats allow certain metadata and some don't.. here's a link you can check out wiki.multimedia.cx/index.php/FFmpeg_MetadataBrainwashing
If you want to add more formats, copy the second line: for %%a in ("*.mp3") do ffmpeg.exe -i "%%a" -i metadata.txt -map_metadata 1 -c:a copy -id3v2_version 3 -write_id3v1 1 "%%~na.mp3" -y and change the mp3 format to other formats. Since this is now more a ffmpeg question, you may get additional help from the ones in the ffmpeg forum.Brainwashing
The batch file isn't working for you because I forgot to point it to the Downloaded folder. I've tried using the flac format but it doesnt write the metadata to it. This should work for the mp3 format: youtube-dl -f best -x --audio-format mp3 -o /Downloaded/%%(title)s.%%(ext)s %URL% for %%a in ("Downloaded/*.mp3") do ffmpeg -i "Downloaded/%%a" -i metadata.txt -map_metadata 1 -c:a copy -id3v2_version 3 -write_id3v1 1 "Downloaded/%%~na.mp3" -y (make sure the second line begins with for%%a)Brainwashing
B
0

Your question isn't that clear to me but see if one of these help point you in the direction you want to go.

youtube-dl -x -o /Downloaded/Podcasts_%%(album)s.%%(title)s.%%(ext)s [video_url]

youtube-dl -x -o /Downloaded/Podcasts_%%(title)s.%%(ext)s [video_url] 
Brainwashing answered 25/1, 2018 at 21:8 Comment(1)
After looking closer at your image, I don't believe that can be done with yt-dl. You'll more than likely need a third party tool that changes the file information.Brainwashing

© 2022 - 2024 — McMap. All rights reserved.