www-tecmint-com-do...
www-tecmint-com-do...
"
Menu
Ravi Saive Last Updated: December 2, 2023 Read Time: 4 mins Commandline Tools 7 Comments
While the platform offers the convenience of streaming, there are certain scenarios where
you might want to download these videos for offline viewing.
In this article, we will guide you through the process of installing and using yt-dlp to
download YouTube videos on a Linux command line.
What is yt-dlp?
yt-dlp is a Python-based command line and fork of the well-known youtube-dl program
that is created for downloading videos from popular video streaming platforms such as
YouTube, Facebook, Twitter, Reddit, Imgur, Dailymotion, Hotstar, and various other video
sites.
It is developed in Python and requires only Python 3.8+ and it is platform-specific, and
designed to function seamlessly on Unix, Windows, or macOS environments.
It also supports many options, allowing users to customize their downloads based on
preferences. One notable feature is downloading videos in different resolutions, including
high-quality formats like 1080p or 4K.
Additionally, youtube-dl supports downloading entire playlists, extracting only the audio
from videos, bypassing YouTube geo-restrictions, pausing and resuming video downloads,
and splitting videos into multiple files.
yt-dlp is the most widely used command-line tool that is easily available to install from the
default repositories in most Linux distributions, if not all.
To install yt-dlp on Linux, use the following appropriate command for your specific Linux
distribution.
To install the most recent version of yt-dlp, you can use the following curl command.
sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-d
sudo chmod a+rx /usr/local/bin/yt-dlp
If you do not have curl installed, you can alternatively use the following wget command.
Once installed, you can use the following command to update it to the latest version.
yt-dlp -U
To download a YouTube video, use the following command, where <video_url> is the URL of
the YouTube video that you want to download.
yt-dlp <video_url>
For example, to download a YouTube video replace <video_url> with the actual URL of the
YouTube video you intend to download.
yt-dlp https://www.youtube.com/watch?v=60ItHLz5WEA
Download YouTube Video on Linux
You can also download multiple videos at once by specifying a list of URLs separated by
spaces.
To download a YouTube playlist, simply run the following command to download the entire
playlist. Make sure to replace the <playlist_url> of the YouTube playlist URL that you want
to download.
yt-dlp -i --yes-playlist
yt-dlp provides several options for downloading YouTube videos in various formats,
allowing you to tailor the process to your specific needs.
To download a specific format, you first need to list the available format codes for a video
by running.
yt-dlp -F https://www.youtube.com/watch?v=60ItHLz5WEA
List YouTube Video Formats
To download high-quality YouTube video and audio, use the following command.
To download audio only (mp3 format) from a Youtube video, use the following command.
yt-dlp provides the easiest way to download subtitles of videos directly alongside the
video itself.
To list all available subtitles for a specific YouTube video, use the following command, which
will show a list of available subtitles along with their language codes.
yt-dlp -S <video_url>
To download only specific subtitles, you can specify the language code after the -S option.
If you only want to download subtitles without the video, you can use the –write-sub
option with the -S option.
yt-dlp -S --write-sub <video_url>
Conclusion
yt-dlp is a versatile and efficient command-line tool for downloading YouTube videos in the
Linux environment. It comes with a broad range of customization options and supports
various video and audio formats.
By following the steps outlined in this article, you can harness the power of yt-dlp to easily
download and enjoy your favorite YouTube content offline on your Linux system.
Exciting news! Every month, our top blog commenters will have the chance to win
fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and
Awk, each worth $20!
Learn more about the contest and stand a chance to win by sharing your thoughts
below!
PREVIOUS ARTICLE:
NEXT ARTICLE:
How to Fix “Username is not in the sudoers file. This incident will
be reported” in Ubuntu
Ravi Saive
Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts
Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show
your appreciation.
Related Posts
LZ4 for Linux: Install, Use & Speed Up File Compression (Examples)
How to Make ISO from Directory in Linux
Chris
February 14, 2024 at 2:20 pm
I downloaded and tried yt-dlp and encountered a problem. I can’t find the file,
where does it save the Youtube file and how do I choose where to save file?
Reply
Author
Ravi Saive
February 15, 2024 at 10:09 am
@Chris,
When you use yt-dlp to download YouTube videos, it saves the files in the
directory where you run the command by default.
Reply
Chris
February 16, 2024 at 12:32 pm
Reply
Will
December 11, 2023 at 4:24 am
yt-dlp used to work for me, but for the last several months, if I try to download
audio according to this command:
yt-dlp -x --audio-format mp3 https://www.youtube.com/watch?
v=_onagRhKN5E
This is with Debian 12. I’m almost certain it happened the same way with Debian 11.
Reply
Author
Ravi Saive
December 11, 2023 at 9:39 am
@Will,
Reply
Simatwa
December 4, 2023 at 5:20 pm
I am always amazed at learning new things as far as Linux and Linux ecosystems are
concerned. On this, I had yet to learn about its existence.
Reply
Author
Ravi Saive
December 5, 2023 at 11:52 am
@Simatwa,
Thanks for sharing your work, and I’m sure others in the Linux community will find
it valuable as well.
Reply
Got Something to Say? Join the Discussion...
Thank you for taking the time to share your thoughts with us. We appreciate your
decision to leave a comment and value your contribution to the discussion. It's
important to note that we moderate all comments in accordance with our comment
policy to ensure a respectful and constructive conversation.
Rest assured that your email address will remain private and will not be published or
shared with anyone. We prioritize the privacy and security of our users.
Name *
Email *
Save my name, email, and website in this browser for the next time I comment.
Post Comment
Search...
Do You Enjoy My Blog?
Support from readers like YOU keeps this blog running. Buying me a cup of coffee is a
simple and affordable way to show your appreciation and help keep the posts coming!
Buy Me a Coffee
VnStat PHP: A Web Based Interface for Monitoring Network Bandwidth Usage
bmon – A Powerful Network Bandwidth Monitoring and Debugging Tool for Linux
Set Date and Time for Each Command You Execute in Bash History
Tecmint: Linux Howtos, Tutorials & Guides © 2024. All Rights Reserved.
The material in this site cannot be republished either online or offline, without our permission.
Hosting Sponsored by : Linode Cloud Hosting