Oct 28, 2011

(2012 update of the original post)

Here is my experience creating a high-definition live streaming set up for the purpose of streaming FPS games. What started as a brainstorm session has turned into an actual nerd DIY project, and I feel like I've accumulated enough knowledge to share. I've split it up into some sections: Rationale, Video, Streaming, Audio, and Lessons Learned.

Rationale

I think high definition streaming (and live streaming in particular) is part of the future of e-sports. There is already a lot of live and VOD content that is serving entertainment to thousands and thousands of nerd ballers every day. And I think this has yet to be exploited fully - thus this article. Just imagine if you could watch cooller (or insert your favorite dozen video game players here) play prac games while talking shit into the microphone - the same way you can watch SC2 pros already.

I also think that soon it will be as easy as installing start_live_streaming.exe and running it in the background. But not yet. Right now there's a lot of stuff to know:

As mentioned, my intent was to stream FPS games, and also that I was inspired by the many live streams of SC2 that I enjoy watching. I noticed the latter was easy to do on one PC - you capture the SC2 windowed screen with xsplit or FMLE or something similar, and off you go. There are some tricks with tweaking settings, but with a powerful enough computer you will be getting your 60 FPS and you should be fine.

With first person shooter games, however, you need a lot more than 60 fps (and even that much is more difficult to achieve) ... This is especially true of arcade gameplay like quake where motion is almost constant, and where the quick game deciding engagements require every bit of performance from your gaming machine - that extra smoothness factor of high fps is important for prozone aim and movement.

In the past I've had limited success by using FRAPS to record live sessions, and then upload those to youtube. (I do live streaming to get more new players into quakeworld.) But despite having a beefy gaming PC, I still had a trade-off scenario: did I want a somewhat playable framerate with a low quality recording, or did I want an unplayable framerate with a high quality recording? Or did I want to generate the video recording in really really high quality by playing back a demo of the game played - but then we are not live at all, and in fact we now have extra work to do recording, encoding, etc., which really slows things down. I wanted a background push-button process.

Of course just using xsplit instead of FRAPS wasn't so much different. First you have the problems with capturing full screen action using software on the same PC - sometimes its possible, sometimes its not, and either way, it is a drain on your resources. You can also capture in windowed mode, but now you're playing through a small low quality window on your desktop. And in all scenarios, you are not getting anywhere near the framerates that you are used to, because your gaming PC has to do video capturing, encoding, and streaming.

So I decided to set up a 2nd PC for capturing. I'm not the first to try this, by far; console and PC gamers have been doing this for years. But I had a real hard time finding a good set of resources - thus, again, this article. For example, they've been broadcasting games in dreamhack using a setup similar to this, but without publishing any of the technical details. Once you get this working, you can just live stream yourself from anywhere, even a LAN - simply bring your capture laptop (along with keyboard and mouse as usual) to the LAN and connect it there and off you go! Of course LANs may prohibit this for whatever reason, but I believe the technical challenge has now been solved and will only become easier.

That said, all this is still "cutting edge" stuff which is continuously being worked on, improved, broken, fixed, and so forth. Some rules of thumb: backup all install files. If something doesn't work, try an earlier driver/firmware. Try to disconnect and reconnect cables in order. Stay patient. Anyway:

Video

The basic idea with a 2 PC setup is you have the game PC and the capture PC, and the intent is to have no performance impact on your gaming PC. This is because the video output is taken directly from the video-out on the back of your PC and so it doesn't matter how the image is generated - wether its your linux desktop, fullscreen game, whatever.

The hardest part here is selecting and configuring the capture device. I go over this part again in lessons learned below, because there is a number of viable alternatives as well as dead-ends in this regard, but to cut to the chase - I selected the blackmagic intensity shuttle. Its fairly pricey (180-200 USD) but it does the job well.

Connection is simple:


Game PC DVI1 ---- DVI to HDMI cable ------ Intensity Shuttle HDMI IN 
Game PC DVI2 ---- DVI cable -------------- LCD monitor/projector


Note: the intensity shuttle also has a HDMI OUT which you can then use to connect your LCD monitor too. I did not need this, because I have a video card with two DVI out (well, four to be precise, brag brag brag) and I set up "Duplicate these displays" in Control Panel -> Display -> Change display settings.

Intensity shuttle is particularly finicky with settings, however. Your first challenge is to acquire the video signal (and not a black screen) so you will need to use a resolution on your game PC which the intensity shuttle supports - for example 1280x720 or 1900x1080. Currently, otherwise popular resolutions such as 1680x1050 will not work, and the device will not be smart about converting it to a compatible resolution; it will just give you a black screen.

