![]() |
|
youtube-dl installation and simple usage [Debian based Distros] - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Computers (https://sinister.ly/Forum-Computers) +--- Forum: Operating Systems (https://sinister.ly/Forum-Operating-Systems) +--- Thread: youtube-dl installation and simple usage [Debian based Distros] (/Thread-youtube-dl-installation-and-simple-usage-Debian-based-Distros) |
youtube-dl installation and simple usage [Debian based Distros] - L0aD1nG - 08-05-2014 Downloading youtube videos via terminal
Hello [username], this will be a simple tutorial about how to install youtube-dl and simply use it.The youtube-dl package provides you a terminal Youtube Downloader, and the best part of it is that the speed is the maximum DL speed you can achieve.All the code is tested on Debian 7.6! Requirements : python (>= 2.7), python-pkg-resources START Check if python-pkg-resources is installed. The python (>= 2.7) requirement would probably be satisfied in a modern distro.So we check of the the second one. Code: aptitude search python-pkg-resourcesIf its not installed Spoiler:Code: aptitude install python-pkg-resourcesInstall youtube-dl. Go here choose the mirror you prefer and download the youtube-dl_2014.07.15-1_all.deb package. Then install it. Code: dpkg -i youtube-dl_2014.07.15-1_all.debNow you are ready to download. Simplest way to do it is use to use the script and pass it the youtube video url paste as an argument. Code: youtube-dl <paste youtube video url>For whole playlist downloading you should add a "http://www.youtube.com/playlist?list=" prefix and then copy and paste the list="..." part from the playlist url. Spoiler: For ExampleCode: youtube-dl http://www.youtube.com/playlist?list=PLTlJK3kwZIbQQmXSnDpiVtrhpiyl7b53TFinding out formats(resolutions) available for download You can find out the available resolutions to download the video on. Code: youtube-dl -F <paste youtube video url>This will show you all about formats available for the video nicely documented. Download Example with specified format Spoiler: Click to view exampleFor example to download the Iron Man 3 official trailer on 1280x720 resolution you will go like this: Find out what the number of the format is from the format column of -F parameter. Code: youtube-dl -F https://www.youtube.com/watch?v=2CzoSeClcw0And then of course use the number to pick the resolution you want. Code: youtube-dl -f 22 https://www.youtube.com/watch?v=2CzoSeClcw0NOTE : Take care avoid the music only, and video only resolutions.Except if its about a song or you want a muted video. orly Take a look on man page...its awesome documented. For more advanced stuff you can always check out the manual. Code: man youtube-dlEND At last i should mention that you must either specify a folder with parameter usage or cd to the path you would like to download the files. You can also find recommended packages for that package here.I hope this helped out, I personally like this tool and believe its something very handy for everyday terminal users.As always I hope the english wasn't extremely hard to read. Thanks for reading this! Sincerely, L0ad1ng. RE: youtube-dl installation and simple usage [Debian based Distros] - chmod - 08-05-2014 I've used this for a while (it's actually in the standard repo's for Fedora. Just to note this also works with other video hosting sites (not all though) Another thing to note is that by default this tool sometimes doesn't support 1080p downloads by default due to youtube splitting up the audio/video streams (meaning you have to download each stream and then combine them. Luckily I came across this script which does all of that for you (requires youtube-dl and ffmpeg in order to work) Code: #!/bin/bash
#Youtube-DL DASH Video and Audio merging script
#Written by QuidsUp
#Edited by Christoph Korn
File1New=video.mp4
File2New=audio.m4a
URL=$1
if [ -z $URL ]; then
echo "Usage: ytdl.sh url"
exit
fi
#Find what quality of videos are available
youtube-dl -F $URL
echo
echo -n "Quality for Video (default 137): "
read Qual1
echo -n "Quality for Audio (default 141): "
read Qual2
#Set values if user has just pressed Return without typing anything
if [ -z $Qual1 ]; then
Qual1="137"
fi
if [ -z $Qual2 ]; then
Qual2="141"
fi
#Set filenames from output of youtube-dl
File1=$(youtube-dl --get-filename -f $Qual1 $URL)
File2=$(youtube-dl --get-filename -f $Qual2 $URL)
echo $File1
echo $File2
Out=${File1:0:${#File1}-16}".mp4"
echo $Out
#Download Video file with First Quality Setting
youtube-dl -f $Qual1 $URL
if [[ ! -f $File1 ]]; then
echo
echo "Error video file not downloaded"
exit
fi
mv "$File1" "$File1New"
#Download Audio file with Second Quality Setting
youtube-dl -f $Qual2 $URL
if [[ ! -f $File2 ]]; then
echo
echo "Error audio file not downloaded"
exit
fi
mv "$File2" "$File2New"
File1=$File1New
File2=$File2New
#Merge Audio and Video with ffmpeg
#Delete -threads 0 if you have a Single Core CPU
echo
echo "Combining Audio and Video files with FFMpeg"
ffmpeg -i "$File1" -i "$File2" -sameq -threads 0 "$Out"
if [[ -f $Out ]]; then
echo
echo "File" $Out "created"
else
echo
echo "Error Unable to combine Audio and Video files with FFMpeg"
exit
fi
#Remove old Files
rm "$File1"
rm "$File2"RE: youtube-dl installation and simple usage [Debian based Distros] - L0aD1nG - 08-05-2014 (08-05-2014, 05:37 PM)chmod Wrote: I've used this for a while (it's actually in the standard repo's for Fedora. I didn't know about Fedora and I wanted to be sure about what I post. Usefull note. (08-05-2014, 05:37 PM)chmod Wrote: Just to note this also works with other video hosting sites (not all though) Great automation script dude! Cheers for sharing. RE: youtube-dl installation and simple usage [Debian based Distros] - chmod - 08-05-2014 (08-05-2014, 05:49 PM)L0aD1nG Wrote:(08-05-2014, 05:37 PM)chmod Wrote: I've used this for a while (it's actually in the standard repo's for Fedora. It's not my work and I can't remember where I found it so can't give credits unfortunately. RE: youtube-dl installation and simple usage [Debian based Distros] - L0aD1nG - 08-05-2014 (08-05-2014, 05:56 PM)chmod Wrote:(08-05-2014, 05:49 PM)L0aD1nG Wrote:(08-05-2014, 05:37 PM)chmod Wrote: I've used this for a while (it's actually in the standard repo's for Fedora. Well its you who shared the info! :epic: RE: youtube-dl installation and simple usage [Debian based Distros] - chmod - 08-05-2014 (08-05-2014, 05:57 PM)L0aD1nG Wrote: Well its you who shared the info! :epic: That I did but didn't want to take credit for coming up with it is all. RE: youtube-dl installation and simple usage [Debian based Distros] - L0aD1nG - 08-12-2014 @chmod Thread updated, specified resolution added also mp3 can downloaded that way check it out tell me what you think mate. RE: youtube-dl installation and simple usage [Debian based Distros] - chmod - 08-12-2014 (08-12-2014, 12:02 PM)L0aD1nG Wrote: @chmod Thread updated, specified resolution added also mp3 can downloaded that way check it out tell me what you think mate. Looks pretty good, although if you require the highest resolution you will have to download the video and audio separately and combine them using something like ffmpeg (which is what the script I posted does, although it needs updating due to ffmpeg being updated which I'll do tonight at some point) RE: youtube-dl installation and simple usage [Debian based Distros] - L0aD1nG - 08-12-2014 (08-12-2014, 08:53 PM)chmod Wrote:(08-12-2014, 12:02 PM)L0aD1nG Wrote: @chmod Thread updated, specified resolution added also mp3 can downloaded that way check it out tell me what you think mate. True it can't take 1080p only till 720p then you must do what you say to do @chmod but 720p its fine isn't it?? Kappa RE: youtube-dl installation and simple usage [Debian based Distros] - chmod - 08-12-2014 (08-12-2014, 10:12 PM)L0aD1nG Wrote:(08-12-2014, 08:53 PM)chmod Wrote:(08-12-2014, 12:02 PM)L0aD1nG Wrote: @chmod Thread updated, specified resolution added also mp3 can downloaded that way check it out tell me what you think mate. As far as I'm concerned, yes but it's still worth mentioning for those that want it. |