How to Record Livestreams
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_timeYou 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.
Installing Livestreamer on Mac OS X
Installing Livestreamer on Mac OS X is a bit more complicated, but it can be done. Here's how.
First, install livestreamer itself. Open Terminal and type:
easy_install -U livestreamer
Livestreamer requires a program called RTMPDump in order to work. In Windows, this is installed automatically, but on Mac we must do so manually. The easiest way to do this is to use a program called Homebrew.
To install Homebrew, you will first need to install the Command Line Tools from Apple's Developer site. Log in with your Apple ID and download the appropriate installer for your version of OS X. Install it.
Once that's done, you can install Homebrew by pasting this into Terminal:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Homebrew is now installed. You can now use it to install RTMPDump by typing this in Terminal:
brew install rtmpdump
Once all of that is done, livestreamer should be ready to use. For our purposes, it should function exactly like the Windows version, with the exception of automation. To automate it, you will need to write a shell script or Applescript instead of a batch file, obviously.
(Note: I have only tested this in 10.8 Mountain Lion, but it should work in other versions, too. Hopefully.)
FLV/F4V 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. However, some streams(like Brian and Justin's MetaCDN stream) spit out F4V files which are slightly less dumb and can usually be plopped into Adobe Premiere no problem. If you really need to make them into an MP4, you can use ffmpeg. There's a billion things you can do with ffmpeg and it can get pretty complicated and it's all command line shit, but here's what I end up having to do for MetaCDN recordings to get them into MP4 form.
ffmpeg -y -i "input_video.f4v" -vcodec copy -acodec copy -bsf aac_adtstoasc "output_video.mp4"
It only takes a minute or two, so it's pretty quick considering its usually one or two hours of HD video. What evs. PEACE OUT!
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.