Furthermore, blackmagic drivers (while being actively developed) may break compatibility with third party software used to stream the video source (such as xsplit or FMLE, more on these later) one particular example of this issue I had is - I upgraded to latest 8.5 desktop video driver (desktop video is the only driver you need to install to get the intensity shuttle working) and it stopped working; then I downgraded to 8.2.x and functionality was restored with xsplit and FMLE (other users report 8.4 works, but I couldn't find an archive link)

In this regard, the blackmagic site is very useful, as it has archives for drivers.

The most straightforward way to confirm that you have a video signal is by running the bundled media express software - if this gets a video signal in the capture tab, then the device works, and any black screen in other third party software is a desktop video driver problem which you may have to downgrade to get working like I did above.

The other note about capturing video with the intensity shuttle is that it captures at 60 fps. (Again, this has no effect on your in-game FPS, that will be as high as it can be.) It might say 59.9 or something like that, and it may have options for 30fps, but I haven't gotten those to work yet. Your baseline standard should be 1280x720 at 60fps. More on this in the next section:

Streaming

You want to be able to stream it in high def, with all the fancy graphics settings that your game PC can already generate. Again, since we're doing 2 PC setup, you can go hogwild with the highest quality settings, as long as your game PC can handle it. And being the gaming nerd that you are, it can. Nod your head. Streaming (sending to the internets) all that quality is another story. In the beginning you will probably get a crappy looking stream with pixelation, blockiness, wash-out-ness, and so forth. Here's what I've learned:

Streaming at 60 fps is bad. If it works well, it looks super smooth, but to make it work well the end user has to spend a lot of time decoding, and I don't think most viewers (either their PCs or their codecs) are there yet for 60fps 720p. Long story short, you need to be streaming in 30fps or 25fps (I use 25fps) and this is possible with xsplit, it simply takes intensity shuttle's 60fps capture and converts it to whatever fps you want to stream at. On the other hand, FMLE is currently unable to do this. It is locked to stream at the same settings as the video source, and as I mentioned before, I couldn't get intensity shuttle's 30 fps to give me anything other than a black screen. This may require more tinkering to work (or newer drivers) but until that time, FMLE will only stream at 60 fps, and again it will look great when it works, but most of the time it doesnt and:

Streaming at 60 fps is also a big hit on your bandwidth. Some games had a very degraded connection quality (fluctuating ping, as well as packet loss) when I streamed 60fps at any kind of codec bitrate (500 to 2500kbps) using my 5MB up - however when I tried the same settings in xsplit with 30fps, the connectivity would become almost as good as without streaming.

The other part to set up with xsplit is quality and bitrate. I've experimented with quality factor between 5 and 8, bitrate 2000-3000, and as a rule of thumb I would set the buffer at 2x what my bitrate is. This part is where you will have to spend the most time hands-on, tweaking these settings, making recordings, and then comparing them and seeing which one works best. After your live stream is production quality, you will still probably be tweaking these settings to your liking.

In this regard there are a number of useful tutorials. Destiny's. Teamliquid's. This guy seems to be an expert on xsplit, but I didn't actually find any guides by him... Google around, you'll find many more.

Once you have your video, you still need to have good audio as well:

Audio

This part is next simply because I first figured out the video and streaming part and it looked good, but my audio sucked, so then I figured out the audio :) Just streaming the in-game sounds with the intensity shuttle's RCA sound alone gave me problems - the problems seemed to depend on xsplit/FMLE and would manifest as delayed audio - delayed anywhere between 0.5 seconds or a minute.

One option is to bypass the intensity shuttle entirely, and route game PC audio to capture PC line in using a male-male 3.5 audio cord, and then connect your headset to the capture PC while turning "listen to this device" for that line in. But that seemed too hacky for me, and I also wanted to be able to mix in a second source (microphone). There's also a piece of software called VAC that people swear by, but I do not have any experience, as I skipped directly to the prozone (but perhaps least portable) alternative:

Get an (external hardware) audio mixer. I bummed an old (but nice - mackie 1202) audio mixer off a friend, and (being a complete newbie in audio mixers) learned the entire thing from scratch by trial and error. If you actually know how to use one - I guess you can skip this section and just use it to get the audio working :)

Otherwise, take a look at this manual, most mixers look like and work like that and its a good resource.

There's two main things. One - stereo sources work funny with audio mixers. You can plug them into a balanced single-TRS input, but you will most likely get mono. What you really need is a stereo breakout cable. It takes a 3.5 stereo and breaks out the left side to a 1/4 TRS mono, and the right side to another 1/4 TRS mono. It sounds simple, and it is, but there are so many different Y-cables, and adapters, and all this other audio stuff you can get lost in. Again, all you need is a stereo breakout cable. And a stereo 3.5 to 1/4 adapter to connect your headphones to the audio mixer's phono out. Each one shouldn't be more than $5.

