How to Watch/Record MLG streams using Livestreamer


Major League Gaming is an online broadcast network that regularly hosts professional gaming tournaments. While is still considered the largest streaming network for gamers, MLG has many popular streamers and professional gamers who only broadcast on their network. Many huge tournaments from major gaming titles such as Call of Duty and Counter-Strike: Global Offensive are streamed exclusively on MLG.

Similar to most streaming services, you may experience lag while watching live streams. The solution to this problem is to use a useful utility called livestreamer. This command-line tool helps alleviate a lot of lag you may experience while watching streams. It requires less resources and bandwidth than watching live streams on

Livestreamer has many powerful options. It can be used to watch streams directly with your personal media player. Livestreamer supports most streaming protocols that are used today. It can access streaming protocols directly instead of relying on plugins to extract streams from URLs. In addition, livestreamer can download and record live streams or videos. All these powerful options can be further enhanced by combining livestreamer with scripts.

Scripts can help automate the entire process and limit the amount of user input needed. You can find direct links automatically and remove the need to manually search for stream links. An entirely automated script can search for streams, determine whether streams are online or offline, and download live streams directly to your computer. This is all made possible by utilizing livestreamer’s impressive tool and plugin system.

Related articles: 


  1. Python 3.4
  2. Livestreamer
  3. VLC Media Player (Optional)

What is Livestreamer and why use it?

Livestreamer is a command-line utility that allows you to pipe video streams directly into your personal media player. Livestreamer is a cross platform utility and works with Windows, Mac, and Linux systems. Livestreamer works best with VLC Media Player, which is also cross platform, but many other players are compatible too.

Livestreamer is a useful utility for many people. If you noticed lag or stream stuttering while watching streams on, then consider using livestreamer. It helps alleviate lag and will provide a smoother experience. An additional benefit is livestreamer’s ability to bypass advertisements.

Avoid Lag and Stream Stuttering

Perhaps the main reason to use livestreamer is to avoid lag and stream stuttering. The cause of stream stuttering or video lag can be caused by any number of issues. It could be due to a slow internet connection, your personal computer lagging, or your connection to the streaming server is slow.

Using livestreamer will solve most of these problems. Livestreamer does not use any web plugins such as Java or Adobe Flash Player, instead it connects directly to the stream source. This minimizes the amount of stress on your computer, which allows your computer to run smoother. Livestreamer can be configured to transmit lower quality streams to ensure you don’t exceed your internet bandwidth. You can find the most appropriate speed to match your household’s internet usage and provide the best internet experience.

Bypass Advertisements

The wonderful thing about livestreamer is its ability to bypass advertisements. Although it wasn’t meant to circumvent advertisements, it does have the ability to do so. It prevents advertisements from being displayed on livestreams because it transmits only the stream source to your media player. However, advertisements that are displayed by the streamer during live broadcasts will still be shown.

How to watch MLG streams with livestreamer

Once everything is installed correctly, using livestreamer is really easy. All it takes is a few simple steps.

  1. On Windows, open the run dialog by pressing “Windows Key + R” or open Command Prompt.
  2. On Mac OS X, open the terminal by pressing ⌘ + Space, type “Terminal” and then hit “Enter”. 
  3. For Linux users, open the terminal (the shortcut or hotkey may differ between linux distros).

The command to run livestreamer is the same for all three operating systems. Type the following command and livestreamer should run smoothly.

livestreamer best

Change the stream name and/or parameter to the stream and quality you want. If you have a slow internet connection, you may want to lower the quality.

livestreamer high
livestreamer medium
livestreamer low
livestreamer mobile

I recommend watching at the highest quality for the best experience, but if you encounter any lag then adjust accordingly.

How to find MLG stream source (HDS)

In some situations, the MLG plugin for livestreamer may not work. It can be due to an outdated plugin or livestreamer is unable to find a direct link to If the plugin no longer works and it displays “No streams found on this URL” even if the stream is online, then you will have to manually provide a direct link for livestreamer.

Livestreamer supports the following streaming protocols. In our case, we want to use the Adobe HTTP Dynamic Streaming (HDS) protocol. The Apple HTTP Live Streaming (HLS) protocol also works, but we will use HDS. Here is a full list of streaming protocols that livestreamer supports.

Supported streaming protocols

Name Prefix
Adobe HTTP Dynamic Streaming hds://
Akamai HD Adaptive Streaming akamaihd://
Apple HTTP Live Streaming hls:// hlsvariant://
Real Time Messaging Protocol rtmp:// rtmpe:// rtmps:// rtmpt:// rtmpte://
Progressive HTTP, HTTPS, etc httpstream://

Method One: 

