Skip to content Skip to sidebar Skip to footer

How to Download Best Quality With Youtubedl

In this comprehensive Youtube-dl tutorial, nosotros are going to larn what is Youtube-dl and the list of about normally used Youtube-dl commands with examples to download sound and video streams from Internet in Linux operating systems.

What is Youtube-dl?

Youtube-dl is a most pop command line YouTube downloader application. Youtube-dl can be able to download a single track or the entire playlist in one go.

Youtube-dl is non just to download videos from Youtube, but also from a lot of other websites. You tin can view the complete listing of supported sites here.

It is a free and open up source programme written in Python. It supports GNU/Linux, Mac OS X and Microsoft Windows.

one. Install Youtube-dl On Linux

Youtube-dl tin exist installed in many ways. Let us them all.

The officially recommended manner to install Youtube-dl is merely download information technology, save it in your $PATH, make it executable and beginning using it correct away.

$ sudo curl -50 https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl

If you don't have roll, utilize wget instead:

$ sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
$ sudo chmod a+rx /usr/local/bin/youtube-dl

1.ii. Install Youtube-dl using Pip

Alternatively, y'all can install it using Pip as shown below.

$ sudo -H pip install --upgrade youtube-dl

i.3. Install Youtube-dl using package director

Youtube-dl is also available in the official repositories of some Linux distributions.

To install Youtube-dl in Tall Linux, run:

$ sudo apk add youtube-dl

Install Youtube-dl in Arch Linux, EndeavourOS, Manjaro Linux using command:

$ sudo pacman -S youtube-dl

On Debian, Ubuntu, Linux mint, Pop_OS!:

$ sudo apt install youtube-dl

On Fedora:

$ sudo dnf install youtube-dl

On openSUSE:

$ sudo zypper install youtube-dl

1.4. Install FFmpeg on Linux

Youtube-dl depends on FFmpeg to download 720p videos from YouTube and convert videos to other formats. To install FFmpeg on Linux, refer the following guide.

  • How to install FFmpeg on Linux

ane.5. Update Youtube-dl

If yous've manually installed Youtube-dl using curlicue or wget, run the following command to update it:

$ sudo youtube-dl -U

If y'all installed it using pip, do:

$ sudo pip install -U youtube-dl

Those who installed Youtube-dl using the distribution's package manager, just use the advisable update command. For instance, on Arch Linux, you can update Youtube-dl by merely running the following command:

$ sudo pacman -Syu

On Debian, Ubuntu:

$ sudo apt update

Now, let u.s. see some examples to learn to use Youtube-dl.

2. Youtube-dl Tutorial With Examples

Hither, I have compiled nigh unremarkably used Youtube-dl commands to download a video or playlist from YouTube.

2.one. Download video or playlist

To download a video or the entire playlist from YouTube, just mention the URL like below:

$ youtube-dl https://www.youtube.com/scout?v=7E-cwdnsiow

If yous want to download video or playlist with a custom name of your choice, the command would be:

$ youtube-dl -o 'abdul kalam inspirational oral communication' https://world wide web.youtube.com/watch?v=7E-cwdnsiow

Replace "abdul kalam inspirational voice communication" with your own name.

Do you lot want to relieve the video in another location? Use -o flag followed past the target location like below.

$ youtube-dl -o '~/Downloads/abdul kalam speech' https://www.youtube.com/watch?v=7E-cwdnsiow

Here I am downloading the video to the Downloads directory.

[youtube] 7E-cwdnsiow: Downloading webpage [download] Destination: /home/sk/Downloads/abdul kalam speech.f271 [download] 100% of 111.86MiB in 01:00 [download] Destination: /dwelling/sk/Downloads/abdul kalam speech.f251 [download] 100% of six.12MiB in 00:03 [ffmpeg] Merging formats into          "/home/sk/Downloads/abdul kalam speech.webm"          Deleting original file /home/sk/Downloads/abdul kalam spoken language.f271 (laissez passer -k to keep) Deleting original file /home/sk/Downloads/abdul kalam oral communication.f251 (pass -k to continue)

