Critical Edge: Building Your Own Stream (Part 3)

  • Admin
And now we finally get to the meat of the matter. In truth, everything I explained so far is simple; how to record your games in part 1, and then how to add commentary in part 2. This is all simple stuff, even part 3. Streaming is easy: its easy to do things right, and at the same time its easy to do things wrong.

As I've stated previously, I have been releasing videos online for almost a decade now. Back when I started, bandwidth and space wasn't nearly as fast and abundant. So you had to learn "tricks"; things like "b-frames", "QP", "trellis" or "umh/esa/tesa" became the norm. Ever wonder how fansubbers release episodes in high quality with low file sizes? Sadly, most of these techniques can't be used in the world of streaming; but much of the knowledge can still be put into practice.

x264vfw.jpg

DIRECTSHOW COMPATIBILITY

I'm going to assume, you've now done everything you need to do in order to get your video games to display on your computer. The next step is to make sure your game video is registered with DirectShow. DirectShow is a framework supplied in Windows that almost every webcam and streaming software uses to communicate. Its how your streaming software knows your camera/capture card exist. Everything needs to be registered with DirectShow if you want it on your stream.

If you're using the BlackMagic, congratulations, you are DirectShow ready! If you're using something else, you may have to do some additional steps. For instance, if you are using a Hauppauge device (shame on you), you're going to have to use screen capturing software, or third party intermediate software to grab the video and send it to DirectShow. All devices are different, so I wont be going into further detail.

Once you're game video is running on a DirectShow filter, you will see it in the device/input/source list of your streaming software. You may have to edit the settings of your device/input/source within the program in order to make sure your video is being displayed properly. For instance, with the "Decklink Video Capture" source from BlackMagic cards, you need to select the right resolution and framerate before your video will display.

For the remainder of this article, I'm going to assume you've taken care of DirectShow compatibility with your capture card. Your game video is being sent to a DirectShow filter and is being displayed properly in your preferred streaming software.

STREAMING SOFTWARE

Selection of software for streaming should be based purely on what you want to do with your stream; unfortunately, its also based on what runs well on your computer. Sometimes your preferred program just "doesn't work" for you, it may crash because of incompatibility with some random piece of hardware. There are a lot of choices, but chances are, you will have to make one. Most capture cards simply will not work with web based flash apps since you can't access the device settings. I will discuss in brief, the 3 most popular options before I start talking more about encoder settings.

ADOBE FLASH MEDIA LIVE ENCODER

fmle.png

The first piece of software you should look at is Adobe's own Flash Media Live Encoder. To put it simply, this program is the BEST streaming encoder you will find. Since it's made by Adobe themselves, they have done a fantastic job with the encoding process (those "tricks" I mentioned before). Streaming through FMLE will open you up to the highest quality you can get from online streaming. Not to mention FMLE is completely free!

So thats it right? Can I say stream using FMLE, call it a day and end this article now? Unfortunately no. While FMLE offers the best encoding options, it also offers the worst in additional features. If you are just streaming your game and commentary, FMLE is fine; but if you want to do extra things, like having player cameras or title cards, you're going to have to look elsewhere. But still, everyone should have FMLE installed on their computer; its a great test platform.

TELESTREAM WIRECAST 4

wirecast.png

Wirecast 4 is Telestream's attempt to bring a live production studio to your computer. However, unlike a NewTek Tricaster which will cost you around $30K, you can get Wirecast for as low as $500. Wirecast does almost everything you'll want to do with your broadcast. It can handle multiple sources at a time, such as player cameras. You can also overlay title cards, images, movies and supports multiple audio inputs. It also supports chroma-key (green screening) if you have the tools/space for that. It also has Desktop Presenter software built in.

So is that it? Use Wirecast? Well... no. Wirecast has it's own set of downsides; for the average person, the cost. Secondly, the encoding algorithms that I have been talking about this whole time? Atrocious on Wirecast; video feeds are inexplicably just not as good as FMLE. Thirdly, you can't do pixel specific placement of objects; you have to drag and drop and play finger gymnastics on your keyboard to get everything just right. And finally, for a 4th generation product, it is awfully buggy. Sure, maybe it's not as buggy as XSplit, but XSplit is a beta, so it has an excuse.

Probably the biggest problem with Wirecast is the fault of it's price. At this time, XSplit is relatively cheap: free, so there is a lot of talk among their forums; people are figuring things out, helping each other with issues and making better streams. Lots of users means lots of bug reports, and lots of feature requests. Wirecast on the other hand is so expensive that I imagine most users have pirated it; so there is very little interaction on their forums and the "tricks" to getting a Wirecast stream to run well have become "trade secrets". There is a definite lack of sharing among Wirecast users, and even less from Telestream themselves.

