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 is written using Python programming language, and was forked from LiveStreamer, which is no longer maintained. Streamlink currently supports popular live video streaming services, such as YouTube, Dailymotion, Livestream, Twitch, UStream, and many more. Streamlink is built upon a plugin system which allows support for new services to be easily added. A full list of plugins currently included can be found on the Plugins page. Streamlink supports GNU/Linux, *BSDs, Microsoft Windows, and Mac OS X.
Streamlink - A Command line Utility To Watch Online Video Streams
Install Streamlink using package manager
Streamlink is available in the default repositories of most Linux distributions.
In Arch Linux and derivatives:
$ sudo pacman -S streamlink
Also, you can install it from AUR using AUR helpers such as Yay.
$ yay -S streamlink
$ sudo dnf install streamlink
On Ubuntu, Linux Mint:
$ sudo add-apt-repository ppa:nilarimogard/webupd8 $ sudo apt update $ sudo apt 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
Watch online video streams from command line using Streamlink
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.
To view the list of available streams, don't specify STREAM value (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).
To play a video in a specific stream quality, for example 360p, run:
$ streamlink https://www.youtube.com/watch?v=o8NPllzkFhE 360p
If you just want to listen to it, use “audio_mp4” or "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.
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.
Similarly, you can watch twitch.tv and other popular video streaming services.
$ streamlink twitch.tv/sscait best
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.