Back

Abuse My Nipples Dot Biz

Livestreamer Tutorial

We live in a day and age where watching people play video games on Twitch has all but replaced having real friends, which is somewhat unfortunate given just how much garbage overhead a streaming site like that pushes through to your computer. Simply put, watching Twitch without Livestreamer is like being in space without a space suit or getting a blowjob from a t-rex: painful and full of advertisements. This tutorial will walk you through setting up a means to enjoy Twitch (at least as much as Twitch can be enjoyed) without actually having to deal with the site itself. The end result will be a much higher-quality stream that you will have much more control over, since it will be piped directly to the media player of your choice rather than run through your browser.

This is easy as hell.

Step #1: What You'll Need

REQUIRED

OPTIONAL

As you can see, there's really not a whole lot you need for this. Given that you should already have VLC, the entire setup process will actually take about a minute from start to finish. The only step that will take any appreciable amount of time is the optional final one, wherein we will create a script to act as a front-end for Livestreamer.

Step #2: Installation & Configuration

Installation is easy. Just run the installer and... y'know, install it. I couldn't make this part any simpler if I gave it an orange spray tan and made it the president. Once the installation is complete, we need to edit the configuration file located in C:/Users/(You!)/Appdata/Roaming/Livestreamer; recent versions of Livestreamer should prompt you to edit this file at the end of installation to save you the trouble of finding it yourself.

There's a bunch of stuff in the config file by default, but it's all hashed out - meaning that it's blank as far as Livestreamer is concerned. We need to add two things to this file and the first one technically isn't even neccessary if you've installed VLC to its default path since Livestreamer will look for it there on its own. Still, it doesn't hurt to find and uncomment (delete the pound sign) the following line: #player="C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --file-caching=5000

        (Obviously, if you installed VLC somewhere else, just modify the above as appropriate)

The second thing we need to add here is your Twitch authtoken so that Twitch doesn't send Livestreamer packing when it tries to connect. This means you need to find out what your authtoken is. To do that, open a command prompt in your Livestreamer folder (shift + right-click on the background in Explorer to make the option appear) and type the following command: livestreamer --twitch-oauth-authenticate

This will open up a page in your default browser that resolves to an error. Your authtoken is the part of the URL that comes after "access_token=". Now, we just copy and paste that into our configuration like so:

twitch-oauth-token=(YOUR TOKEN HERE)

And that's it. We're done.

Step #3: Creating A GUI

Livestreamer is not a complicated program - it's nothing more than a command-line utility that pipes a stream directly to a specified media player whilst avoiding any unnecessary overhead in between. The key phrase there is "command-line" - it doesn't actually have a front end to work with. We could just type in the necessary command every time we want to watch a stream, but that's a pain in the ass and we're lazy so we're just going to make a front-end out of a batch file.

Open up Notepad++ (because I know you're not still using just regular Notepad) and paste the following content into a new file, which we will then save as a .bat file.

@echo off

cd /d "C:\Program Files (x86)\Livestreamer"

set /p derp=Enter name of stream:

livestreamer twitch.tv/%derp% best

(As with the VLC path above, modify the directory as needed if you installed Livestreamer elsewhere)

Running the resulting batch file gives us basic functionality: we enter the name of the stream and then it opens up. Note that the quality argument is required - "best" is always available and gives you the best quality, while the availability of other settings is entirely dependent on how much Twitch likes the guy you're watching. But unless you're reading this from some hillbilly shack in the middle of West Virginia, your internet is probably good enough to just run with "best".

Now that we have it working (go ahead and give it a test run if you'd like), let's add some more fucntionality on to our batch file. First, we'll add a loop so that if the stream dies, it'll try to reconnect automatically.

@echo off

cd /d "C:\Program Files (x86)\Livestreamer"

set /p derp=Enter name of stream:

:loop
livestreamer twitch.tv/%derp% source
timeout 10
goto loop

The timeout tells the script to wait ten seconds (you can speed ity up by hitting any key) so you don't just spam the source non-stop. The :loop is an anchor; somewhere in the script that we can to point to.

Next, we'll add in an option to open up chat for us in a popout window, so as to avoid as much Twitch bullshit as humanly possible. Note that this will also count you as a viewer in the stream if that sort of thing actually matters to you.

@echo off

cd /d "C:\Program Files (x86)\Livestreamer"

set /p derp=Enter name of stream:

choice /m "Open up chat?"
if errorlevel 2 goto loop
start "" https://www.twitch.tv/%derp%/chat?popout=

:loop
livestreamer twitch.tv/%derp% source
timeout 10
goto loop

"Choice" is a weird function. I generally prefer to avoid using it if at all possible since you have to work around a response of "no" and trying to explain "errorlevel" to people is like fucking a band saw. The only real advantage is that it doesn't accept a non-binary response and will just keep beeping at you until you answer Y or N; this gives us a simpler and ultimately shorter script than if you were to go with open user input and then account for said user for some reason responding to a yes/no question with "suck my dick, fag".

Sorry, got a little sidetracked there. What the above script is doing is pretty simple: if the user answers "no" to opening chat, this sets "errorlevel" to 2 and we jump to the loop anchor. Otherwise, we move on and open up a chat window first.

Finally... let's add some favorites.

@echo off

cd /d "C:\Program Files (x86)\Livestreamer"

echo.
echo.
echo. LIVESTREAMER MENU
echo. -----------------
echo.
echo. 0: Games Done Quick
echo. 1: Nowea
echo. 2: Leadbeer
echo.
echo.

set /p derp=Enter name of stream:

if /i %derp% equ 0 set derp=gamesdonequick& goto loop
if /i %derp% equ 1 set derp=nowea& goto chat
if /i %derp% equ 2 set derp=leadbeer& goto chat

choice /m "Open up chat?"
if errorlevel 2 goto loop

:chat
start "" https://www.twitch.tv/%derp%/chat?popout=

:loop
livestreamer twitch.tv/%derp% source
timeout 10
goto loop

So now it's a bit longer. The "echo" bits are all for show: they're just there to remind us what our options are and to look pretty. The actual shortcuts are the "if" statements that are inserted before the choice to open up chat. We've added a :chat anchor so that these shortcuts can skip the question and just go ahead and open up chat for us. Conversely, for GDQ we just skip to opening the stream since GDQ chat is cancer and nobody in their right mind would ever want to look at it.

Step #4: Wrapping It All Up

And that's about it. You've probably noticed by now that the command window is tied to anything that it opens up (i.e. VLC) and that killing it will also kill VLC. If you'd like, you can give the window a custom title and icon by creating a shortcut to the batch file; it will run with whatever icon is assigned to the shortcut with the name given to the shortcut.

Until next time, everyone.

btb@abusemynipples.biz