Installing Livestreamer with ustream support on Ubuntu 14.04
Lots of interesting events are being streamed live on the web these days. Unfortunately, most streaming providers use flash players with annoyingly complicated protocols to distribute the video, which makes it hard to view the stream in your favorite player. Luckily for us, there's Livestreamer. Given a URL, it extracts the video and pipes it to a player of your choice.
Livestreamer is written in Python and can be installed using pip
. To be able to access all of its features, a little additional preparation is needed.
Preparations
In order to access ustream's HD streams, Livestreamer needs python-librtmp, which also is available using pip
. The library needs cffi, so we have to install its dependencies, too. They are python2.7-dev
and libffi-dev
. python-librtmp
needs librtmp-dev
.
sudo apt-get install python2.7-dev libffi-dev librtmp-dev
After installing those development headers, we can install cffi
and python-librtmp
.
sudo pip install cffi
sudo pip install python-librtmp
Once that is done, Livestreamer can be installed.
sudo pip install livestreamer
Configuration
All of Livestreamer's options are available as CLI switches, but setting your preferred player and stream quality in the config file saves you from having to input them every time.
The config resides in ~/.config/livestreamer/config
, a viable minimal config can be found below.
player=mplayer
default-stream=best
player-no-close
With this config, you can start Livestreamer with a URL as the only argument, and it will start playing the stream in the best available quality in mplayer. Of course, Livestreamer offers lots of features not mentioned here, including support for sites requiring the user to login before viewing streams, and several options to tweak the streaming behaviour to fit to your hardware, connection and favorite player.