How can I save / download Live Stream Videos from YouTube, Dailymotion, UStream, Twitch, Livestream?. Streamlink is a CLI utility that pipes flash videos from online streaming services to a variety of video players such as VLC, mpv, MPlayer e.t.c. It was designed to convert CPU-heavy flash plugins to a less CPU-intensive format.

Install FFmpgeg

Install FFmpeg on Ubuntu / Debian / Linux Mint:

To install FFmpeg on Ubuntu / Debian / Linux Mint, run:

sudo apt-get -y install ffmpeg

Install FFmpeg on Arch Linux:

Install FFmpeg on Arch Linux by running the command:

sudo pacman -S ffmpeg

Install FFmpeg on Fedora:

For Fedora, use our guide below:

How to Install FFmpeg on Fedora

Install FFmpeg on CentOS:

CentOS 8: Install FFmpeg on CentOS 8

For CentOS 7:

sudo yum -y install epel-release
sudo rpm -v --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
sudo yum install ffmpeg ffmpeg-devel

Installing Streamlink

macOS

$ sudo easy_install -U streamlink
OR
$ brew install streamlink

Arch Linux:

sudo pacman -S streamlink

Ubuntu:

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt update
sudo apt install streamlink

Debian:

wget -qO- "https://bintray.com/user/downloadSubjectPublicKey?username=amurzeau" | sudo apt-key add -
echo "deb https://dl.bintray.com/amurzeau/streamlink-debian stretch-backports main" | sudo tee "/etc/apt/sources.list.d/streamlink.list"
sudo apt update
sudo apt install streamlink

Fedora:

sudo dnf install streamlink

Solus:

sudo eopkg install streamlink

Void:

sudo xbps-install streamlink

Using Streamlink to download Live Stream Videos

The way Streamlink works is that it’s only a means to extract and transport the streams, and the playback is done by an external video player. Streamlink works best with VLC or mpv, which are also cross-platform, but other players may be compatible too.

Watch a Live stream with Streamlink

Let’s say you want to watch the stream located on https://youtu.be/yixlb8qMTmA, you’ll run:

$ streamlink https://youtu.be/yixlb8qMTmA
[cli][info] Found matching plugin youtube for URL https://youtu.be/yixlb8qMTmA
Available streams: 144p (worst), 240p, 360p, 480p, 720p, 1080p (best)

The above command tells Streamlink to attempt to extract streams from the URL specified, if it is successful, it will print out a list of available streams to choose from.

You can choose available stream:

$ streamlink https://youtu.be/yixlb8qMTmA best
cli][info] Found matching plugin youtube for URL https://youtu.be/yixlb8qMTmA
[cli][info] Available streams: 144p (worst), 240p, 360p, 480p, 720p, 1080p (best)
[cli][info] Opening stream: 1080p (hls)
[cli][info] Starting player: /usr/bin/vlc

It will use a default player installed, but you can also specify one, see full list of supported players.

$ streamlink --player=mpv https://youtu.be/yixlb8qMTmA best
[cli][info] Found matching plugin youtube for URL https://youtu.be/yixlb8qMTmA
[cli][info] Available streams: 144p (worst), 240p, 360p, 480p, 720p, 1080p (best)
[cli][info] Opening stream: 1080p (hls)
[cli][info] Starting player: mpv

Download Live Stream using Streamlink

You can as well save the file for offline viewing, see example below.

streamlink --hls-live-restart -o hot-pop.mp4 https://youtu.be/yixlb8qMTmA best

This will save the live stream to file hot-pop.mp4.

See all available options by running the command:

$ streamlink --help

And man page

$ man streamlink

Also visit the Streamlink wiki page to get more information.

Similar guides:

Download YouTube Videos on Linux with Annie

How To Download YouTube Videos on Linux with ytdl-webserver