How to Watch/Record MLG streams using Livestreamer

0
1469

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 

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

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

livestreamer mlg.tv/stream_name high
livestreamer mlg.tv/stream_name medium
livestreamer mlg.tv/stream_name low
livestreamer mlg.tv/stream_name 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 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.

  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.

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.

  1. Go to MLG.tv 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.

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.

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

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.

  1. Replace “MLG URL” with mlg.tv stream url
  2. 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

  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.

NO COMMENTS