
Youtube-dl is a pretty much goto solution for many users to download content from youtube, whether they want to backup their youtube channel content or want to download music youtube-dl covers all. Following are some widely used youtube-dl commands.
Get youtube link information without downloading it
The following command will get video link information (for example video title or duration) in JSON format without downloading the whole video.
youtube-dl -f 22/18/mp4/bestvideo -s -q --skip-download --dump-json --no-call-home youtubelink
Download video in mp4 with youtube-dl
youtube-dl -f mp4/best --recode-video mp4 --no-mtime --ffmpeg-location "ffmpeg/path/" -o "/file/output.%(ext)s" -i "https://www.youtube.com/watch?v=IGQBtbKSVhY"
Download video in mkv with youtube-dl
youtube-dl -f bestvideo+bestaudio/best/mp4 --no-mtime --merge-output-format mkv --ffmpeg-location "ffmpeg/path/" -o "/file/output.%(ext)s" -i "https://www.youtube.com/watch?v=IGQBtbKSVhY"
Download video in mp3 audio format with youtube-dl
youtube-dl -x --audio-format mp3 --no-mtime --ffmpeg-location "ffmpeg/path/" -o "/file/output.%(ext)s" -i "https://www.youtube.com/watch?v=IGQBtbKSVhY"
Download video in aac audio format with youtube-dl
youtube-dl -x --audio-format aac --no-mtime --ffmpeg-location "ffmpeg/path/" -o "/file/output.%(ext)s" -i "https://www.youtube.com/watch?v=IGQBtbKSVhY"
Using proxy with youtube-dl
youtube-dl --proxy "socks5://127.0.0.1:1080" "https://www.youtube.com/watch?v=IGQBtbKSVhY"
Get all videos links in youtube playlist – output in json format
youtube-dl --flat-playlist --dump-single-json "https://www.youtube.com/playlist?list=PLVuQBUGB87-gomoG36CV4wMZCkGPGKw3p"
Download private videos with a cookie file
For this you need a cookie text file, you can get that using an extension.
youtube-dl --cookies="/path/to/cookie-file.txt" "https://www.youtube.com/watch?v=IGQBtbKSVhY"
Download private video with account
youtube-dl --username "myname" --password "yourpassword" "https://www.youtube.com/watch?v=IGQBtbKSVhY"
If you have something to contribute or any question,please use comment box below.