SPLITMEDIALABS XSPLIT

xsplit.png

Which brings me to the third option: XSplit. I've going to spend the most time talking about XSplit because its just that good of a program; marred by some obvious faults. XSplit is seemingly everything you want in a broadcasting client. It uses the same encoding algorithms as FMLE, and it has many of the features as Wirecast. Not to mention it also has pixel specific placement of objects, and VHScrCap built directly into the software. VHScrCap isn't quite as good as Desktop Presenter, but its far and away easier to configure and use. It can also output itself as a virtual camera so you can send the presentation to FMLE, Skype or YouTube directly! It also has built in social widgets!

XSplit is absolutely fantastic and its what everyone should be using over Wirecast! So whats the catch? Why after everything good I am saying about Xsplit, I am still using Wirecast? Well as I said before, XSplit is still in beta, and because of that, its missing a lot of features and it sometimes crashes at random. For instance, something as simple as centering text was only added as a feature about 3 weeks ago. It also lacks the ability to add multiple microphone sources. Not to mention, my BlackMagic card samples audio at 48khz, and XSplit only supports 44.1khz; which means my audio has to be resampled, which leads to audio distortion and the occasional static tick. For a perfectionist as myself, this is all unacceptable.

But the most egregious of limitations of XSplit is the complete lack of "master layers". On my streams, I use these "master layers" in Wirecast to handle event information and audio sources. No matter what main shot I select, the event information and audio sources shouldn't change. So at the beginning of an event, when I change the event info, I change one master layer and the entire stream is reflected accordingly. XSplit doesn't have this, so when I need to change the event information, I need to go into all dozen of my shots and change each one, one by one.

XSplit instead has a "remote text polling" feature. You can create an XML file, and store your text information in that. Every few seconds, it will poll the file and update shots. However, the problem is you still need to set up far too many text objects, and if you need to change anything, you're stuck changing objects one by one. Secondly, when you change shots, the new shot comes in with "blank" text until XSplit finishes polling. The lack of master layers is deal breaker for me; SplitMediaLabs has stated they have no intention of adding them.

If you're streaming from home, you probably won't have the need for master layers; but if you stream a lot of tournaments at different venues, they become a necessary convenience. For instance, if you're streaming a large scale event, with lots of sponsors, various videos and commercials, your options with XSplit are limited in the fact that it only permits 12 different shots while Wirecast is unlimited with it's master layers. Not to mention, in Wirecast you cant set up shots on the side and "push to live"; instead, in XSplit everything is always live. You have to set up all your shots in advance, or risk looking unprofessional as you edit your shots in a live setting.

* UPDATE *
I have just discovered, with some hacking, you can prevent the "blank" text on shot switches. However, it requires knowledge of how the XML constructs in XSplit work, and its not something that I can easily explain in an article like this. In layman's terms: basically when you set up a remote update, the system gives the text object a series of "syncIDs"; the trick is to manually edit the XML constructs so that your "global" text objects on each shot share the same syncIDs. So they won't repoll on shot switches. Still not enough for me though...

FLASH ENCODING SETTINGS

You don't actually have to stream in flash; thats just what most streaming services support. Justin.TV, Twitch.TV, Ustream, Livestream and own3D.tv all stream in Flash; so thats why its what we're talking about. If you insist on streaming in another format, such as QuickTime or Windows Media, you're going to have to stream to a service that supports them. I personally can't think of any that are free; as more often than not, they are premier streaming services only. So for now, lets stick to Flash.

Now, as I said before, when it comes to live streaming in Flash, your encoding options are rather limited. You can pretty much only change your resolutions, frame rates, bit rates and a few other minor details. But none the less, I still feel that its not just enough to know that things works, but to know why and how they work. What I'm specifically talking about are encoding settings which are displayed prominently in FMLE, located in "broadcast settings" in Wirecast, and are known as "channels" in XSplit.

In both FMLE and Wirecast, the first major option has to do with your encoder format/codec. Generally, you will have two options: VP6 or h.264. The VP6 codec is almost 10 years old now and hasn't been updated in a long time, its there for legacy purposes; older machines just don't have the power to encode in the much higher quality h.264. I would talk about it in further, but there really is no point. Any decent computer today can encode in h.264 and its what you should be using. This option is grayed out in XSplit, as it uses the open-source x264 library.

H.264 PROFILES

profiles.png