Finding the direct link is quite tricky, but here is an easy way to find it. First, you have to be able to recognize the MLG URL. It looks something like this:

Go to the link below and change “STREAM_NAME” to the stream name you want.
  1. There will be two URLs. You want the HDS URL that ends with manifest.f4m
  2. Copy the URL and Replace http:// with hds://

Instead of using the standard MLG URL, run livestreamer with the newly acquired link.

livestreamer hds:// best

Modify the HDS URL and quality, then run the command. Livestreamer should find the stream and start as it normally would.

Method Two:

This method requires finding the direct link for by using your browsers developer tools. Whether you are on Mozilla Firefox or Google Chrome, you can access your developer’s tool by pressing F12.

  1. Go to and find the channel you want to watch with livestreamer
  2. Press F12 and click on the Network Tab 
  3. Within the tab, click on Filter
  4. Search for Manifest.f4m
  5. Right click and Copy the URL

You should end up with a URL that looks similar to the one above. Now you have to modify the URL and make it readable for livestreamer.

6. Replace http:// with hds://
7. Delete everything after manifest.f4m

The new URL should look something like this:


Now that the link is all cleaned up, you can run livestreamer.

livestreamer hds:// best

Modify the link and stream quality accordingly. Livestreamer should find the stream source and launch as it normally would.

How to find MLG stream source (HDS) automatically

If you don’t want to go through all the trouble of manually finding the HDS link, there is an automated way to find it. This short python script only requires a channel name and will provide you with a direct HDS link.

Copy the script and name it FindHDS with .py as the file extension.

from urllib.request import urlopen
from urllib.error import URLError
import json

def parseData(user):
    url_all = ',stream_name'
    dataset = json.loads(urlopen(url_all, timeout = 15).read().decode('utf-8'))

    counter = 0
    while (counter < len(dataset['data']['items'])-1):
        counter = counter + 1
        slug = dataset['data']['items'][counter]['slug']
        stream_id = dataset['data']['items'][counter]['stream_name']

        if (slug == user or stream_id == user):
            stream_name = stream_id
            return stream_name
    return False

def main():
    user = input("Enter Stream Name: ")

    if (parseData(user) == False):
        print("Stream is either offline or does not exist.")
        stream_name = parseData(user)
        url = "" % stream_name
        info = json.loads(urlopen(url, timeout = 15).read().decode('utf-8'))
        hdsurl = "hds://" + info['data']['items'][1]['url']
    exitkey = input('Press any key to exit...')

if __name__ == "__main__":
    # execute only if run as a script

The link is automatically cleaned up and correctly formatted. Now run livestreamer as you normally would.

livestreamer hds:// best

How to Record/Capture MLG streams with VLC Player

  1. Launch VLC Media Player through livestreamer
  2. Click on the View Tab and select Advanced Controls
  3. Now advanced controls should pop up at the bottom of the player
  4. Clicking the red button will record videos
Recording with VLC
Enable Record Button

After enabling advanced controls a red button located at the bottom left should pop-up.

VLC Record Button
Recording Button

It’s simple, click the button and the recording will start, click it again and it will stop.

Changing Recording Directory

You may want to change the recording directory. Here is how to do it.

  1. Go to Tools -> Preferences -> Input / Codecs
  2. Under Files -> “Record directory or filename
  3. Click Browse and change directories

How to Download MLG streams with Livestreamer

Livestreamer has a built-in parameter to download livestreams. Run livestreamer as you normally would by opening the Run Dialog. Add the download parameter and specify the download location.

  1. On Windows: Press “Windows Key + R” to open the Run Dialog.
  2. On Mac OS X: Press ⌘ + Space, type “Terminal” and then hit “Enter”. 
  3. On Linux: open the terminal (the shortcut or hotkey may differ between linux distros).

Next, type in the following command to begin downloading with livestreamer.

livestreamer "MLG URL" best -o "C:\filename.mp4"
  1. Replace “MLG URL” with stream url
  2. Modify the directory and/or filename

If the standard link does not work, try using the direct MLG link (HDS).

How to automatically Record/Download MLG streams

Automatically recording and downloading MLG streams is a great way to watch streams at a later date. When compared to Twitch, MLG does not have a good system to save past broadcasts. Most of the time, past broadcasts are not available and MLG only replays broadcasts at certain times.

It is much better to save past broadcasts or VODs directly to your computer and watch it later. The problem is, many times you do not know when a stream is going online. By running this script, you can automatically check whether a stream is live and download the stream directly to your computer.

Copy the script and name it MLGRecorder with .py as the file extension.

from urllib.request import urlopen
from urllib.error import URLError
from threading import Timer
import time
import json
import sys
import subprocess
import datetime

