youtube-dl Script to add metadata to already downloaded files

950 Views Asked by At

I have a directory of files that I downloaded without metadata using youtube-dl in the format "name-youtubeID" (the standard youtube-dl format). Could someone help me come up with a script in either bash or python what will take the youtube ID part of the filename and place it at the end of the youtube-dl command line for every file in that directory so that I can add the metadata for those files?

1

There are 1 best solutions below

0
On

I've done it in a simple bash file:

cd add_metadata

for i in * ;  do
  f="${i##*-}"
  e="${f%.*}"
  youtube-dl -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio" -w --no-continue --no-part --merge-output-format mp4 --add-metadata $e
done