You can also include additional details,  such as the championship, the uploader proper name (channel name) and upload date etc., in the file name by using the following command:

$ youtube-dl -o '%(title)s by %(uploader)southward on %(upload_date)southward in %(playlist)s.%(ext)s' https://www.youtube.com/picket?v=7E-cwdnsiow

2.ii. Download multiple videos

Sometimes, you might desire to download multiple videos from or whatsoever other site. If so, just mention the URL of the videos with infinite-separated like below:

$ youtube-dl <url1> <url2>

Alternatively, yous can put them all in a text file and pass information technology to Youtube-dl equally an argument like beneath.

$ youtube-dl -a url.txt

This control volition download all videos mentioned in the url.txt file.

2.3. Download sound-only from a video

Youtube-dl allows usa to download audio only from a YouTube video. If you ever been in a state of affairs to download only the audio, run:

$ youtube-dl -ten https://world wide web.youtube.com/watch?5=7E-cwdnsiow

By default, Youtube-dl will save the audio in Ogg (opus) format.

If you lot prefer to download whatsoever other formats, for example mp3 , run:

$ youtube-dl -ten --sound-format mp3 https://www.youtube.com/picket?v=7E-cwdnsiow

This control will download the sound from the given video/playlist, convert it to an MP3 and salve it in the electric current directory. Please annotation that you should install either ffmpeg or avconv to convert the file to mp3 format.

2.four. Download video with description, metadata, annotations, subtitles and thumbnail

To download a video along with its other details such as description, metadata, annotations, subtitles, and thumbnail etc., utilize the following control:

$ youtube-dl --write-description --write-info-json --write-annotations --write-sub --write-thumbnail https://www.youtube.com/watch?5=7E-cwdnsiow

2.5. List all available formats of video or playlist

To list all bachelor formats that a video or playlist is available in, apply the following command:

$ youtube-dl --list-formats https://www.youtube.com/watch?v=7E-cwdnsiow

Or,

$ youtube-dl -F https://www.youtube.com/scout?five=7E-cwdnsiow

Sample output:

List all available formats of a youtube video using youtube-dl
List all available formats of a YouTube video using youtube-dl

Equally you tin come across in the above screenshot, Youtube-dl lists all available formats of the given video. From left to correct, it displays the video format lawmaking, extension and resolution note of the respective video. This tin can be helpful when yous want to download a video at a specific quality or format.

2.6. Display the size of Youtube videos

To retrieve the file size of a video, use -F flag.

$ youtube-dl -F https://www.youtube.com/watch?v=7E-cwdnsiow

You will run across the file size at the terminate of each file.

Sample output:

[youtube] 7E-cwdnsiow: Downloading webpage [info] Available formats for 7E-cwdnsiow: format code  extension  resolution annotation 249          webm       audio only tiny   51k , opus @ 50k (48000Hz), 2.56MiB 250          webm       audio only tiny   68k , opus @ 70k (48000Hz), iii.23MiB 140          m4a        audio just tiny  128k , m4a_dash container, [email protected] (44100Hz), 7.59MiB 251          webm       audio only tiny  137k , opus @160k (48000Hz), 6.12MiB 160          mp4        192x144    144p   52k , avc1.4d400c, 30fps, video only, 1.71MiB 278          webm       192x144    144p   73k , webm container, vp9, 30fps, video but, 3.73MiB 133          mp4        320x240    240p   89k , avc1.4d400d, 30fps, video only, 3.12MiB 242          webm       320x240    240p  135k , vp9, 30fps, video simply, 6.06MiB 134          mp4        480x360    360p  215k , avc1.4d401e, 30fps, video merely, seven.53MiB 243          webm       480x360    360p  242k , vp9, 30fps, video only, ten.39MiB 135          mp4        640x480    480p  382k , avc1.4d401e, 30fps, video but, fourteen.13MiB 244          webm       640x480    480p  390k , vp9, 30fps, video only, 16.44MiB 136          mp4        960x720    720p  737k , avc1.4d401f, 30fps, video only, 26.99MiB 247          webm       960x720    720p  770k , vp9, 30fps, video only, 31.12MiB 137          mp4        1440x1080  1080p 1391k , avc1.640028, 30fps, video only, 46.50MiB 248          webm       1440x1080  1080p 1421k , vp9, 30fps, video but, 52.19MiB 271          webm       1920x1440  1440p 3462k , vp9, 30fps, video only, 111.86MiB xviii           mp4        480x360    360p  360k , avc1.42001E, [email protected] 96k (44100Hz), 21.55MiB 22           mp4        960x720    720p  578k , avc1.64001F, [email protected] (44100Hz) (all-time)

