Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing name of the video while downloading via youtube-dl

I am trying to download a complete playlist in youtube, while downloading i want to enter serial number while downloading in front of the title of the video,

For example if a playlist has a videos:

A.mp4
E.mp4
K.mp4
C.mp4
B.mp4

I want it to be

1. A.mp4
2. E.mp4
3. K.mp4
4. C.mp4
5. B.mp4.

I tried commands like:

i=0;youtube-dl -cti https://www.youtube.com/playlist?list={(Any Playlist)} -o "{{$i++}%(title)s.%(ext)s}"

but its giving me this error:

youtube-dl: error: using output template conflicts with using title, video ID or auto number

Also, Downloading the whole playlist and then renaming one by one is also not i am searching.

Is there any command which downloads the playlist and renames each video side by side according to my wish?

like image 440
Desmnd Avatar asked Sep 25 '15 14:09

Desmnd


People also ask

Can youtube-dl download any video?

YouTube-dl is a free and open-source command-line program for Windows, macOS, and Linux. You can use it to download videos from YouTube and other online video services. YouTube-dl can download videos from over 700 websites with videos.

Does youtube-dl automatically download highest quality?

If you don't have ffmpeg installed, youtube-dl will by default select the highest quality format that has both audio and video. This maxes out at 720p (and is usually specified by format code 22 so you would download with -f 22 ).

Does youtube-dl skip already downloaded?

Since version 2015.03. 28, youtube-dl does this automatically (when resuming is possible). Therefore, simply updating your installation of youtube-dl should suffice.


2 Answers

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.

like image 164
Anshad Vattapoyil Avatar answered Oct 24 '22 07:10

Anshad Vattapoyil


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

like image 42
dstftw Avatar answered Oct 24 '22 06:10

dstftw