How to download a Facebook video on Linux using yt-dlp

613

Downloading Facebook videos on your browser without a tool can be difficult. But with yt-dlp, a powerful command line tool for downloading multimedia files, you can save a Facebook video to MP4 within a few steps. This tutorial will guide you to download a Facebook video on Linux using yt-dlp.

Installing FFmpeg

First of all, you’ll need to install FFmpeg because it’s a dependency for yt-dlp to merge video and audio files. This step may not be needed for downloading Facebook videos, but it’s highly recommended to have it installed.

sudo apt-get update
sudo apt-get install ffmpeg

Installing yt-dlp

Download the executable binary yt-dlp file for Linux from the official GitHub repository.

wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp

Move the binary file to /usr/local/bin so that it can be run system wide, and make it executable just in case.

sudo mv yt-dlp /usr/local/bin
sudo chmod +x /usr/local/bin/yt-dlp

Downloading a Facebook video using yt-dlp

Copy the Facebook video URL you would like to download either from the address bar or using the Copy link option under the three dots menu. And list all the available formats using the -F flag. The result table will be displayed shortly.

yt-dlp -F https://fb.watch/gI4uy8v5QM/
yt-dlp listing all the available formats for a Facebook video

We’ll download the hd version because it’s in MP4 and is supported by most media players. Note the lowercase -f flag in the command line. Wait for the program to finish downloading. The MP4 video will be saved in your current working directory.

yt-dlp -f hd https://fb.watch/gI4uy8v5QM/

Self-updating yt-dlp

You can easily self-update the binary yt-dlp file located at /usr/local/bin without redownloading it manually using the following command. It will self-update to the latest version accordingly.

sudo yt-dlp -U