yt dlp Linux: Install and Use yt-dlp

yt dlp Linux: Install and Use yt-dlp

Choosing a format is part of downloading media from a supported website on Linux. yt-dlp is a command-line program that retrieves media and lets you inspect and select formats exposed by the site.

I’ll show how to install yt-dlp and choose an available format.

TL;DR: Install and use yt-dlp on Linux

Install yt-dlp using the official standalone release or an isolated Python app manager, then pass it a video URL. FFmpeg adds stream merging and post-processing support.

  • For a user-level Python app, install pipx with your distribution package manager, then run pipx install yt-dlp.
  • Check the command with yt-dlp --version.
  • Download one item with yt-dlp ‘VIDEO_URL’. Use -F to inspect available formats.

What is yt-dlp?

yt-dlp is a command-line program that retrieves media from supported websites, including YouTube, and is maintained as a fork of youtube-dl. A fork is a project developed from another project’s codebase, with its own changes and releases.

The program examines formats that a site exposes and selects among them. You can also request subtitles, audio extraction, or a playlist, but each option changes the files and dependencies involved.

Linux users can install it from a distribution package, an official project binary, or a Python application environment such as pipx. Distribution packages fit system maintenance, while pipx keeps a Python command-line app in its own environment. The official project installation page lists supported options.

Only download material you have permission to save, and follow the applicable copyright law and service terms.

How to install and use yt-dlp on Linux step by step

A reliable first pass is to install one current copy, confirm that your shell can find it, and try a single video URL before adding format or playlist options.

Step 1: Choose an installation method

Use your distribution’s package manager if you prefer updates and dependencies handled as part of the operating system. Package freshness differs by distribution, so check its package documentation when you need current yt-dlp features.

For an isolated Python application, install pipx using your distribution’s documented package command, then install yt-dlp as your regular user:

pipx install yt-dlp

pipx creates an application environment and exposes its command through your user path. If pipx is not installed yet, follow its official installation guide for your distribution rather than installing Python packages into the system interpreter.

The official standalone binary is another option when you do not want a Python environment. Its installation guide shows how to place it on PATH and mark it executable.

Installing under a system directory requires administrator permission. A user-owned directory such as ~/.local/bin avoids that when it is on PATH.

Step 2: Confirm the command is available

Open a new terminal after changing PATH settings, then check the version:

yt-dlp --version

If the shell says the command cannot be found, check whether pipx’s application directory or the binary install directory is included in PATH. Shell startup files differ. Follow the instructions for your shell instead of copying a Bash-only change into Fish.

I checked the available yt-dlp command in this environment and its Python import stopped with a CFFI version-mismatch exception before it could report a version. That means the command being present in PATH does not prove that its runtime dependencies load correctly. A clean, isolated installation avoids mixing this app’s Python dependencies with unrelated user-level packages.

Step 3: Install FFmpeg when your task needs it

Install FFmpeg through your Linux distribution when your task needs merging separate audio and video streams or post-processing. The documented Debian or Ubuntu package command is sudo apt install ffmpeg.

This command needs administrator permission. Do not run it on a production host without authorization. The package name is commonly ffmpeg, but use the exact package name and repository instructions for your distribution.

Run ffmpeg -version to check the executable. My check printed: ffmpeg version 6.1.1-3ubuntu5 Copyright (c) 2000-2023 the FFmpeg developers.

Terminal showing FFmpeg version verification
The terminal shows ffmpeg -version and its version details.

The LinuxForDevices guide to extracting audio with FFmpeg explains the companion tool’s role. Start with the default download workflow.

Step 4: Download one video

Pass the video’s URL as the final argument. Quote the URL so the shell does not interpret its punctuation:

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

Replace VIDEO_ID with the identifier from a video you are authorized to download. By default, yt-dlp writes the resulting file in the current directory. Run the command from the folder where you want the file, or specify an output path with the documented output options.

For a YouTube link to a playlist, decide whether you intend to download the playlist or only the linked video. Use yt-dlp’s single-video option when the URL includes playlist context and you want just the linked video. Review the URL and options before confirming a batch.

Step 5: Inspect and select a format

List formats before choosing a specific resolution. The -F option reports what the extractor can see for that URL:

yt-dlp -F 'https://www.youtube.com/watch?v=VIDEO_ID'

Format IDs and available resolutions vary by video. A format may contain video only, audio only, or both. The fallback selector can choose a combined stream when separate streams are unsuitable.

