Admins eHow SysAdmin Tips & Tricks

October 20, 2014

How to watch Twitch streams without lag or stutter in Source quality

Filed under: General — Tags: , , , , — admin @ 1:16 am

As a gamer, I am also a fan of watching other people playing games on Twitch. I mostly watch pro players playing Dota 2.
If you have ever tried watching Twitch, you would know how much it matters to be able to watch the streams in Source quality. Good streamers usually stream in Full HD (1920×1080 30 FPS or 60 FPS) which may require a consistent 4-6 mps of bandwidth. well you may think 4-6 mps is not much, your broadband connection supports multiple times of this number but in the reality is not that simple and you may get lag and stutter while watching in Source quality.
The reason behind this is the complexity of Internet. Twitch stream may not be routed to you through an optimal route, Also many broadband ISPs play all kind shenanigans with users traffic in order to save bandwidth and make more money.
Unfortunately for me thats the case. Normally I am not able to watch Twitch streams in Source quality and I hate anything less than Full HD.
But being a system administrator has its own privileges and I have found two ways to be able to watch Twitch streams in Source quality which I am going to share with you :

  1. Use a VPN or Proxy : Using a good VPN or Proxy may actually improve your Internet speed. The reason is that your ISP may not have the best routes to all other networks but may have good routes to few other networks, now if you can get a VPN or Proxy on one of those good networks, it causes all of your traffic to be routed through those good routes and it improves your Internet speed. Also using a VPN or Proxy will save you from shenanigans of your ISP because it is usually encrypted and they can not tamper with it.
    But there is a trick, using any VPN or Proxy will not help you and may even degrade your Internet speeds. You should use a VPN or Proxy which has a good route to you and its quality is decent so forget about free ones. What I recommend to you is to get a service from a reputable VPN provider – like StrongVPN – they provide many VPN servers in diffenet locations which enables you to find the one which works for you by trial and error. you can also speed test their servers and find out which one has the best route to you.
    Another advantage of using a VPN or Proxy is that you can use it in your mobile device. Sometimes I like to watch streams lying in bed on my tablet and without a VPN, I am not able to watch in source quality.
  2. Use Livestreamer : I found this solution just last night when even my beloved Proxy servers could not help me. Livestreamer is a software which allows you to watch online streams in external media players like VLC. it has many features like saving the stream and etc which I am not going to explain here and you can read the documentation if you are interested : http://livestreamer.readthedocs.org/en/latest/cli.html
    First thing which you need to do is to download and install Livestreamer from this link : http://livestreamer.readthedocs.org/en/latest/install.html
    Also if you dont already have VLC installed on your PC, go ahead and download and install it : http://www.videolan.org/
    Now we need to configure Livestreamer, find Livestreamer configuration file and open it in a text editor. It is located under “%APPDATA%\livestreamer\livestreamerrc” in Windows and under “~/.livestreamerrc” for MACOSX and Linux.
    First uncomment the appropriate player line in configuration file. For me it is :

    player="C:\Program Files\VideoLAN\VLC\vlc.exe" --file-caching=5000

    It specifies the location of vlc.exe so Livestreamer can launch it.
    Now scroll to the end of file and enable these two options with following values :

    hls-segment-threads=10
    hds-segment-threads=10

    These two lines will do the trick for us in order to be able to watch stream without stutter. The reason is that in HLS (Twitch Streaming Protocol) and HDS, unlike other streaming protocols which stream is sent in one continuous stream, it is sliced and chunked in several pieces and sent over HTTP protocol. So it is possible to download these chunks simultaneously with multiple connections exactly like how download managers work.
    Save the config file and our setup is complete. We can use it now to watch Twitch stream in source quality in VLC by following command :

    Livestreamer.exe LINK_TO_TWITCH_STREAM best

    For example :

    Livestreamer.exe http://www.twitch.tv/sing_sing best

    It takes about 15 seconds for Livestreamer to establish connections and launch VLC.

Update : I have written a small utility to comfortably launch livestreamer on Windows. It needs .Net framework 4.5 to work.
You can download it here : LiveStream Launcher

Powered by WordPress