When you select the h.264 codec in FMLE and Wirecast, you will notice a few extra settings will be available to you: profile, levels and keyframes. The "profile" setting generally has two options: Baseline or Main. You may not see a change between the two, but there are fundamental differences. "Baseline" takes the least computer resources to both encode and play; its most common use today is an encoding format which needs to be compatible with all manner of portable devices like iPods or PSPs. If you're not looking for an HD quality stream, stick with this profile.

The "Main" profile actually adds an additional feature not available in the baseline: b-frames; I will explain what a b-frame is in an upcoming paragraph. For now, all you need to know is that b-frames lead to better compression, which means a higher quality stream. However, it takes a powerful computer to not only stream with b-frames, but to play them back as recorded video. There are even better profiles for h.264, but they are not designed with streaming in mind; so the developers of streaming software have rightly left them out.

In FMLE, you will will also be able to set the profile level. The "level" is an arbitrary number that places a limitation on your encoding in other to optimize compatibility. If you really want to know what these limitations are, you can read them here. However, you can just set the level to 3.2 or 4 and call it a day. For some reason Wirecast does not allow you to explicitly define this level setting and I assume it's selected automatically based on your other encoding settings.

KEYFRAMES

keyframes.png

Now before I can talk about b-frames, I need to explain what a keyframe means. A "keyframe", sometimes called an "i-frame" is the technology behind video encoding. A keyframe is a frame which is radically different from the frame before-hand; such as a scene change. Instead of recording each frame one by one, which can lead to large file sizes, what modern encoders do is only record the keyframes, and then for subsequent frames, it simply records the "changes" between the new frame and the previous frame. These intermediate frames are sometimes called predictive frames, or "p-frames".

Less "change" on a new frame means less data has to be set aside to record actual frame information, and the remaining available data in your target bit rate can be used to enhance the visual quality of the frame. This is why video with less movement on screen seems to be in higher quality than a video with more movement, even though they both may technically have the same bit rate. There are downsides to keyframes however...

When viewing a video, you can't "seek" to a non-keyframe, as non-keyframes don't have all the visual data needed to render the scene. This is why sometimes when you seek in a video, you can hear the scene playing, but it may take a second or two for the video to catch up; because its waiting for the next keyframe. To rectify this, you can define keyframe frequencies in your encoder. While keyframes are generally automatic, based on scene changes, the keyframe frequency will force a keyframe refresh at the set interval.

How often should you set your keyframe frequency? Well if you set it too often, you lose the advantage of keyframes, which lowers the quality of your video. Set it too long, and you'll limit people's ability to jump right into your stream without having to wait a bit before the video starts registering. For a good experience, I recommend setting your keyframe frequency to about every 5-8 seconds. If you're running your stream at 30fps, that means you will generate a new keyframe automatically every 150-240 frames.

So what is a bi-directional predictive frame, or "b-frame"? If an keyframe is the technology behind video encoding, b-frames are nothing short of magic... they can time travel! While a p-frame references changes from the previous frames, a b-frame can also look for changes from upcoming frames. By doing this, the encoding algorithms can enhance image quality by up to an additional 15-20%! But there is a catch, there is always a catch!


An inherit error in the way AVC codecs such as h.264 handle b-frames is that they often like to use b-frames as a reference piece, instead of sticking to keyframes. So sometimes your recorded videos will be corrupted for the first few seconds of your video until it reaches the first keyframe. Then you have YouTube which will try to decode these b-frames when you upload your videos, and when it doesn't find a first keyframe, it will add it's own gray frame. In FMLE and Wirecast, if you want to disable b-frames, you have to switch back to the h.264 baseline profile.

BIT RATES

The bit rate is the targeted file size of your video. If you have a 2000 Kbps bit rate, the encoder will try to match your file size to that. As I stated before, a video with high motion will seem like its at lower quality than a video with low motion even if both videos have the same bit rate. A high motion video has to generate more p/b-frame data, which takes available bit rate room away from enhancing video quality. But naturally, what you need to keep in mind, is that the higher your bit rate, the higher the quality of your video.

Your bit rate should be based on your needs, your bandwidth, and your viewership. If you're streaming in HD or 60fps, you will need a higher bit rate. If you have limited bandwidth or a weaker computer, you may not be able to support a higher bit rate. Also keep in mind your viewers. You may be able to upload at 2000 Kbps, but can your viewers download at 2000 Kbps? Thankfully, JustinTV/TwitchTV provide a system where they down-sample high quality streams into varying lower qualities for viewers with bandwidth constraints.

FRAME RATES