ii.7. Download videos in certain quality and/or format

By default, Youtube-dl will download the best available quality video. Yet, it is also possible to download a video or playlist at a specific quality or format.

YouTube is capable of downloading videos in the following qualities:

  • best - Select the best quality format of the given file with video and audio.
  • worst - Select the worst quality format (both video and sound).
  • bestvideo - Select the best quality video-merely format (e.g. DASH video). Please annotation that it may not be available.
  • worstvideo - Select the worst quality video-but format. May non be available.
  • bestaudio - Select the best quality audio only-format. May not exist available.
  • worstaudio - Select the worst quality audio only-format. May not be bachelor.

For example, if you lot want to download all-time quality format (both audio and video), just apply the following control:

$ youtube-dl -f all-time https://www.youtube.com/picket?v=7E-cwdnsiow

Similarly, to download audio-only with best quality:

$ youtube-dl -f bestaudio https://www.youtube.com/watch?v=7E-cwdnsiow

To download worst quality video-just format, use the post-obit control:

$ youtube-dl -f worstvideo https://www.youtube.com/watch?v=7E-cwdnsiow

You can also combine different format options like below.

$ youtube-dl -f bestvideo+bestaudio https://world wide web.youtube.com/picket?v=7E-cwdnsiow

The above control will download all-time quality video-merely and all-time quality audio-only formats and merge them together with ffmpeg or avconv. Brand sure you have installed any one of these tools on your system.

If you lot don't want to merge, replace + (plus) operator with , (comma) similar below:

$ youtube-dl -f 'bestvideo,bestaudio' https://www.youtube.com/watch?5=7E-cwdnsiow -o '%(title)due south.f%(format_id)s.%(ext)s'

This command will download best quality video and all-time quality audio and will non mix them. In this case, you will go two files, one is audio and another is video. In this example, an output template ( -o option) is recommended as bestvideo and bestaudio may have the aforementioned file name.

We tin even download a video or playlist at a specific quality with specific resolution.

For instance, the following control will download the best quality video in 480 pixel resolution (less than or equal to 480p).

$ youtube-dl -f "best[height<=480]" https://www.youtube.com/watch?5=7E-cwdnsiow

Like already said, we can group the format selectors to go a specific quality video. The following command volition download best format available(both audio and video) but no better than 480p.

$ youtube-dl -f 'bestvideo[height<=480]+bestaudio/best[superlative<=480]' https://www.youtube.com/spotter?v=7E-cwdnsiow

ii.8. Download videos using format code

All videos have format codes which we tin use to download a video at specific quality.

To discover the format code, just list the available formats using whatsoever ane of the post-obit commands:

$ youtube-dl --listing-formats https://www.youtube.com/watch?v=7E-cwdnsiow

Or

$ youtube-dl -F https://www.youtube.com/watch?v=7E-cwdnsiow
List all available formats with youtube-dl
List all available formats with youtube-dl

As you can run across in the above screenshot, all format codes of the given video are listed in the first cavalcade. The best quality format is given at the end (the format code is 22 ). And then, the command to download best quality format is:

$ youtube-dl -f 22 https://www.youtube.com/watch?5=7E-cwdnsiow

Some videos may not have the aforementioned formats bachelor while you download videos from playlist. In such cases, you can specify multiple format codes in any preferred gild of your pick. Take a look at the following example:

$ youtube-dl -f 22/17/xviii <playlist_url>

As per the higher up example, Youtube-dl will download the videos in format 22 if it is available.

