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.
- Put list of unwanted clips into file; unwanted.txt (one url per line)
- 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
- Challenge thhose files to remove common occurrences
grep -vf unwanted.txt listurl.txt > download.txt
- Download desirable vids witch a batch file
youtube-dl -ia download.txt
Related Topics
How to View Log Files in Linux and Apply Custom Filters While Viewing
How to Make Stdout and Stderr Output Be of Different Colors in Xterm or Konsole
What Is the Reason and How to Avoid the [Fin, Ack] , [Rst] and [Rst, Ack]
Building Linux Kernel on MAC Os X
When Grep "\\" Xxfile I Got "Trailing Backslash"
Is It Better to Use Git Grep Than Plain Grep If We Want to Search in Versioned Source Code
How to Delete a User in Linux When the System Says Its Currently Used in a Process
How to Pipe Output from Grep to Cp
Surround All Lines in a Text File with Quotes ('Something')
Which Gantt Chart/Project Management Tool Would You Recommend for Linux
Rename All Files in Folder to Numbered List 1.Jpg 2.Jpg
How to Make and Apply Svn Patch
How to Search for Files and Zip Them in One Zip File
Check If Vt-X Is Activated Without Having to Reboot in Linux
What Is the Advantage of Using Supervisord Over Monit
How to Determine If Lcd Monitor Is Turned on from Linux Command Line
How to Install Maven into Red Hat Enterprise Linux 6
Using a Remote Host's Usb Port as Local Usb (Linux and Windows)