To request the best video at or below 1080 pixels high plus the best audio, use a selector such as bv*[height<=1080]+ba/b. The slash provides a fallback to a combined format if separate streams cannot be selected. Put the selector in quotes so the shell does not treat its symbols as redirection.

yt-dlp -f 'bv*[height<=1080]+ba/b' 'https://www.youtube.com/watch?v=VIDEO_ID'

A height limit sets a ceiling. The source may offer a lower resolution or no matching stream. For a device with limited storage, compare the listed formats and file sizes before selecting a high-bitrate stream.

Step 6: Save audio or subtitles when needed

Audio extraction uses the -x option. FFmpeg handles the post-processing step. Add an audio format only when you need a particular converted output:

yt-dlp -x --audio-format mp3 'https://www.youtube.com/watch?v=VIDEO_ID'

Conversion can take extra time and may lose quality when the source audio is encoded again. If you only need the available audio stream, prefer an option that preserves its existing format instead of converting without a reason.

For subtitles, first inspect the languages available for the video, then request the language code you need. yt-dlp distinguishes uploaded subtitles from automatically generated captions, so choose the matching option rather than assuming every language has both.

yt-dlp --list-subs 'https://www.youtube.com/watch?v=VIDEO_ID'
yt-dlp --write-sub --sub-lang en 'https://www.youtube.com/watch?v=VIDEO_ID'

The first command lists available subtitles. The second requests English subtitles when available. Add the auto-subtitle option when you want generated captions and the source offers them.

For a repeatable filename or destination, use yt-dlp’s output template options. Templates can include metadata fields such as title, but titles may contain characters your filesystem handles differently. Keep a sensible output directory and inspect the final filename before scripting around it.

Common yt-dlp errors and choices

Setup problems commonly come from an unavailable executable, a missing external dependency, or a URL whose formats differ from the requested selector. Diagnose the layer named by the message before changing the command.

SymptomLikely causeWhat to check
yt-dlp: command not foundInstall directory is absent from PATHOpen a new shell and inspect the shell-specific PATH setup
Python import or dependency exceptionMixed Python environments or a damaged app installUse the install method’s own upgrade or reinstall command
Warning that FFmpeg is missingFFmpeg is absent or not discoverableCheck ffmpeg -version and executable PATH
Requested format is unavailableThe source does not offer that exact height or codecRun -F and choose a listed option or fallback
HTTP 403 or extractor failureRemote site, version, network, or access conditions varyUpdate yt-dlp through its install method and consult current project guidance

If yt-dlp reports that FFmpeg is missing even though it is installed, verify that the executable is on PATH for the same shell that runs yt-dlp. A package can exist on disk without being discoverable under the command name yt-dlp uses.

For HTTP 403 errors, do not assume a single local flag will fix every case. The yt-dlp project issue guidance notes that outdated versions, proxies and network addresses can affect access.

Update using the method that installed the program, then consult current project troubleshooting guidance. Keep cookies and credentials private.

Keep configuration in the user config location supported by the installed version, and use one option per line as documented. A config file applies to later commands, which can surprise you when a saved option conflicts with a one-off test. Use --ignore-config for a diagnostic run when the official usage documentation confirms that option for your version.

To update, use pipx’s upgrade command for a pipx installation, your distribution package manager for a repository package, or the official instructions for a standalone binary. Mixing installation methods can leave multiple copies in PATH, so check which executable your shell resolves before troubleshooting versions.

Downloading is also constrained by the source site’s terms and your rights to the material. yt-dlp does not grant permission to copy a video or bypass a site’s access controls.

Conclusion

Install one maintained yt-dlp copy, check that its command runs, and start with a single URL. Add FFmpeg when you need merging or post-processing, and inspect available formats instead of assuming a resolution exists.

For details, see the official installation guide, the yt-dlp project documentation, and the LinuxForDevices guides to FFmpeg audio extraction and Bash startup files.

FAQ

These answers cover common setup and usage questions for Linux.

How do I install yt-dlp on Linux?

Use your distribution package manager, the official release binary, or pipx for an isolated Python application install. Follow the chosen method’s PATH instructions, then check with yt-dlp --version.

Do I need FFmpeg to use yt-dlp?

Not for every basic download. FFmpeg is needed for merging separate audio and video streams and for many conversion or post-processing tasks.

How do I download only one video from a playlist link?

Add –no-playlist to the command when the URL includes playlist context and you want only the linked video.

How do I choose a 1080p format?

Run yt-dlp -F to inspect formats, then use a selector with a height ceiling such as bv*[height<=1080]+ba/b. The result depends on formats offered for that video.