Generally, we download videos from YouTube using the web browser. But now you can also download videos from YouTube using the command line. This tutorial will help you to install Linux command line YouTube downloader and examples for downloading videos.
Installing Youtube Downloader
Use the following command to install YouTube command line downloader as per your Linux operating system.
Ubuntu, Debian and LinuxMint
$ sudo apt-get install download-dl
CentOS, RHEL, Fedora and SL
# yum install youtube-dl
Download Youtube Videos
Now use followings set of example commands to download Youtube videos with different-2 options and formats as per your requirements.
1. Download Video – Use this command to download videos directly on your system.
$youtube-dl https://www.youtube.com/watch?v=McuF7g14hYw [youtube] McuF7g14hYw: Downloading webpage [youtube] McuF7g14hYw: Downloading video info webpage [youtube] McuF7g14hYw: Extracting video information [youtube] McuF7g14hYw: Downloading DASH manifest [youtube] McuF7g14hYw: Downloading DASH manifest [download] Destination: How to Download Java Archive using Command Line -McuF7g14hYw.mp4 [download] 100% of 3.79MiB in 00:09
2. Save Videos with Different Name – Use option -o followed by new video file name to save on your system disk.
$youtube-dl https://www.youtube.com/watch?v=McuF7g14hYw -o Video.mp4 [youtube] McuF7g14hYw: Downloading webpage [youtube] McuF7g14hYw: Downloading video info webpage [youtube] McuF7g14hYw: Extracting video information [youtube] McuF7g14hYw: Downloading DASH manifest [youtube] McuF7g14hYw: Downloading DASH manifest [download] Destination: Video.mp4 [download] 100% of 3.79MiB in 00:07
3. Download Audio in MP3 Only – You can simple download audio of any video on your system in mp3 format, like following commands.
$ youtube-dl--extract-audio --audio-format mp3 https://youtu.be/McuF7g14hYw -o audio.mp3 [youtube] McuF7g14hYw: Downloading webpage [youtube] McuF7g14hYw: Downloading video info webpage [youtube] McuF7g14hYw: Extracting video information [youtube] McuF7g14hYw: Downloading DASH manifest [youtube] McuF7g14hYw: Downloading DASH manifest [download] Destination: /home/sysadmin/Desktop/audio.mp3 [download] 100% of 4.16MiB in 00:11 [ffmpeg] Correcting container in "audio.mp3" [ffmpeg] Post-process file audio.mp3 exists, skipping
My friend uses this method to download in linux. I use windows and many software are available in windows platform.