Video Downloader in terminal with youtube-dl

Download Video Downloader in terminal with youtube-dl

Post on 30-Jan-2016




0 download


Video Downloader in terminal with youtube-dl


<ul><li><p>Video Downloader `youtube-dl` Gets Support For</p><p>Separate Audio And Video YouTube DASH Streams</p><p>YouTube uses Dynamic Adaptive Streaming over HTTP (DASH) for delivering videos and along with</p><p>that, it serves the audio and video in two separate streams for some resolutions/formats. For instance,</p><p>resolutions like 1080p and 480p are available only with separate audio and video streams.</p><p>youtube-dl, a popular command line tool for downloading videos from YouTube and other</p><p>similar websites, was updated recently with proper support for DASH and separate audio and</p><p>video streams: the tool can now automatically combine / merge / multiplex the audio and</p><p>video formats offered by YouTube.</p><p>Here's an example via for downloading separate audio and video streams from YouTube and</p><p>combining them automatically using youtube-dl (which uses ffmpeg or avconv under the hood):</p><p>"Now, if you want a 480p video in H.264 format, High profile, with 128kbps AAC audio (this used to be Youtube's format</p><p>35), you can specify format -f 135+140 on the command-line and it will download both the audio, the video and multiplex it</p><p>with ffmpeg (or avconv, depending on what you have installed)."</p><p>And that's not all, a lot of other improvements and fixes are added daily to this command line</p><p>download tool.</p><p>For instance, since our previous article about youtube-dl, the downloader received support for many</p><p>websites, including: Vevo, 9gag,,,,,,,</p><p>,,, Dropbox and so on, along with many fixes and improvements.</p><p>For those not familiar with youtube-dl, this command line video downloader not only supports</p><p>hundreds of websites, but it can also extract the audio automatically, download playlists, download and</p><p>embed subtitles into videos and more.</p><p>Install youtube-dl in Ubuntu</p><p>The latest youtube-dl 2014.02.17 is available in the Ubuntu 14.04 Trusty Tahr repository but it</p></li><li><p>wasn't backported for older Ubuntu versions. Install it via Ubuntu Software Center or by using the</p><p>following command:</p><p>sudo apt-get install youtube-dl</p><p>For older Ubuntu versions (though I also recommend it for Ubuntu 14.04), you can install</p><p>youtube-dl by using the main WebUpd8 PPA.</p><p>As a reminder, I update youtube-dl from the WebUpd8 PPA a few times a week, so if YouTube or another websitemake changes that break it, run an update and it's very likely that a new youtube-dl version will be available, whichfixes the issues.</p><p>To add the main WebUpd8 PPA and install youtube-dl in Ubuntu and derivatives (Linux Mint,</p><p>elementary OS and so on), use the following commands:</p><p>sudo add-apt-repository ppa:nilarimogard/webupd8</p><p>sudo apt-get update</p><p>sudo apt-get install youtube-dl</p><p>If you don't want to add our PPA, you can manually download the deb from the PPA by visiting THIS</p><p>link.</p><p>For other Linux distributions, you'll find installation instructions HERE. </p><p>Using youtube-dl to download videos</p><p>To download a video, simply use the following command:</p><p>youtube-dl http://VIDEO_URL</p><p>where "VIDEO_URL" is the url of the video you want to download. </p><p>If you don't use any parameters, youtube-dl tries to download the best format. For YouTube, by</p><p>default it downloads the best non-DASH format, which usually is 720p mp4 for YouTube.</p><p>So here's how to download 1080p YouTube videos using youtube-dl:</p></li><li><p>How to download 1080p YouTube videos using youtube-dl</p><p>1. Firstly, get a list of formats. I'll use a random video link as an example below:</p><p>youtube-dl -F</p><p>This will list all the available formats:</p><p>youtube-dl -F</p><p>[youtube] Setting language</p><p>[youtube] 3JZ_D3ELwOQ: Downloading webpage</p><p>[youtube] 3JZ_D3ELwOQ: Downloading video info webpage</p><p>[youtube] 3JZ_D3ELwOQ: Extracting video information</p><p>[info] Available formats for 3JZ_D3ELwOQ:</p><p>format code extension resolution note </p><p>171 webm audio only DASH webm audio , audio@ 48k (worst)</p><p>140 m4a audio only DASH audio , audio@128k</p><p>160 mp4 192p DASH video </p><p>133 mp4 240p DASH video </p><p>134 mp4 360p DASH video </p><p>135 mp4 480p DASH video </p><p>136 mp4 720p DASH video </p><p>137 mp4 1080p DASH video </p><p>17 3gp 176x144 </p><p>36 3gp 320x240 </p><p>5 flv 400x240 </p><p>43 webm 640x360 </p><p>18 mp4 640x360 </p><p>22 mp4 1280x720 (best)</p><p>As you can see, for 1080p there's only a DASH video available (format 137) and two separate DASH</p><p>audio files (formats 140 and 171). </p><p>2. To get the best video quality (1080p DASH - format "137") and best audio quality (DASH audio -format "140"), you must use the following command:</p><p>youtube-dl -f 137+140</p></li><li><p>"-f 137+140" specifies the format: 137 (which means mp4 1080p as you can see above) for video and140 (which means m4a audio@128k) for audio, as displayed by the command under step 1.</p><p>To see all the available options (extract audio,choose a different video quality, download a videoplaylist and many many other options), type thefollowing commands in a terminal: "man youtube-dl" or "youtube-dl -h".</p></li></ul>