Social Media > YouTube 172 172 people found this article helpful How to Download YouTube Videos on Linux Save YouTube videos to your computer to watch them offline By Gary Newell Gary Newell Writer Famborough College of Technology Gary Newell was a freelance contributor, application developer, and software tester with 20+ years in IT, working on Linux, UNIX, and Windows. lifewire's editorial guidelines Updated on December 2, 2020 Reviewed by Jerrick Leger Reviewed by Jerrick Leger Jerrick Leger is a CompTIA-certified IT Specialist with more than 10 years' experience in technical support and IT fields. He is also a systems administrator for an IT firm in Texas serving small businesses. lifewire's editorial guidelines Tweet Share Email Tweet Share Email In This Article Expand Jump to a Section Install and Use YouTube-dl Install the Graphical Front End Download With the Front End Download from Command Line Since there's been a YouTube, people have wanted to download videos to save for later or to play offline and on the go. For copyright reasons, YouTube doesn't make downloads available. However, there's a youtube-dl tool to download videos for free on Linux, as well as Windows and Mac. There are a couple of ways to use youtube-dl on Linux. A straightforward way is to use the youtube-dl script from the command line. If you prefer a graphical option, there's a front end for youtube-dl that provides a wide set of controls and options. Install YouTube-dl Whether you want to download YouTube videos with a graphical application or the command line, you'll need youtube-dl. Youtube-dl is a Python script that grabs a YouTube video from the web and converts it into various formats, including audio-only formats. For Linux users, getting youtube-dl is usually straightforward. The script is open-source, and you can find it in most distribution repositories. Follow the instructions for your Linux distribution. You'll also need FFMPEG to allow youtube-dl to convert the downloaded videos between formats and to control video and audio quality. You can install FFMPEG along with youtube-dl. Ubuntu and Linux Mint For Ubuntu and Linux Mint, youtube-dl tends to fall behind in the Ubuntu ecosystem. Usually, that wouldn't be a huge deal, but youtube-dl must stay current to stay ahead of YouTube updates that prevent it from functioning. So, if you use Ubuntu or Mint, install the Python Pip package manager to get the latest releases. Open a terminal. Enter the following command to install Pip and FFMPEG: sudo apt install python3-pip ffmpeg Install youtube-dl using the Pip Python package manager: sudo pip3 install youtube-dl When the install is complete, you can use youtube-dl from the command line. To update youtube-dl in the future, run the following command: sudo pip3 install --upgrade youtube-dl Debian The Debian multimedia repository contains a library of up-to-date packages for various multimedia apps, youtube-dl included. You'll need to add the repository if you haven't already. Then, install youtube-dl normally with Apt. Open a terminal. Enter the following command to add the repository to your computer: sudo echo "deb http://www.deb-multimedia.org buster main non-free" > /etc/apt/sources.list.d/multimedia.list Substitute testing or sid if you're running one of those instead of stable. Update the Apt repositories to pull in the new one: sudo apt update -oAcquire::AllowInsecureRepositories=true This command allows for insecure repositories since you haven't installed the signing key for the multimedia repository yet. Install the signing keys for the repository: sudo apt install deb-multimedia-keyring Install youtube-dl and FFMPEG: sudo apt install youtube-dl ffmpeg You'll automatically get the updated one from the multimedia repository. Fedora Fedora keeps updated versions of youtube-dl in their repositories, but you won't find FFMPEG there. For that, you'll need the RPM Fusion repository. If you use Fedora on the desktop, RPM Fusion is invaluable. If you don't have it, add it to your system and install both packages. Open a terminal. Run the following command to add the RPM Fusion repository with DNF: sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm Install youtube-dl and FFMPEG: sudo dnf install youtube-dl ffmpeg Arch Linux and Manjaro Arch Linux, and by extension Manjaro, has updated versions of youtube-dl and FFMPEG in its default repositories. Install it with Pacman: pacman -S youtube-dl ffmpeg Install the Front End This next step is optional. If you prefer to work in the command line, go to that part. Otherwise, follow the steps to install the graphical front end for youtube-dl. The path to install it is slightly different for every distribution. Follow the instructions for yours. Ubuntu, Mint, and Debian The developers of the graphical front end, Tartube, made their own packages for Ubuntu and Debian-based distributions. You can get the packages from their Sourceforge page. Open a browser, then go to the Tartube Sourceforge download page. Select Download Latest Version (the big green box) to download the latest release. Save the resulting package to your Downloads folder. Open a terminal and change the directory to the Downloads folder. Look at the name of the downloaded package, and install it with Apt. Or, use this command: sudo apt install ./python3-tartube_*.deb Fedora Like with Ubuntu and Debian, the Tartube developers packaged their software for Fedora and made it available on their Sourceforge page. Open a browser, then go to the Tartube Sourceforge download page. Select the latest version of Tartube from the list. Find the latest RPM package from the list. Avoid the package with STRICT in the name. Save the resulting package to your Downloads directory. Open a terminal and change to the Downloads directory. Install Tartube: sudo dnf install tartube-*.rpm Arch Linux and Manjaro Tartube is available in the AUR, so there are plenty of ways to get it. Choose the AUR install method you're comfortable with. If you're not familiar with the AUR, the following is the default method for installing AUR packages. Install the base-devel and git packages: sudo pacman -s base-devel git Change into a directory where you want to download the package and clone it with Git: cd ~/Downloadsgit clone https://aur.archlinux.org/tartube.git Change directories to the tartube directory: cd tartube Build and install the package with makepkg: makepkg -si Download a Video With the Front End Now that Tartube is installed, you're ready to download videos from YouTube. Launch Tartube. You can find it listed under Multimedia in most application menus. On GNOME, you can search for it. Select Edit at the top of the window, then choose System preferences from the drop-down menu. In the System preferences window, select youtube-dl from the top menu. Select the Path to youtube-dl executable drop-down menu and choose Use local path (youtube-dl). Select OK to close the preferences window. With Tartube open, select Videos in the upper-left corner of the window. Go to YouTube and copy the URLs of the videos you want to download. Then, paste the URL in the text box located in the middle of the Add videos dialog box. When you have the videos you want, Select OK. The main Tartube window appears, and your videos are queued up. Select Download all in the lower-left corner of the window to start the download. Your videos are available through Tartube. Select Player. You can also find your video files in the tartube-data directory. Download and Convert a Video From the Command Line If you're a fan of the command line, prefer a direct approach, or don't want to be bothered with another piece of software, use youtube-dl by opening a terminal and passing it a YouTube URL. Change directories to the folder where you want to download the videos. For example: cd ~/Downloads To download a video with no conversion, pass the URL to youtube-dl without any additional information: youtube-dl https://youtube.com/watch?v=sPecIfIcCoDE That gets you a playable video in the current directory. If you want to specify the output video format, add the -F flag to list the available formats: youtube-dl -F https://youtube.com/watch?v=sPecIfIcCoDE You'll see a list of available formats and resolutions. Choose the one you want, and use the number to the left in the table to specify it with the -f flag: youtube-dl -f 137 https://youtube.com/watch?v=sPecIfIcCoDE To tell youtube-dl to grab the best quality video, use the -f flag: youtube-dl -f best https://youtube.com/watch?v=sPecIfIcCoDE To extract audio from a YouTube video, use the -x flag combined with --audio-format and --audio-quality: youtube-dl -x --audo-format flac --audio-quality 0 best https://youtube.com/watch?v=sPecIfIcCoDE The --audio-format flag supports all major formats, including MP3, Vorbis, M4A, AAC, WAV, and FLAC. The --audio-quality flag uses a scale from 0 to 9, with 0 providing the best quality. Was this page helpful? Thanks for letting us know! Get the Latest Tech News Delivered Every Day Subscribe Tell us why! Other Not enough details Hard to understand Submit