A frame rate is the number of frames displayed per second. In America, our televisions generally have to deal with two frame rates: 29.97 and 59.94. Most fighting games we play process at 60 frames per second, so 59.94 would be the most accurate. When you're streaming however, you can set the frame rate to whatever you want. Most people stream at 29.97 (30fps) because it offers accuracy, while not looking choppy since its the frame rate we all grew up with in the days before high definition video. However, there is a growing trend of streamers who want to stream at 59.97 (60fps).

Before you decide to stream at 60fps, there are a few caveats you should be aware of. First of all, do you need it? For a game like UMvC3 which has super high movement and a quick pace, 60fps can make your stream look smooth as butter; but for the majority of other games, its just a complete waste of resources. Secondly. you should also keep in mind that 60fps isn't really a supported frame rate in flash; to the point where YouTube doesn't even offer 60fps on their videos. The moment you upload a video to YouTube, they will re-encode it at a max frame rate of 30fps.

And finally, you should realize that by doubling your frame rate, you are essentially doubling the required bit rate in order to maintain the same quality (yes, I know its not actually "doubling" because of the advantages of keyframing, but it may as well be). You can stream a game at 30fps with a 2500Kbps bit rate and it could have decent quality. But in order to stream at 60fps and maintain the same decent quality, you would probably have to up your bit rate to about 4000Kbps.

At that point, you have to think what's more important: enhancing the "smoothness" of your stream and risk losing quality unless you up your bit rate... Or enhancing the quality and resolution of your stream. If you're running a stream at 2000-3000Kbps, you pretty much have to make a choice between HD resolution at 30fps, or SD resolution at 60fps. For UMvC3, I may choose to go with the SD/60fps option, simply because of the amount of movement in the game; but for everything else, I would choose HD/30fps. If you have the bandwidth to up your bit rate to around 5000Kbps, then by all means do HD/60fps!

Also keep in mind that in addition to YouTube and uStream, Wirecast itself does not support 60fps!

GOING DEEPER

In FMLE and Wirecast, the options mentioned above are it, that's all you're getting. However, if you're using XSplit, you can do some even more in depth tweaking. Those "tricks" I spoke about in the opening paragraph of this article are actually open to you if you're feeling comfortable with editing them. XSplit uses the open source x264 library (rather than the proprietary libraries in FMLE and Wirecast) so lots of information about enhancing your encoding can be found around the net.

X264.png

C:\Program Files (x86)\SplitMediaLabs\XSplit\ffpresets\libx264ext-XSplit Default.ffpreset
Code:
ex=deblock:0:0
ex=partitions:i8x8,i4x4,p8x8,b8x8
ex=me:hex
ex=subme:2
ex=merange:16
ex=scenecut:40
ex=qcomp:0.6
ex=qpmin:10
ex=qpstep:4
ex=bframes:2
ex=ref:1
ex=direct:spatial
ex=trellis:0
ex=b-pyramid:normal
ex=mixed-refs:0
ex=weightb:1
ex=8x8dct:1
ex=no-mbtree:1
ex=ratetol:10
ex=weightp:0
ex=ipratio:1.41
ex=pbratio:1.25
ex=keyint:350
ex=min-keyint:90
If you wish to get into this, all you need to do is open up the appropriate file on your computer, and get to editing. There is no "end-all be-all" set of options for encoding as each type of video requires different things. Live video would need different settings than anime, and anime would need different settings than video games. Thankfully, the creators of XSplit have designed this preset for gaming specifically, so there shouldn't be much to change. There are a lot of guides explaining what these setting means, but the best is probably the MeGUI wiki.

For instance, if you're having issues with the b-frames and don't like how it creates a gray start to your videos on YouTube, you may want to change the b-pyramid to "none" or straight up set bframes to 0. Naturally, you will slightly lower the quality of your video, but that choice is yours to make. If you have a powerful computer, you may even consider changing the motion estimation (me) to something stronger like "umh". You can also see the settings default your keyframe interval to 350 frames.

STREAMING SERVICES

Okay, so you have your preferred streaming program set up and your game is successfully being displayed through it... which streaming service do you use? There are actually quite a few choices, the most common being JustinTV/TwitchTV, uStream, Livestream and own3D.tv. Features and services also change; when I first started streaming, I swore by uStream and had many issues with JustinTV. Now I use TwitchTV exclusively and have no interest in switching back.

