Streamlink is a command line streaming utility that allows you to watch online video streams in popular media players, such as VLC, MPlayer, MPlayer2, MPC-HC, mpv, Daum Pot Player, QuickTime, and OMXPlayer etc.
It extracts the videos from various online services and pipes them into a media player of your choice. Streamlink currently supports popular live video streaming services, such as YouTube, Dailymotion, Livestream, Twitch, UStream, and more. Streamlink is built upon a plugin system which allows support for new services to be easily added.
Streamlink is an open source program written using Python programming language. It is forked from LiveStreamer, which is no longer maintained. Streamlink supports GNU/Linux, *BSDs, Microsoft Windows, and Mac OS X.
Install Streamlink in Linux using package manager
Streamlink is available in the default repositories of most Linux distributions.
Arch Linux, EndeavourOS, Manjaro Linux:
$ sudo pacman -S streamlink
$ paru -S streamlink
$ yay -S streamlink
$ echo "deb http://deb.debian.org/debian buster-backports main" | sudo tee "/etc/apt/sources.list.d/streamlink.list"
$ sudo apt update
$ sudo apt -t buster-backports install streamlink
$ sudo dnf install streamlink
$ sudo emerge net-misc/streamlink
Ubuntu, Linux Mint, Pop OS:
$ sudo add-apt-repository ppa:nilarimogard/webupd8 $ sudo apt update $ sudo apt install streamlink
$ nix-env -iA nixos.streamlink
$ sudo zypper install streamlink
$ sudo eopkg install streamlink
$ sudo xbps-install streamlink
Install Streamlink using PIP
Since Streamlink is written using Python, we can easily install it Pip - a python package manager. If your system doesn't have pip, install it as shown below depending upon the distribution you use.
To install PIP on Arch Linux and its derivatives, run:
$ sudo pacman -S python-pip
On RHEL, Fedora, CentOS:
$ sudo yum install epel-release
$ sudo yum install python-pip
$ sudo dnf install epel-release
$ sudo dnf install python-pip
On Debian, Ubuntu, Linux Mint:
$ sudo apt-get install python-pip
Once PIP installed, run the following command to install Streamlink.
$ sudo pip install streamlink
Streamlink is also available in a standalone AppImage format. Download the latest Streamlinkx AppImage from releases page.
$ wget https://github.com/streamlink/streamlink-appimage/releases/download/2.4.0-1/streamlink-2.4.0-1-cp39-cp39-manylinux2014_x86_64.AppImage
Make it executable:
$ chmod +x streamlink-2.4.0-1-cp39-cp39-manylinux2014_x86_64.AppImage
To launch Streamlink, go to the location where you downloaded the AppImage file and run it like below:
Watch online video streams using Streamlink from command line
The typical usage of Streamlink is:
$ streamlink [OPTIONS] <URL> [STREAM]
Here, URL indicates the online video stream URL. It could be any YouTube or Dailymotion video link. STREAM indicates the video quality. You can use “best” or “worst” for highest or lowest quality available. And also, you can specify fallback streams using a comma-separated list as shown below:
If no stream is specified and
--default-stream is not used then a list of available streams will be printed.
Streamlink will play video streams in your default video player i.e VLC in most cases.
$ streamlink https://www.youtube.com/watch?v=o8NPllzkFhE best
Once you run this command, Streamlink extracts online video stream from the specified URL and pipes it into the default or any video player of your choice in highest available quality.
[cli][info] Found matching plugin youtube for URL https://www.youtube.com/watch?v=o8NPllzkFhE [cli][info] Available streams: audio_mp4, audio_webm, 144p (worst), 240p, 360p, 720p (best) [cli][info] Opening stream: 720p (http) [cli][info] Starting player: /usr/bin/vlc
Here is the sample playback output in my Linux desktop.
To play the above video stream in lowest quality, use
"worst" at the end.
$ streamlink https://www.youtube.com/watch?v=o8NPllzkFhE worst
This command will play the online video in lowest available quality i.e 144p.
List available streams
To view the list of available streams, don't specify STREAM value (i.e. best or worst).
$ streamlink https://www.youtube.com/watch?v=o8NPllzkFhE
[cli][info] Found matching plugin youtube for URL https://www.youtube.com/watch?v=o8NPllzkFhE Available streams: audio_mp4, audio_webm, 144p (worst), 240p, 360p, 720p (best)
As you see in the above output, the available streams are audio_mp4, audio_webm, 144p (worst quality), 240p, 260p, and 720p (Best quality).
Play videos in specific quality
To play a video in a specific stream quality, for example 360p, run:
$ streamlink https://www.youtube.com/watch?v=o8NPllzkFhE 360p
Play audio only
If you just want to listen to it, use
"audio_webm" instead of
“best” as shown below.
$ streamlink https://www.youtube.com/watch?v=o8NPllzkFhE audio_mp4
The above command will play only the audio stream in your default player.
Play media with different player
If you want to play the video streams with different video player, you can specify it with
--player option as shown below.
$ streamlink https://www.youtube.com/watch?v=o8NPllzkFhE 720p --player mplayer
This command will play the given video stream in 720p quality using MPlayer.
Watch Twitch TV
Similarly, you can watch twitch.tv and other popular video streaming services.
$ streamlink twitch.tv/sscait best
You can also watch other online streaming services via plugins. A full list of plugins currently included can be found on the Plugins page.
You can also list the plugins using command:
$ streamlink --plugins
For more details, refer the man pages.
$ man streamlink
Please note that Streamlink will not play the video streams if there isn't any media players available on your system. So, just make sure you have installed a media player on your system. Streamlink works well with VLC and mpv.