Two - microphones. (If you want to talk while you're live streaming, which I think is a big sell for live streams!) With PCs, you just plug in a microphone and it works. With "pro audio" (blah blah blah) there's more variety. You can get a dynamic microphone and just plug it in and it will work - but then you're holding a mic while playing, or wearing two headsets at the same time, or something even sillier, and on top of that you're spending extra money. If you already have a mic on your PC headset, you can do what I did: get a XLR adapter (such as the rode vxlr - don't spend more than $10 here) and just make sure your audio mixer's phantom power is turned on. (Note: 1/4 adapters will usually not work, you need XLR with phantom power)

Finally, the connection goes something like this, and bear in mind there's more than one way to route this stuff with audio mixers:


Game PC Audio ---------- Stereo breakout cable ------------- Line in 5 L/Line in 5 R
Headset mic ------------ 3.5 to XLR adapter ---------------- Line in 1
Headset ---------------- 3.5 to 1/4 stereo ----------------- Phones out
Capture PC Line in/mic - patch cable (male-male 3.5 cable) - Tape Out


The only thing I didn't explain yet is the tape out part. It basically sends to the capture PC the same audio that you hear on your headset. There's many other ways to do this (aux, stereo inserts, etc) but the key idea is the same: mic + in-game sounds goes into magic audio mixer black box, and then the mixed audio goes to your capture pc and also to your headset.

The final part once you have the stereo and the mic sorted is to get your audio levels where they aren't hissing and popping. The easiest way for me was to install audacity on the capture PC and then to record line in, and visually monitor the waveform (as well as listen to it of course) - you will be able to get instant feedback on how much noise you're getting (with the mic muted you should get none, and with the mic on you should get very low, and none if its a high quality mic)

You should also be able to get the loudness as loud as it gets without clipping: open another audacity (or something that shows you the waveform) on the game PC, and playback something on loop (shift+click play?) while recording on the capture PC. You should be able to visually tell if it is clipping, or if you can afford to adjust the volume higher and get real-time visual feedback. (There's many different places on the mixer where to adjust, generally I adjust trim first, and leave everything else baseline.)

Lessons learned


  • The technical stuff is definitely maturing:

  • Hardware is being actively developed - it's been at least a year since intensity shuttle was released, and there are other options besides, such as a slew of internal capture cards, as well as similar competing products such as Happauge HD PVR (I haven't tried either of these options) and blackmagic seems to be working on improving the product (although on my one phone call with them, I learned that the representative wasn't even aware that the intensity shuttle was being used for something other than video capturing from a camcorder/DVD...)

  • Software is being actively developed. The two main ones for me are - FMLE, a free and fairly stable platform, although with some critical features missing - and Xsplit, which is a really feature packed and actively developed tool.




  • There are also apparently dead-end products, most notably epiphan devices such as the promising DVI2USB, until you learn that frame-rate can be a serious problem ... although I haven't even had a chance to test this out, due to the prohibitive price tag. (To be sure, epiphan products do have their purpose, and they are probably very well made and are a very good company, but they did not fit my requirements for a consumer device.)




  • To set this up, you will need to consider the investment of time and money. You will get from it as much as you put in.

  • As far as time goes, I suggest allocating a couple (1-3) hours a week, depending on how technically savvy you are, at playing around with these hardware and software settings, for a total of 2-3 weeks. As a fairly hardcore nerd myself, but with zero experience in this particular field (besides fraps and virtualdub), it took me about an hour a day, every other day, for about a month (would have been a couple days if I had this guide :mrgreen:) to get to a place where I was 100% comfortable with all the settings and with how everything was working, and, of course, with a watchable stream. (A week of that month was spent just doing homework on the subject before I even plugged a single wire into anything.) Don't expect to buy intensity shuttle and have everything working that day. Although ideally that's what would happen, the current state of affairs is such that at best it will take you a couple days, and at worst you'll find out it is impossible since your computer is not supported.

  • As for money, I am assuming you already have two compatible computers, and so your biggest expense will be the video capturing device such as the intensity shuttle, and the audio mixer (unless you can get the device to play nice with the audio as well.) Cables would be an expense, only because you need so many different cables that they add up. But if you're paying more than $5-$10 for any particular cable - you are doing it wrong. I recommend getting cables on newegg.com or monoprice.com or google shop.




  • Speaking of the two computers, I'm not sure if this is true of all capture cards/solutions, but intensity shuttle in particular has a fairly strict list of requirements for compatible hardware (this is in no small part due to the USB3 hype fest that's not their fault). As a rule of thumb, check with the capture device's manufacturer if they support the hardware first. (Black magic has a useful list here - their site is useful in general, I suggest you peruse the support section.)

  • Closing words I hope this is of use to you. If this article helps at least 1 person on the path of live streaming, then I think it has been a friday spent well spent writing it. :)