In America, JustinTV/TwitchTV seems to be the most popular. TwitchTV is designed with high viewership Starcraft events in mind, so it does a very good job at handling streams with exorbitant amount of viewers. It also supports high definition video, 60fps streaming, automatic down-sampling to lower qualities and automatic video archives. In addition to that, they have partnership programs so that the broadcaster can get a cut of the profits from advertisers. The only problem is that historically, JustinTV has had issues with viewers and broadcasters in Asia; but I wouldn't be surprised if these issues have been fixed since the founding of TwitchTV.

puppy.png

So for that matter, in Asia, uStream reigns supreme. Go on uStream during Japan's peak hours and it will literally be littered with streams you can't understand about Shiba Inu Puppies and Age of Empires 3. However, in America you won't find many streams still using uStream. It does support HD, but doesn't do automatic down-sampling, so it can get laggy at times. Not to mention they don't offer partnership programs or automatically create video archives. They do however let you set up multiple channels and upcoming events, embed your own pages as iFrames on your channel and they even let you run Pay-Per-View events.

Livestream is a service that seems to be gaining popularity among gaming publishers and news outlets. Electronic Arts, BioWare, GameSpot and many others all seem to have their official channel on the service. Livestream probably has the most light-weight media player, but at the same time its missing many features. As far as I know, they don't offer HD, at least not with their free services, nor do they offer partnership programs or automatic video archiving. People are still using it though, so I'm sure it has something good going for it, I just don't know what that is.

A new service that launched earlier last year is own3D.tv; which was launched as a direct competitor to TwitchTV. Since it was designed specifically for streaming computer based RTS games, it has all the same features as TwitchTV. HD, 60fps, down-sampling, archiving and partner programs. In addition to that the media player itself is far superior in the simple fact that it has social widgets built directly into it. Right now TwitchTV has the majority of the user-base among gamers, but if TwitchTV doesn't watch out, they are going to let own3D.tv creep up on them.

PART 4: QUESTIONS AND ANSWERS

I originally wanted part 3 to be about setting up title cards and overlays; but the more I've been testing XSplit this week, the more I see how different it really is from Wirecast. I can't really do an article on overlays because I would have to talk about multiple different programs and for that matter I would like to spend a bit more time experimenting with XSplit, especially during a live tournament setting before I go into discussing it further. So for the next part of this article series (which may not be next week), I will be taking questions from the readers.

What do you want to know? I did not talk about layer construction, overlays or titlecards at all this week as most of that can be figured out on your own simply by experimenting. I already plan on going more in depth on constructing title card XMLs in Wirecast, as I've recieved many questions about that in the past. What sort of issues have you been having in Wirecast or XSplit? Is there something you've seen other people do, but haven't been able to figure out? Maybe you even want to know about a way to do cheap telestrating?
 
Jason Axelrod

Jason Axelrod

Owner and Operator of 8WAYRUN
Love these articles Jaxel, just wanted to throw something in:

Livestream integrates with other products to provide mobile streaming:

- The Livepack is a mobile uplink backpack that sends video to livestream (@ $2.5k/mo, max 1mbps).
- Teradek makes mobile HD encoders that sit on the network and send video to livestream, or in the case of the cube, to wirecast over the network.

These products are a bit costly and probably overkill for most events right now, but I think they will eventually be a cool option, especially for events held in places with poor internet.

------------

About the software choices, I am considering using wirecast purely as a switcher and using the monitor output to feed FMLE or other encoder(s). I wonder if the local monitor output will be at 60fps or if WC always uses 30fps for everything.
 
very awesome article, Jaxel. Now I never have to bother you again in chat! Which sucks because I like bothering you!
 
This is probably the best reading ever Jaxel!
Hey, would you mind covering some render settings for youtube videos using BlackMagic or Hauppauge and Vegas or a similar program?
 
Um.....

are we gonna do a part 4? :3

These articles are GREAT, btw, helped me in more ways than I can imagine. Thanks Jaxel.

And yeah, I'd still love to see a part 4 (or how your updated rig looks, if it's been upgraded since here)
 

Live streams

3 Viewers
blue_beards_ultimate_time
blue_beards_ultimate_time
CAN YOU STOP THE EVIL BLUE BEARD MY VIEWERS GIVE IT YOUR BEST AND HAVE FUN !!!!!!!!!!!!!!!!!!!!!!!!!!!!
3 Viewers
Corey_Hex
Corey_Hex
10-12 Hour Birthday Stream!!!!! Let's Go!!!!!

This week's events

SoulCalibur VI EVO Japan side event
Ariake GYM-EX, Tokyo (Tokyo Big Site)
3-chōme-11-1 Ariake, Koto City, Tokyo 135-0063, Japan

Forum statistics

Threads
14,897
Messages
676,677
Members
17,200
Latest member
luca9974
Back