How to Record Livestreams

From DCTVpedia
Revision as of 10:50, 15 June 2014 by Leon (talk | contribs) (→‎FLV Files: Awww SHIT! Look who's got free time mothafucka?! THIS GUY!)
Jump to navigation Jump to search

Hey pal, so you wanna record some of the livestreams huh? Well you've come to the right place. These are the methods used to upload livestreams to the BBpediaVideos YouTube account. If you know of a better way, feel free to post it here.

Record Streams as They're Happening

If you're trying to capture a stream from a service that doesn't auto-archive their videos, then the only way you'll be able to download the stream is to capture it live.

You could always watch the stream and use some kind of screen capturing software to record it, but I'm not a fan of that solution. I use a program called Livestreamer. With it you can record streams from a ton of different streaming services. It's main purpose it to allow you to watch streams in VLC, but I use it almost exclusively to record. It uses the command line interface, so it's not very user friendly to noobs (like myself), but it gets the job done. Also, everything I've done has been on Windows. I know very little about Macs, so you'll have to figure out how to translate it over on your own. #SorryI'mNotSorry

Command Line

Once you install Livestreamer, you want to open up the command line (Start>Search "cmd") and change the directory to the install folder (you might also have to run it as administrator for it to work properly). For me, I would type "cd C:/Program Files (x86)/Livestreamer" and hit enter. Then type "livestreamer.exe" and hit enter. From here, you have a crap ton of options that you can dig into if you want, but I'm just here to tell you how to record, god damn it! You'll want to type "livestreamer [stream URL] [stream quality] -o [filename.Flv]". The stream url is just the url of the page where you would watch the stream. The stream quality refers to the resolution of the video. It varies a lot from stream to stream and service to service. To find the available stream qualities just type "livestreamer [stream URL]" and it will tell you the available qualities. "-o" simply means that you will be outputting the stream to a file rather than watching it. Then just enter whatever you want the video file to be called. Assuming you put everything in correctly and the stream is active, once you hit enter you will be recording.


For further clarification, I'm going to use Brian's Dailymotion account as an example. To record the stream to you computer you type "livestreamer dailymotion.com/video/x1a389a_live-from-bblive-studios_tech best -o Output_File.flv". The stream should begin recording and the file will be in the Livestreamer install folder. Yeah, that's a bit of an inconvenient location, but I don't know if you are able to change the save location. Livestreamer will automatically close when the stream ends, and your file will be ready to watch, edit, upload, whatever.

Shortcut

To make this a bit easier, I created some shortcuts on my desktop so I didn't have to go through the command line every time. Go to the Livestreamer install folder, create a shortcut for Livestreamer.exe and put it wherever you like. Right click on it, go to properties and in the "Target" box, after the file location in quotes put "-livestreamer STREAM URL -o FILENAME.flv". Then go to the compatibility tab and check "Run as Administrator". Then whenever you start up that shortcut, it will record the specific stream that you entered as the stream URL.

The Shorter-cut

"Ugh, I can't sit around all day waiting for a livestream to start just so I can hit record! Can't we automate this?"

HELLS YEAH BRO!

So we're gonna make a batch file that will allow you to record, and better-yet, continuously check to see if the stream is live, then start recording when the stream starts. Copy the code down below into notepad or your favorite text editor. Then save it as a .bat file and run it. However you may need to make some alterations for it to work for you. Keep reading after the code.

Code:

cd C://Program Files (x86)/Livestreamer

livestreamer.exe

Echo off

goto check_permissions

check_Permissions

echo Administrative permissions required. Detecting permissions...

net session >nul 2>&1

if %errorLevel% == 0 (

echo Success: Administrative permissions confirmed.

goto check_time

) else (

echo Failure : You didn 't run it as administrator

ping 192.0.2.2 -n 1 -w 4000 > nul

exit

)

check_time

set x=%TIME:~0,2%

set y=%TIME:~1,1%

if %x% leq 9 (

GoTo Before10

GoTo pause

) else (

GoTo after10

)

Before10

set x=_%DATE:~-4,4%-%DATE:~-10,2%-%DATE:~-7,2%_0%TIME:~1,1%-%TIME:~3,2%-%TIME:~6,2%

GoTo start

after10

set x=_%DATE:~-4,4%-%DATE:~-10,2%-%DATE:~-7,2%_%TIME:~0,2%-%TIME:~3,2%-%TIME:~6,2%

goto start

start

echo.

echo %DATE% %TIME%

echo.

livestreamer dailymotion.com/video/x1a389a_live-from-bblive-studios_tech best -o Shwood%X%.flv

ping 192.0.2.2 -n 1 -w 3000 > nul

goto check_time

You may need to change a couple things in order for it to work for your setup. Namely the very first line. "C://Program Files (x86)/Livestreamer" is the location for my Livestreamer installation, but you may need to change this line to match your install location. This code is setup to record Brian's Dailymotion account. If you want to record another stream, just replace the URL in the third to last line. This file will also wait 3 seconds before it checks whether or not the stream is live. If you want this to be longer or shorter, go to the second to last line and change the 3000 to whatever you want. 3000 refers to the number of milliseconds it will wait between checks. 15 seconds would be 15000.

You can probably just acquaint yourself with Livestreamer and DOS commands to figure out how to make this do whatever you want. That's what I did and I'm an idiot!

The Shortest-Cut

"God damn… really? Console commands? Batch files? WTF is this shit?" I know, I know. You're thinking that this is all so easy and you want a better user interface that was created by someone with 8 weeks of a 10 week visual basic course under their belt. You want a program that may or may not explode your computer, but at the same time might actually have a slight chance of recording livestreams. A program that has been beta tested by literally nobody and has only been tested on one computer in one situation. Well do I have just what you want!

All of the previous four sentences are true and I seriously don't know what I'm doing, but I made a simple (I hope) program that uses Livestreamer to continuously check if a stream is live and record it when the stream starts. You still need Livestreamer installed, but there is no need to deal with command lines or batch files.

You can download it here. Also, did I mention that you're just downloading an .exe file from a stranger on the internet? That's not very smart. The guy even said he has no clue what he was doing! I mean, go for it if you want, I'm not your dad.

FLV Files

So with Livestreamer, the output files are just straight rips of the flash video stream. Upside: the videos looks exactly as good as the actual stream. Downside: they're .flv files. FLV video files suck balls and deserve to be murdered. You can watch them in VLC or upload them to YouTube as is, but if you want to do some editing you're gonna have to do some work. If you're a sucker idiot, you can re-encode them and an hour later you'll have a shitty quality mp4. Or you can be an awesome person and use FLV Extract and Yamb (For all I know, these could be riddled with malware, use at your own risk). These work for Brian's Dailymotion stream, but may or may not work for other streams.

When you have an .flv file, drop it into FLV Extract and it'll spit out an audio track and a .264 video file. Then take the .264 file and the audio file and put them into Yamb to create an mp4. In the past, when working with Yamb, I've run into some issues with the audio and video being out of sync. If this happens, just make an mp4 file using only the .264, then combine the audio and the video files in your favorite editing program. In my experience, when the audio and video are out of sync, for whatever reason, the video file is usually a second or so shorter than the audio. No clue why that happens.


If you have any questions, hit up @leon_1337 on Twitter or Leon in the chatroom. But seriously, if you have a programming question, there's a good chance that you know more than he does.