How to Watch/Record MLG streams using Livestreamer

Major League Gaming is an online broadcast network that regularly hosts professional gaming tournaments. While Twitch.tv 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 MLG.tv.

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:

Prerequisites

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 MLG.tv, 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.

On Windows, open the run dialog by pressing “Windows Key + R” or open Command Prompt.

On Mac OS X, open the terminal by pressing ⌘ + Space, type “Terminal” and then hit “Enter”.

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 mlg.tv/stream_name 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.

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 MLG.tv. If the mlg.tv 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: mlghds-lh.akamaihd.net

Go to the link below and change “STREAM_NAME” to the stream name you want.

There will be two URLs. You want the HDS URL that ends with manifest.f4m

Copy the URL and Replace http:// with hds://

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

1

livestreamer hds://mlghds-lh.akamaihd.net/z/mlg141_1@60106/manifest.f4m 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 MLG.tv 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.

livestreamer hds://mlghds-lh.akamaihd.net/z/mlg396_1@126582/manifest.f4m 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.

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

1

livestreamer hds://mlghds-lh.akamaihd.net/z/mlg396_1@126582/manifest.f4m best

How to Record/Capture MLG streams with VLC Player

Launch VLC Media Player through livestreamer

Click on the View Tab and select Advanced Controls

Now advanced controls should pop up at the bottom of the player

Clicking the red button will record videos

Enable Record Button

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

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.

Go to Tools -> Preferences -> Input / Codecs

Under Files -> “Record directory or filename“

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.

On Windows: Press “Windows Key + R” to open the Run Dialog.

On Mac OS X: Press ⌘ + Space, type “Terminal” and then hit “Enter”.

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.

1

livestreamer"MLG URL"best-o"C:\filename.mp4"

Replace “MLG URL” with mlg.tv stream url

Modify the directory and/or filename

If the standard MLG.tv 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.

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 MLGRecorder.py 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 MLGRecorder.py 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.MLGRecorder.py 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

Open the script with IDLE

Click Run

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:

Right click script -> Open With -> Choose Default Program

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.