Can You Replace Youtube Video Audio After Upload
In this comprehensive Youtube-dl tutorial, we are going to learn what is Youtube-dl and the list of nearly commonly used Youtube-dl commands with examples to download audio and video streams from Internet in Linux operating systems.
What is Youtube-dl?
Youtube-dl is a most popular command line YouTube downloader application. Youtube-dl can be able to download a single track or the entire playlist in one get.
Youtube-dl is not just to download videos from Youtube, but also from a lot of other websites. You can view the consummate listing of supported sites hither.
It is a free and open source program written in Python. It supports GNU/Linux, Mac Bone 10 and Microsoft Windows.
1. Install Youtube-dl On Linux
Youtube-dl can exist installed in many ways. Let the states them all.
ane.1. The officially recommended way to install Youtube-dl
The officially recommended fashion to install Youtube-dl is just download it, salvage it in your $PATH
, make it executable and start using it right away.
$ sudo curl -Fifty https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
If you lot don't have ringlet, 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.2. Install Youtube-dl using Pip
Alternatively, you can install it using Pip equally shown below.
$ sudo -H pip install --upgrade youtube-dl
1.3. Install Youtube-dl using package manager
Youtube-dl is too available in the official repositories of some Linux distributions.
To install Youtube-dl in Alpine Linux, run:
$ sudo apk add together youtube-dl
Install Youtube-dl in Arch Linux, EndeavourOS, Manjaro Linux using command:
$ sudo pacman -Due south 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.iv. 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
one.5. Update Youtube-dl
If yous've manually installed Youtube-dl using roll
or wget
, run the following control to update it:
$ sudo youtube-dl -U
If you installed it using pip
, exercise:
$ sudo pip install -U youtube-dl
Those who installed Youtube-dl using the distribution'south package manager, just utilise the appropriate update control. For instance, on Arch Linux, you can update Youtube-dl past simply running the following command:
$ sudo pacman -Syu
On Debian, Ubuntu:
$ sudo apt update
At present, allow us meet some examples to acquire to employ Youtube-dl.
2. Youtube-dl Tutorial With Examples
Here, I have compiled most commonly used Youtube-dl commands to download a video or playlist from YouTube.
2.1. Download video or playlist
To download a video or the entire playlist from YouTube, simply mention the URL like below:
$ youtube-dl https://www.youtube.com/sentry?v=7E-cwdnsiow
If you lot want to download video or playlist with a custom name of your choice, the command would be:
$ youtube-dl -o 'abdul kalam inspirational voice communication' https://www.youtube.com/watch?v=7E-cwdnsiow
Replace "abdul kalam inspirational oral communication" with your own name.
Do you desire to relieve the video in some other location? Utilise -o
flag followed by the target location similar beneath.
$ 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: /home/sk/Downloads/abdul kalam speech.f251 [download] 100% of 6.12MiB in 00:03 [ffmpeg] Merging formats into "/habitation/sk/Downloads/abdul kalam speech.webm" Deleting original file /home/sk/Downloads/abdul kalam speech.f271 (pass -k to proceed) Deleting original file /dwelling/sk/Downloads/abdul kalam speech.f251 (pass -yard to keep)
You can besides include additional details, such as the title, the uploader name (aqueduct name) and upload date etc., in the file name by using the following command:
$ youtube-dl -o '%(title)southward past %(uploader)s on %(upload_date)s in %(playlist)southward.%(ext)s' https://www.youtube.com/watch?v=7E-cwdnsiow
2.two. Download multiple videos
Sometimes, you might want to download multiple videos from or whatsoever other site. If so, just mention the URL of the videos with space-separated like below:
$ youtube-dl <url1> <url2>
Alternatively, you tin put them all in a text file and pass information technology to Youtube-dl every bit an argument similar below.
$ youtube-dl -a url.txt
This command volition download all videos mentioned in the url.txt file.
2.three. Download audio-only from a video
Youtube-dl allows us to download audio but from a YouTube video. If you ever been in a state of affairs to download only the sound, run:
$ youtube-dl -10 https://www.youtube.com/watch?v=7E-cwdnsiow
By default, Youtube-dl will save the audio in Ogg
(opus) format.
If yous adopt to download any other formats, for instance mp3
, run:
$ youtube-dl -x --audio-format mp3 https://world wide web.youtube.com/picket?v=7E-cwdnsiow
This control will download the audio from the given video/playlist, convert it to an MP3 and save it in the current directory. Please note that you should install either ffmpeg
or avconv
to convert the file to mp3 format.
2.4. Download video with clarification, metadata, annotations, subtitles and thumbnail
To download a video forth with its other details such every bit description, metadata, annotations, subtitles, and thumbnail etc., employ the following command:
$ youtube-dl --write-description --write-info-json --write-annotations --write-sub --write-thumbnail https://www.youtube.com/picket?v=7E-cwdnsiow
ii.5. List all available formats of video or playlist
To listing all available 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/watch?v=7E-cwdnsiow
Sample output:
As you can meet in the to a higher place screenshot, Youtube-dl lists all available formats of the given video. From left to right, it displays the video format code, extension and resolution note of the respective video. This tin be helpful when you lot desire to download a video at a specific quality or format.
2.half-dozen. 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?five=7E-cwdnsiow
You will see the file size at the end of each file.
Sample output:
[youtube] 7E-cwdnsiow: Downloading webpage [info] Available formats for 7E-cwdnsiow: format code extension resolution note 249 webm audio just tiny 51k , opus @ 50k (48000Hz), 2.56MiB 250 webm audio only tiny 68k , opus @ 70k (48000Hz), three.23MiB 140 m4a audio only tiny 128k , m4a_dash container, [email protected] (44100Hz), 7.59MiB 251 webm sound only tiny 137k , opus @160k (48000Hz), 6.12MiB 160 mp4 192x144 144p 52k , avc1.4d400c, 30fps, video just, ane.71MiB 278 webm 192x144 144p 73k , webm container, vp9, 30fps, video merely, iii.73MiB 133 mp4 320x240 240p 89k , avc1.4d400d, 30fps, video only, three.12MiB 242 webm 320x240 240p 135k , vp9, 30fps, video only, six.06MiB 134 mp4 480x360 360p 215k , avc1.4d401e, 30fps, video just, 7.53MiB 243 webm 480x360 360p 242k , vp9, 30fps, video but, 10.39MiB 135 mp4 640x480 480p 382k , avc1.4d401e, 30fps, video only, 14.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 merely, 31.12MiB 137 mp4 1440x1080 1080p 1391k , avc1.640028, 30fps, video only, 46.50MiB 248 webm 1440x1080 1080p 1421k , vp9, 30fps, video just, 52.19MiB 271 webm 1920x1440 1440p 3462k , vp9, 30fps, video only, 111.86MiB 18 mp4 480x360 360p 360k , avc1.42001E, [email protected] 96k (44100Hz), 21.55MiB 22 mp4 960x720 720p 578k , avc1.64001F, [electronic mail protected] (44100Hz) (all-time)
2.7. Download videos in sure quality and/or format
Past default, Youtube-dl volition download the best available quality video. However, 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 all-time quality format of the given file with video and audio.
- worst - Select the worst quality format (both video and audio).
- bestvideo - Select the best quality video-only format (e.g. Nuance video). Please note that it may not be available.
- worstvideo - Select the worst quality video-merely format. May not be bachelor.
- bestaudio - Select the best quality audio only-format. May not exist available.
- worstaudio - Select the worst quality audio simply-format. May non exist available.
For instance, if you want to download best quality format (both sound and video), but apply the following command:
$ youtube-dl -f all-time https://www.youtube.com/watch?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-only format, use the post-obit command:
$ youtube-dl -f worstvideo https://world wide web.youtube.com/watch?v=7E-cwdnsiow
You can besides combine different format options like below.
$ youtube-dl -f bestvideo+bestaudio https://www.youtube.com/watch?five=7E-cwdnsiow
The above command will download best quality video-just and best quality audio-only formats and merge them together with ffmpeg
or avconv
. Make sure you accept installed any one of these tools on your organisation.
If you don't desire to merge, replace +
(plus) operator with ,
(comma) similar below:
$ youtube-dl -f 'bestvideo,bestaudio' https://www.youtube.com/watch?v=7E-cwdnsiow -o '%(championship)s.f%(format_id)due south.%(ext)southward'
This command will download all-time quality video and best quality sound and will not mix them. In this case, you will go 2 files, one is audio and another is video. In this case, an output template ( -o
option) is recommended every bit bestvideo and bestaudio may take the same file proper name.
We can even download a video or playlist at a specific quality with specific resolution.
For case, the following command will download the best quality video in 480 pixel resolution (less than or equal to 480p).
$ youtube-dl -f "best[elevation<=480]" https://www.youtube.com/watch?v=7E-cwdnsiow
Similar already said, nosotros tin group the format selectors to become a specific quality video. The following control will download all-time format bachelor(both audio and video) but no better than 480p.
$ youtube-dl -f 'bestvideo[height<=480]+bestaudio/best[summit<=480]' https://www.youtube.com/sentinel?v=7E-cwdnsiow
2.8. Download videos using format code
All videos have format codes which nosotros can apply to download a video at specific quality.
To find the format code, merely list the bachelor formats using whatever one of the following commands:
$ youtube-dl --list-formats https://www.youtube.com/picket?v=7E-cwdnsiow
Or
$ youtube-dl -F https://www.youtube.com/sentinel?5=7E-cwdnsiow
As you can see in the higher up screenshot, all format codes of the given video are listed in the showtime column. The best quality format is given at the end (the format code is 22
). So, the control to download best quality format is:
$ youtube-dl -f 22 https://www.youtube.com/lookout?v=7E-cwdnsiow
Some videos may non take the aforementioned formats bachelor while y'all download videos from playlist. In such cases, you tin can specify multiple format codes in whatever preferred society of your option. Take a look at the following instance:
$ youtube-dl -f 22/17/18 <playlist_url>
As per the above case, Youtube-dl volition download the videos in format 22
if it is available.
If the format 22
is non available, information technology volition then download format 17
if it is bachelor.
If both 22
and 17
formats are non available, information technology 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.
Please annotation that that slash is left-associative, i.e. formats on the left paw side are preferred.
2.9. Download videos by file extension
Download video(southward) in your preferred format, say for case MP4, just run:
$ youtube-dl --format mp4 https://www.youtube.com/watch?v=7E-cwdnsiow
Or,
$ youtube-dl -f mp4 https://www.youtube.com/lookout?v=7E-cwdnsiow
Similar I already mentioned in the previous section, some videos may non available in your preferred formats. In such cases, Youtube-dl will download any other all-time available formats.
For example, the post-obit command will download all-time quality MP4 format file. If MP4 format is not available, then it will download any other best bachelor 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)s.f%(format_id)s.%(ext)south' https://world wide web.youtube.com/watch?v=7E-cwdnsiow
2.10. Set size limit for videos
When you download multiple videos from a playlist, you might want to download videos within a certain size merely.
For example, this command will not download any videos smaller than the given size, say 100MB:
$ youtube-dl --min-filesize 100M <playlist_url>
If you don't desire to download videos larger than the given size, practice:
$ youtube-dl --max-filesize 100M <playlist_url>
We tin besides combine format selection operators to download sure size videos.
The post-obit command will download all-time video-only format only not bigger than 100 MB.
$ youtube-dl -f 'best[filesize<100M]' https://www.youtube.com/watch?five=7E-cwdnsiow
2.eleven. Download videos by date-wise
Youtube-dl allows us to filter and download video or playlist by their upload appointment. This will be very helpful when yous desire 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 control would be:
$ youtube-dl --date 20181001 <URL>
Download videos uploaded on or before a specific date:
$ youtube-dl --datebefore 20180101 <URL>
Download videos uploaded on or after a specific appointment:
$ youtube-dl --dateafter 20180101 <URL>
Download but the videos uploaded in the last vi months:
$ youtube-dl --dateafter now-6months <URL>
To download videos between a specific date, for example January 01, 2018 to Jan 01, 2019, utilize the following command:
$ youtube-dl --dateafter 20180101 --datebefore 20190101 <URL>
2.12. Download specific videos from playlist
This is yet another useful characteristic of Youtube-dl. Information technology allows us to download a specific song(s) from a playlist that contains 100s of songs.
For case, to download the tenth file from a playlist, run:
$ youtube-dl --playlist-items 10 <playlist_url>
You can also download and catechumen the file to other format at the same time. For the the following control will download the 1st file from the playlist and convert it to .mp3
format:
$ youtube-dl --playlist-items i -x --audio-format mp3 <playlist_url>
Similarly, to download multiple random files, merely specify indices of the videos in the playlist separated by commas like below::
$ youtube-dl --playlist-items 2,3,seven,x <playlist_url>
You can also specify the range of songs. To download a video playlist starting from a certain video, say 10, to finish:
$ youtube-dl --playlist-starting time 10 <playlist_url>
To download only the files starting from second to 5th in a playlist, use:
$ youtube-dl --playlist-offset ii --playlist-cease v <playlist_url>
ii.thirteen. Download only videos suitable for specific age
This is another notable feature of Youtube-dl. It allows us to download only videos suitable for the given historic period.
Say for example, to download all "Allow'southward Play" videos that aren't marked "NSFW" or age-restricted for 7 twelvemonth-olds from a playlist, run:
$ youtube-dl --match-title "let'southward play" --age-limit seven --turn down-title "nsfw" <playlist_url>
two.14. Set download speed limit
You lot tin 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 2d.
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, just force the resume of partially downloaded files with -c
, --continue
flag:
$ youtube-dl -c <URL>
two.16. Display Youtube-dl help
Youtube-dl has a lot more options. I guess these examples are just plenty to utilize Youtube-dl to download videos from online. For more details, refer Youtube-dl help section.
$ youtube-dl --aid
3. Youtube-dl Troubleshooting
Here are some common errors that you might encounter from fourth dimension to time. Most errors will get fixed themselves later on updating the youtube-dl to its nigh recent version.
However, a few errors like below will not get fixed even if you're using an updated youtube-dl version.
three.1. Fix "Unable to download video information: HTTP Error 403: Forbidden" Error
When downloading videos from YouTube, sometimes you will get an error similar beneath.
Mistake: unable to download video data: HTTP Error 403: Forbidden
To fix this error, refer the following guide.
- How To Gear up "Unable to download video data: HTTP Error 403: Forbidden" Error
3.2. WARNING: Requested formats are incompatible for merge and volition be merged into mkv
This is another common fault. 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 exist merged into mkv. Error: unable to open for writing: [Errno 36] File proper noun 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 really non a problem but an expected behavior for youtube-dl.
Past default, youtube-dl will download the highest quality sound and the highest quality video streams available and so 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 in a higher place warning bulletin.
In such cases, you can ignore the mkv warning and download the best quality video and the all-time quality audio but just in an mp4 container by explicitly mentioning the desired best quality sound and video formats similar below:
$ youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]' https://youtu.be/_XEgknKEBws
3.3. Mistake: unable to open for writing: [Errno 36] File name as well long
When you endeavour to download a YouTube video that has long name, yous will probably get this error:
[youtube] _XEgknKEBws: Downloading webpage Mistake: unable to open for writing: [Errno 36] File name likewise 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.role
To fix this error, simply download the video with shorter name of your choice with "-o" flag similar beneath:
$ youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]' -o video.mp4 https://youtu.be/_XEgknKEBws
Conclusion
In my opinion, Youtube-dl is undoubtedly one of the best downloader to download sound, video from online. Yous can use Youtube-dl to download audio and video from hundreds of websites.
I will continue updating this Youtube-dl tutorial when I came beyond a new Youtube-dl tip. Bookmark and keep visiting it once in a while.
If you call back some important tip is missing, please let me know in the annotate section below. I will check and update this guide accordingly.
Resources:
- Youtube-dl website
- https://jonlabelle.com/snippets/view/shell/youtube-dl-control
Source: https://ostechnix.com/youtube-dl-tutorial-with-examples-for-beginners/
Posted by: carsondins1991.blogspot.com
0 Response to "Can You Replace Youtube Video Audio After Upload"
Post a Comment