If the format 22 is not bachelor, it volition then download format 17 if it is available.

If both 22 and 17 formats are not available, it will finally try to download format 18.

If none of the specified formats are available, Youtube-dl will complain that no suitable formats are available for download.

Delight note that that slash is left-associative, i.eastward. formats on the left manus side are preferred.

ii.ix. Download videos past file extension

Download video(s) in your preferred format, say for example MP4, just run:

$ youtube-dl --format mp4 https://www.youtube.com/sentinel?five=7E-cwdnsiow

Or,

$ youtube-dl -f mp4 https://www.youtube.com/watch?5=7E-cwdnsiow

Like I already mentioned in the previous section, some videos may not available in your preferred formats. In such cases, Youtube-dl will download any other best available formats.

For example, the following command volition download best quality MP4 format file. If MP4 format is not bachelor, and so it will download any other best available format.

$  youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/all-time' https://www.youtube.com/watch?v=7E-cwdnsiow

If you want to download them with custom filename, do:

$ youtube-dl -f mp4 -o                      '%(title)south.f%(format_id)southward.%(ext)s'                    https://www.youtube.com/watch?5=7E-cwdnsiow

2.10. Set size limit for videos

When you download multiple videos from a playlist, you lot might want to download videos within a certain size only.

For instance, this control will non download any videos smaller than the given size, say 100MB:

$ youtube-dl --min-filesize 100M <playlist_url>

If you don't want to download videos larger than the given size, practise:

$ youtube-dl --max-filesize 100M <playlist_url>

Nosotros can also combine format pick operators to download sure size videos.

The following command will download best video-only format only not bigger than 100 MB.

$ youtube-dl -f 'best[filesize<100M]' https://www.youtube.com/watch?v=7E-cwdnsiow

ii.11. Download videos past date-wise

Youtube-dl allows us to filter and download video or playlist by their upload date. This will be very helpful when you lot want to download videos from a playlist that contains 100s of videos.

For instance, to download videos uploaded at an exact date, for example October 01, 2018, the command would be:

$ youtube-dl --engagement 20181001 <URL>

Download videos uploaded on or before a specific date:

$ youtube-dl --datebefore 20180101 <URL>

Download videos uploaded on or subsequently a specific date:

$ youtube-dl --dateafter 20180101 <URL>

Download just the videos uploaded in the concluding half-dozen months:

$ youtube-dl --dateafter now-6months <URL>

To download videos between a specific date, for example January 01, 2018 to January 01, 2019, utilise the post-obit command:

$ youtube-dl --dateafter 20180101 --datebefore 20190101 <URL>

2.12. Download specific videos from playlist

This is all the same another useful characteristic of Youtube-dl. It allows usa to download a specific song(s) from a playlist that contains 100s of songs.

For example, to download the tenth file from a playlist, run:

$ youtube-dl --playlist-items 10 <playlist_url>

Y'all can also download and catechumen the file to other format at the same time. For the the following command volition download the 1st file from the playlist and convert information technology to .mp3 format:

$ youtube-dl --playlist-items i -ten --audio-format mp3 <playlist_url>

Similarly, to download multiple random files, just specify indices of the videos in the playlist separated by commas like below::

$ youtube-dl --playlist-items two,3,7,x <playlist_url>

You lot can also specify the range of songs. To download a video playlist starting from a sure video, say 10, to end:

$ youtube-dl --playlist-offset 10 <playlist_url>

To download only the files starting from 2nd to 5th in a playlist, utilise:

$ youtube-dl --playlist-showtime 2 --playlist-end 5 <playlist_url>

2.thirteen. Download but videos suitable for specific historic period

This is another notable characteristic of Youtube-dl. Information technology allows the states to download only videos suitable for the given historic period.

Say for example, to download all "Let's Play" videos that aren't marked "NSFW" or age-restricted for 7 year-olds from a playlist, run:

$ youtube-dl --lucifer-title "let's play" --age-limit 7 --refuse-title "nsfw" <playlist_url>

2.14. Set download speed limit

