Changing Name of the Video While Downloading via Youtube-Dl

Changing name of the video while downloading via youtube-dl

Sometimes I had headache to rename and sort the files based on the order.

So to add auto-numbering, use -A like,

youtube-dl https://www.youtube.com/playlist?list=PLOU2XLYxmsILe6_eGvDN3GyiodoV3qNSC -A

Or to keep playlist index,

youtube-dl -o '%(playlist_index)s. %(title)s.%(ext)s' https://www.youtube.com/playlist?list=PLOU2XLYxmsILe6_eGvDN3GyiodoV3qNSC

This will add nice numbering to the downloaded files.

And if you are downloading files which is not in playlist, you can add numbers manually to the file,

youtube-dl -o "1-%(uploader)s%(title)s.%(ext)s" https://youtu.be/862r3XS2YB0

Here I have manually added 1- to the filename while downloading.

Change name of audio file downloaded from youtube-dl

In the documentation of youtube-dl you'll find a --output option that lets you set the filename directly:

youtube-dl -f 'bestaudio[ext=m4a]' -o "$SONG" "$URL"

There's also a --audio-format option that seems to convert the extracted audio stream from a video to a given audio format but I'm not sure that it'll work for non-video files.

Change the output name when download with youtube-dl using python

Try like this:

import youtube_dl
ydl_opts = {'outtmpl': 'file_path/file_name'}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download(['https://www.youtube.com/watch?v=Bdf-PSJpccM'])

Substitute the desired filename and filepath in ydl_opts. file_path/file_name

Prepend the upload date to the name of the video-file

Change your commad to the following one. youtube-dl -f best -v -o "%(upload_date)s%(creator)s - %(title)s.%(ext)s" https://www.youtube.com/watch?
You have to write it without the slash becasue that creates a new folder.You could separate it with something else like a dash for example.

can youtube-dl ignore specific videos while downloading a playlist?

Yes.

  1. Put list of unwanted clips into file; unwanted.txt (one url per line)
  2. Get all urls from the playlist and save in a file
    youtube-dl -ij --flat-playlist "your_playlist" | jq -r '"https://youtu.be/\(.id)"' > listurl.txt

  1. Challenge thhose files to remove common occurrences
    grep -vf unwanted.txt listurl.txt > download.txt

  1. Download desirable vids witch a batch file
    youtube-dl -ia download.txt


Related Topics



Leave a reply



Submit