# returns 0: online, 1: offline, 2: not found, 3: error 
def check_user(stream_name): 
    url_status = '' + stream_name
        info = json.loads(urlopen(url_status, timeout = 15).read().decode('utf-8'))
        # MLG streams have 3 statuses: -1 = Offline, 1 = Online, 0 = Rebroadcast
        if info['data']['status'] == -1:
            status = 1
            status = 0
    except URLError as e:
        if e.reason == 'Not Found' or e.reason == 'Unprocessable Entity':
            status = 2
            status = 3
    return status

def parseData(user):
    url_all = ',stream_name,subtitle'
    dataset = json.loads(urlopen(url_all, timeout = 15).read().decode('utf-8'))

    # This loop checks whether the user exists
    # "len(dataset['data']['items'])" is the size of the array
    counter = 0
    while (counter < len(dataset['data']['items'])-1):
        counter = counter + 1
        slug = dataset['data']['items'][counter]['slug']
        stream_id = dataset['data']['items'][counter]['stream_name']
        subtitle = dataset['data']['items'][counter]['subtitle']

        # This if statement checks whether the user exists
        # If the user exists, it returns three values
        if (slug == user or stream_id == user):
            stream_name = stream_id
            stream_title = subtitle
            slug_name = slug
            return stream_name, stream_title, slug_name
    return False

def format_filename(fname):
# Removes invalid characters from filename
    fname = fname.replace("/","")
    fname = fname.replace("?","")
    fname = fname.replace(":","-")
    fname = fname.replace("\\","")
    fname = fname.replace("<","")
    fname = fname.replace(">","")
    fname = fname.replace("*","")
    fname = fname.replace("\"","")
    fname = fname.replace("|","")
    return fname

def loopcheck():
    while True:
        status = check_user(stream_name)
        if status == 2:
            print("username not found. invalid username?")
        elif status == 3:
            print("%Hh%Mm%Ss")," ","unexpected error. will try again in 5 minutes.")
        elif status == 1:
            print(user,"currently offline, checking again in",refresh,"seconds")
            time.sleep(refresh) # 30 seconds
        elif status == 0:
            print(user,"online. stop.")
            filename = slug_name +" - ""%Y-%m-%d %Hh%Mm%Ss")+" - " + stream_title + ".mp4"
            filename = format_filename(filename)
            print("Stream is done. Going back to checking..")
def main():
    global user
    global stream_name, stream_title, slug_name
    global refresh
    global quality
    global directory

    refresh = 30.0
    user = ""
    quality = ""
    directory = "C:\\"

    if not user or not quality:
        # refresh = input('Enter the refresh rate: ')
        user = input('Enter the stream name: ')
        quality = input('Enter the quality (best, high, medium, low): ')
        # directory = input('Enter the directory: ')

        print("Check interval should not be lower than 15 seconds")
    if (parseData(user) == False):
        print("Username not found.")
        stream_name, stream_title, slug_name = parseData(user)
        print("Checking for",user,"every",refresh,"seconds. Record with",quality,"quality.")

if __name__ == "__main__":
    # execute only if run as a script

When you run this script, it will automatically check for live MLG streams. If the stream is live, it will record or download the stream until it goes offline. The script can run forever or until you turn your computer off.

Configuring script

The script is designed to minimize user input. However, there are four variables within the script that needs to be modified. If you choose not to enter any variables, the default values will be preserved and additional user input will be required each time you run the script. The four variables are refresh, user, quality, and directory.

Refresh: The refresh is the number of seconds before checks whether a stream is online or offline. The default value is 30.0 seconds. You can increase or decrease the value (in seconds), but the check interval should not be lower than 15 seconds.

User: Enter the name of the channel you wish to check. will check whether the user exists and whether the user is online or offline. Make sure the username is inside the quotes.

Quality: Here is where you configure the quality of the stream. The quality options are best, high, medium, and low. Again, make sure the quality option is inside the quotes.

Directory: The directory is where you save your downloaded or recorded files. Make sure the directory is valid and within the quotes. The directory requires two backslashes (\\), instead of a single backslash.

How to Run Python Scripts

There are two ways to run python scripts. You can run the script through Python’s IDLE (Integrated Development Environment) or run it using python.exe.

Running on IDLE

  1. Open the script with IDLE
  2. Click Run
  3. Click Run Module or Press F5

If you run into any problems, make sure you have the correct version of Python installed. If Python 3.4 is installed correctly, then make sure the script is properly indented.

Running on Python.exe

Double click the file and the script will run. You may need to set python.exe to open by default.

To set as default application:

  1. Right click script -> Open With -> Choose Default Program
  2. Browse for Python.exe. It should be located in C:\Python34

After you set the python as the default application, all you need to do is double click the file.