How to install yt-dlp on Ubuntu

yt-dlp is a powerful command-line tool used to download videos and audio from YouTube and other websites. It is a fork of youtube-dl with many additional features and improved performance.

1. Installing yt-dlp

For Ubuntu/Debian-based systems, you can install it via:

sudo apt install yt-dlp

Or manually using pip:

pip install yt-dlp

2. Basic Usage

To download a video from a URL:

yt-dlp <URL>

Example:

yt-dlp https://www.youtube.com/watch?v=dQw4w9WgXcQ

3. Download Audio Only

To download only the audio (e.g., as an MP3 file):

yt-dlp -x --audio-format mp3 <URL>

4. Download a Playlist

If you want to download an entire playlist:

yt-dlp -i <playlist-URL>

5. Download in Highest Quality

To ensure you get the highest video quality available:

yt-dlp -f best <URL>

6. Download with Custom Filename

You can customize the output filename using the -o flag:

yt-dlp -o "%(title)s.%(ext)s" <URL>

7. Resume Interrupted Downloads

If your download was interrupted, you can resume it:

yt-dlp -c <URL>

8. List Available Formats

To see all available video and audio formats:

yt-dlp -F <URL>

Output example:

cssCopy codeID  EXT   RESOLUTION
140 m4a   audio only
160 mp4   144p
18  mp4   360p
22  mp4   720p

You can then choose a specific format using its ID:

yt-dlp -f 22 <URL>

9. Download Subtitles

To download subtitles (if available):

yt-dlp --write-subs --sub-lang en <URL>

10. Update yt-dlp

Keep yt-dlp updated for the latest features and bug fixes:

yt-dlp -U

Leave a Reply

Your email address will not be published. Required fields are marked *