Y'all can use -r option to limit the speed. For example, the following command will limit the speed to 50K .

$ youtube-dl -r 50K <URL>

Note that speed is specified in bytes per second.

two.xv. Resume downloads

By default, youtube-dl volition automatically resume the download where you left it off. If it is doesn't resume the download for any reason, merely force the resume of partially downloaded files with -c, --continue flag:

$ youtube-dl  -c  <URL>

2.16. Brandish Youtube-dl help

Youtube-dl has a lot more options. I guess these examples are simply plenty to use Youtube-dl to download videos from online. For more details, refer Youtube-dl help section.

$ youtube-dl --help

three. Youtube-dl Troubleshooting

Here are some mutual errors that you might see from time to time. Virtually errors will get fixed themselves after updating the youtube-dl to its most recent version.

Nonetheless, a few errors like below will non go fixed even if you're using an updated youtube-dl version.

three.i. Set up "Unable to download video information: HTTP Error 403: Forbidden" Error

When downloading videos from YouTube, sometimes you will get an error like below.

Fault: unable to download video data: HTTP Mistake 403: Forbidden

To fix this mistake, refer the following guide.

  • How To Prepare "Unable to download video data: HTTP Fault 403: Forbidden" Fault

iii.2. Alert: Requested formats are incompatible for merge and will be merged into mkv

This is another common error. When you download a video, you will get an error like below:

[youtube] _XEgknKEBws: Downloading webpage                      Alert: Requested formats are incompatible for merge and volition be merged into mkv.                    Error: unable to open for writing: [Errno 36] File proper name too long: '\xe0\xae\xa8\xe0\xaf\x8b\xe0\xae\xaf\xe0\xaf\x8d \xe0\xae\x8e\xe0\xae\xa4\xe0\xae\xbf\xe0\xae\xb0\xe0\xaf\x8d\xe0\xae\xaa\xe0\xaf\x8d\xe0\xae\xaa\xe0\xaf\x81 \xe0\xae\x9a\xe0\xae\x95\xe0\xaf\x8d\xe0\xae\xa4\xe0\xae\xbf\xe0\xae\xaf\xe0\xaf\x88 \xe0\xae\x85\xe0\xae\xa4\xe0\xae\xbf\xe0\xae\x95\xe0\xae\xb0\xe0\xae\xbf\xe0\xae\x95\xe0\xaf\x8d\xe0\xae\x95\xe0\xaf\x81\xe0\xae\xae\xe0\xaf\x8d \xe0\xae\x87\xe0\xae\xaf\xe0\xae\xb1\xe0\xaf\x8d\xe0\xae\x95\xe0\xaf\x88 \xe0\xae\xaa\xe0\xae\xbe\xe0\xae\xa9\xe0\xae\x95\xe0\xae\xae\xe0\xaf\x8d - \xe0\xae\xa8\xe0\xae\xbe\xe0\xae\xae\xe0\xaf\x87 \xe0\xae\xa4\xe0\xae\xaf\xe0\xae\xbe\xe0\xae\xb0\xe0\xae\xbf\xe0\xae\xaa\xe0\xaf\x8d\xe0\xae\xaa\xe0\xae\xa4\xe0\xaf\x81 \xe0\xae\x8e\xe0\xae\xaa\xe0\xaf\x8d\xe0\xae\xaa\xe0\xae\x9f\xe0\xae\xbf- \xe0\xae\xae\xe0\xae\xb0\xe0\xaf\x81\xe0\xae\xa4\xe0\xaf\x8d\xe0\xae\xa4\xe0\xaf\x81\xe0\xae\xb5\xe0\xae\xb0\xe0\xaf\x8d \xe0\xae\xa4\xe0\xaf\x80\xe0\xae\xaa\xe0\xae\xbe \xe0\xae\xb5\xe0\xae\xbf\xe0\xae\xb3\xe0\xae\x95\xe0\xaf\x8d\xe0\xae\x95\xe0\xae\xae\xe0\xaf\x8d-_XEgknKEBws.f136.mp4.part'

This is actually not a problem just an expected behavior for youtube-dl.

