WWW
22. October 2017

Twitch has recently become much more than just a game streaming site, but the website is very resource intensive and can be difficult to use on slower and older computers. Twitch is unfortunately not directly streamable in third-party players, but there is a workaround involving the Livestreamer tool making streaming with VLC and other players possible. Because the Livestreamer solution for Twitch requires a little bit of setup, I thought I'd write down an easy tutorial. This is primarily for Windows systems, but it should work on all systems Livestreamer and VLC are available for.

Here are the steps you need to set up a browser-independent Twitch viewer:

  • If you're not already using it, get VLC Player from the VideoLan site and install it.
  • Get the Livestreamer package from the download site - for Windows, you can use either the installer or the zip-file.
  • Install Livestreamer either by using the automatic installer or unzip the zip file in a location of your choice. The Installer has the advantage of adding the command to the path so you can run it from any location.
  • Start up Livestreamer once to create the configuration directory by typing livestreamer at the command prompt.
  • Look for the configuration file livestreamerrc - under Windows it's located in the directory
      \users\[user]\appdata\roaming\livestreamer
    - and edit it with Notepad or any other text editor of your choice to add the line
      http-header=Client-ID=jzkbprff40iqj646a697cyrvl0zt2m6
    or alternately
      http-header=Client-ID=ewvlchtxgqq88ru9gmfp1gmyt6h2b93
    to it. Those are is the client tokens for the Twitch web player or Livestreamer, without it the tool won't be able to connect to Twitch. If the file doesn't exist yet, create it and save just this one line into it. You can also put this line into the command itself, but this is more elegant.
  • The necessary command syntax to start a livestream is
      livestreamer twitch.tv/[twitchname] [resolution] --player-external-http --player-external-http-port 8081 --retry-streams 2
    to set up a stream on port 8081 for an external player. [twitchname] is, of course, the name of the account you want to wath and [resolution] can be 160p, 360p, 480p, 720p or 1080p, but note that not all streams offer all resolutions. You can also vary the port, but 8081 is a good choice as any. The --retry-streams command tells Livestreamer to check for a livestream every two seconds if it's not running - this is important if you're waiting for a stream to start, otherwise Livestreamer just quits.
  • When Livestreamer has successfully connected to Twitch, you will get a list of the URLs the local stream is available on. You can then start VLC and select Open Media Stream from the Media menu and put one of the URLs into the address field. If you run VLC on the same computer as Livestreamer, it's most likely http://127.0.0.1:8081, but if you want to play from another device in your local network, it has to be one of the other URLs, which could be, for example, http://192.168.0.1:8081 or similar. The stream is, of course, playable by any other media player capable of accepting web addresses as sources - you can even use the mobile version of VLC to watch on a phone or tablet.
  • The second method is to start VLC directly from the command line, but that only allows you to view the stream on the same computer:
      livestreamer twitch.tv/[twitchname] [resolution] --player "[vlcpath]\vlc.exe" --retry-streams 2
    You need to add the path to your VLC installation to this command.
  • If you want to save yourself some typing, you can create a batch file with a name like livestream.bat in the Livestreamer program directory and add the following line to it:
      @livestreamer %1 %2 --player-external-http --player-external-http-port 8081 --retry-streams 2
    or
      @livestreamer %1 %2 --player "[vlcpath]\vlc.exe" --retry-streams 2
    Then you can run the command livestream twitch.tv/[twitchname] [resolution] to start the stream.

If you don't like to use the command line, you can always put one of the batch files or a shortcut with the commands you want on your Desktop or the Start Menu. This basically allows you to start the stream of your choice with one click, the only drawback is that you have to decide on the resolution when creating the link, since you are not able to change it in the player.

The huge advantage of this method of playing Twitch streams is, of course, that it works on really old computers that are not even able to open up the Twitch website in a browser anymore. I'm playing back Twitch streams myself on a ca. 2003 machine that has an AthlonXP 2400 processor, 1 GB RAM and runs Windows XP, although I have to limit the playback to 480p resolution. The bottleneck is only how well VLC is running on a computer - unfortunately if a stream only offers 1080p, it would be difficult to play on slower computers too.

Livestreamer also has a myriad of other options and streaming capabilities beyond Twitch - unfortunately, it doesn't seem to support Youtube at the moment, but checking out the documentation is worth it.

Kategorie: WWW
Write a Comment