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

SneakyShrike
  • 723
  • 1
  • 10
  • 31

3 Answers3

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).

mx1up
  • 724
  • 9
  • 15
  • 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 it – Sweeney Todd Feb 02 '19 at 14:32
  • 1
    in the current version of youtube-dl it is not possible. However, I created a [pull request](https://github.com/rg3/youtube-dl/pull/17904) 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. – mx1up Feb 02 '19 at 15:23
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.

1957classic
  • 499
  • 1
  • 7
  • 12
  • 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" -y` – SneakyShrike Jan 27 '18 at 19:47
  • 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 https://wiki.multimedia.cx/index.php/FFmpeg_Metadata – 1957classic Jan 27 '18 at 20:48
  • 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. – 1957classic Jan 27 '18 at 21:26
  • 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) – 1957classic Jan 28 '18 at 01:10
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] 
1957classic
  • 499
  • 1
  • 7
  • 12
  • 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. – 1957classic Jan 25 '18 at 22:40