Past default, youtube-dl will download the highest quality audio and the highest quality video streams available and then join them into a compatible container like mkv, mp4 etc.

If these audio and video streams doesn't fit well in an mp4 container, youtube-dl will then pack them in mkv container and display the above alert message.

In such cases, you can ignore the mkv alert and download the best quality video and the best quality sound but merely in an mp4 container by explicitly mentioning the desired best quality audio and video formats like beneath:

$ youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]' https://youtu.be/_XEgknKEBws

3.3. Fault: unable to open up for writing: [Errno 36] File name too long

When you lot try to download a YouTube video that has long name, you lot will probably become this mistake:

[youtube] _XEgknKEBws: Downloading webpage                      ERROR: unable to open for writing: [Errno 36] File proper noun also long:                    '\xe0\xae\xa8\xe0\xaf\x8b\xe0\xae\xaf\xe0\xaf\x8d \xe0\xae\x8e\xe0\xae\xa4\xe0\xae\xbf\xe0\xae\xb0\xe0\xaf\x8d\xe0\xae\xaa\xe0\xaf\x8d\xe0\xae\xaa\xe0\xaf\x81 \xe0\xae\x9a\xe0\xae\x95\xe0\xaf\x8d\xe0\xae\xa4\xe0\xae\xbf\xe0\xae\xaf\xe0\xaf\x88 \xe0\xae\x85\xe0\xae\xa4\xe0\xae\xbf\xe0\xae\x95\xe0\xae\xb0\xe0\xae\xbf\xe0\xae\x95\xe0\xaf\x8d\xe0\xae\x95\xe0\xaf\x81\xe0\xae\xae\xe0\xaf\x8d \xe0\xae\x87\xe0\xae\xaf\xe0\xae\xb1\xe0\xaf\x8d\xe0\xae\x95\xe0\xaf\x88 \xe0\xae\xaa\xe0\xae\xbe\xe0\xae\xa9\xe0\xae\x95\xe0\xae\xae\xe0\xaf\x8d - \xe0\xae\xa8\xe0\xae\xbe\xe0\xae\xae\xe0\xaf\x87 \xe0\xae\xa4\xe0\xae\xaf\xe0\xae\xbe\xe0\xae\xb0\xe0\xae\xbf\xe0\xae\xaa\xe0\xaf\x8d\xe0\xae\xaa\xe0\xae\xa4\xe0\xaf\x81 \xe0\xae\x8e\xe0\xae\xaa\xe0\xaf\x8d\xe0\xae\xaa\xe0\xae\x9f\xe0\xae\xbf- \xe0\xae\xae\xe0\xae\xb0\xe0\xaf\x81\xe0\xae\xa4\xe0\xaf\x8d\xe0\xae\xa4\xe0\xaf\x81\xe0\xae\xb5\xe0\xae\xb0\xe0\xaf\x8d \xe0\xae\xa4\xe0\xaf\x80\xe0\xae\xaa\xe0\xae\xbe \xe0\xae\xb5\xe0\xae\xbf\xe0\xae\xb3\xe0\xae\x95\xe0\xaf\x8d\xe0\xae\x95\xe0\xae\xae\xe0\xaf\x8d-_XEgknKEBws.f136.mp4.part

To fix this error, simply download the video with shorter proper noun of your option with "-o" flag like beneath:

$ youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]'                      -o video.mp4                    https://youtu.be/_XEgknKEBws

Determination

In my opinion, Youtube-dl is undoubtedly i of the best downloader to download sound, video from online. You can use Youtube-dl to download sound and video from hundreds of websites.

I will keep updating this Youtube-dl tutorial when I came across a new Youtube-dl tip. Bookmark and keep visiting it once in a while.

If you recall some important tip is missing, delight permit me know in the annotate department below. I will bank check and update this guide accordingly.

Resources:

  • Youtube-dl website
  • https://jonlabelle.com/snippets/view/shell/youtube-dl-command

DOWNLOAD HERE

Posted by: fischerfultank.blogspot.com

Post a Comment for "How to Download Best Quality With Youtubedl"