Download

Work in progress: Support for live streaming services (e.g. Twitch)

Hey everyone! We just checked in initial support for creating your own UE4 plugins for live streaming. The system is designed to make it easy to stream games online, and even to stream your Unreal Editor sessions (e.g. live tutorials), without having to set anything up. This is still a work in progress but we’re hoping to have an initial working implementation available in the upcoming 4.3 release.

You can see the details in my GitHub commit message (master branch.)

Another awesome thing – we are working with Twitch.tv to create a built-in plugin for their service, so you’ll be able to stream your game to Twitch right out of the box. We’re still sorting out some legal stuff, but I’m hoping to get a preview version of our Twitch plugin committed later this week.

It would be great to hear from you guys about what features are important to you when it comes to live streaming! I’m planning to be on the weekly live stream next week (4/3) to answer questions also.

–Mike

Pasted my GitHub commit text here for convenience:

----<snip>----

Work in progress: Live streaming support for editor and games
This commit adds the framework APIs, editor and rendering features needed to support live streaming. Along with this, we’re working on a new plugin that adds Twitch.tv support (waiting for legal approval to commit.)

Game live streaming
- Allows general support for live internet streaming of game video and audio
- Web cam video feed can be overlaid onto game viewports automatically
- New ‘Broadcast’ Blueprint function library allows you to easily start broadcasting from your game
- New IGameLiveStreaming API that allows you to start broadcasting through C++

Editor live streaming
- The editor UI now displays a “broadcast” button automatically when a live streaming service is available
- Broadcasting of all desktop editor windows is supported (configured in preferences)
- If you have a web cam, video will be displayed automatically while broadcasting in a new editor window
- New “Live Streaming” editor preference tab with many new settings for configuring broadcasting
- New IEditorLiveStreaming API that lets you control editor broadcasting directly, if needed

Added new ‘Broadcast.Start’ and ‘Broadcast.Stop’ console commands
- These allow you to easily test live streaming in games without writing UI code
- Built-in help is available for these new commands

To implement a live streaming plugin:
- Inherit from the new ILiveStreamingService interface
- Register your “LiveStreaming” feature with the IModularFeatures system

Other changes:
- Eliminated broken screen quad drawing functions; replaced with publicly-exposed DrawRectangle()
- Slate: Eliminated legacy code for ‘marking windows as drawn’ (not used anymore)
- Slate: Added Slate rendering callback to find out when a frame buffer is ready to be presented

[CL 2115377 by Mike Fricker in Main branch]

Very cool, Mike.

Is there going to be capture to disk functionality for upload to Youtube?

You can do that already, actually! Simply open up Matinee and click the tool bar button called “Movie”. It will bring up an window that lets you set options for capturing your game to video. If you want to record yourself playing the game (and not just a Matinee cutscene), remember to turn off the “Enable Cinematic Mode” option. Also, I’d suggest enabling the “Close editor when capture starts” button so that you can smooth performance. While in the game, you can type “StopMovieCapture” and “StartMovieCapture” to do retakes.

On a related note, if you want to record a perfectly-smooth high resolution cinematic animation you can use the “-DumpMovie” command-line argument. This will turn off audio (you need to mix it in later), but will go frame by frame and dump out a video that will look great when played back in HD. This is how we spit out videos of our cinematics.

–Mike

Thanks for the info. I’m going to need that soon and I’ll be referring back to this.

Very very neat! I’ll tempt the murky waters and try it out :slight_smile: As someone who has streamed my editing sessions/games this will be nice.

This is seriously awesome.

I also appreciate being able to make videos directly.

Great! Remember the Twitch integration is not submitted yet (pending legal stuff), but it should be within the next week or so. The code that is in master today only allows you to create your own plugins for streaming video.

Mainly I just want to know which features you guys would absolutely need to have for either an in-editor or in-game live streaming system.

–Mike

Hey mike. I was going to do something like this except I want to do it with something like “twitch play pokemon” or “choice chamber” where the view place input to the game. Are you going to have that in as well?

I think we can get that to work. You will certainly be able to use all of this functionality in your shipping game. Let’s see, what do you need exactly? You need to hear about chat messages on your channel and then write gameplay code or Blueprints that can parse the text and respond to those events, right? Based on what the users on your channel typed, you can affect gameplay behavior. If I’m missing anything here, please let me know.

The current implementation does not have chat message support, but we’ll work on that soon.

–Mike

Here is another interesting use for live stream: collaborative development. It would be cool to stream your session to others, and, in the same time, let them work with you on your game in real time. I suggest something like this: streaming per camera. When a dev connects to your session, a new camera is created, that streams video to that dev. The dev interacts with objects in your scene, interacts with your editor ( the interface elements are streamed separately- ex. material editor window etc ) and here is how you could get collaborative development via the streaming feature.

That is really rad. Some neat possibilities there.

Edit: You could do a really awesome interactive fiction game with live audience participation this way (i.e., at decision-point you send the options, and tell them to write in chat which they pick - game tallies them and chooses the option with most votes). Assuming the plugin can handle sending to the Twitch chat as well, that is.

I actually misunderstood what he was asking, and thought he was talking about rendering the Twitch stream to a texture in the game (that would be weird…hall of mirrors?).

It is an interesting an idea. We will absolutely support you streaming your editor session with everyone, but we won’t be allowing your friends to connect and collaborate directly in the editor at this time. That is actually a pretty large undertaking, but it could be an exciting community project – if you guys are up for it. :slight_smile:

–Mike

Yep. I also want to post a delay chat to the users that is watching the channel. What I mean by post a delay chat to the user is within game the game uses the streamers username or someone username to have them post a delayed chat on the even within streaming. Twitch has a 20~ second delay when streaming anything even if your internet is at high speed. If there was a game that ask the viewer and/or user Trivia question within 30sec, The user will know but the viewer will have a 20~ lag delay and they would have to answer it within ~10sec. By having a delay notice everyone would have the chance to reply.

Sure thing. This will be supported.

–Mike

Here’s an update! Initial support for Twitch streaming is now available in the latest GitHub master branch. This version will let you broadcast the editor or game to your Twitch channel while viewing yourself on web camera. We’re still working with the Twitch guys on the legal stuff, so unfortunately I can’t commit the actual Twitch SDK, you’ll need to get that yourself if you want to try it. I included instructions in the InstallingTwitchSDK.txt file. Hopefully we can sort that out before the 4.4 release.

Remember this feature is still a work-in-progress. Chat support isn’t finished yet, and we need to expose more functionality to the editor UI. Also, the browser-based authentication is a little clunky.

Oh, and I’ll be showing off Twitch support on tomorrow’s Unreal Engine live stream at 2 PM EST. (7/2/2014)

Notes from my GitHub commit below:

New TwitchLiveStreaming plugin (work in progress)

  • Implements live video/audio broadcasting to Twitch.tv
  • Supports displaying your web cam in the editor and game
  • Partially implemented support for chat and stream discovery
  • Uses browser-based authentication to login to Twitch

Important:

  • Epic cannot distribute the Twitch SDK to you, as you need to agree to Twitch’s terms before releasing a title that uses Twitch.
  • We currently require you to get the Twitch SDK yourself and recompile the TwitchLiveStreaming plugin (see InstallingTwitchSDK.txt)

Other notes:

  • Documentation will be coming later. This plugin is not quite finished yet.
  • Windows platform only, for now. Mac and iOS will be coming next.
  • You can run with -TwitchDebug to see log spew from the Twitch SDK
  • “Direct” authentication with Twitch is implemented but not recommended
  • New “Twitch” project settings are available in your Project Settings UI (when plugin is compiled with SDK available)
  • Various known issues we are working on (see ‘@todo twitch’ in code)

[CL 2125033 by Mike Fricker in Main branch]

I am wanting to try this with the 4.3 release, but I can’t seem to find anyone out there has has got this working.

Also I can’t seem to find InstallingTwitchSDK.txt anywhere. ( I am probably blind )

The feature is not available in 4.3 as the code was submitted after we had already branched for stabilization of that build. You’ll need to use the latest code from the GitHub master branch in order to check it out. Sorry!

–Mike

I updated to the master branch and found everything I needed to start. Thanks Mike.

I didn’t end up getting it to work however. :frowning:

First thing I ran into was the error TTV_EC_INVALID_AUTHTOKEN after the browser authentication finished and it tried to log into twitch.
I did some searching and found this http://discuss.dev.twitch.tv/t/implicit-grant-authorization-for-ios-os-x/784/7. So I added “+channel_commercial+metadata_events_edit” to the twich scopes and it cleared that up.

Now though I am getting the error TTV_EC_INTEL_FAILED_SESSION_INIT (72) when TwitchStart is called. I ran with the -TwitchDebug flag and found out that it is an issue with the Video encoding on my hardware. I am currently running an i7-950 and a GTX 580, on windows 7.

Here is a link to the twich dev answer hub, where someone else is having the same error as me http://discuss.dev.twitch.tv/t/problem-with-qsv-video-encoder-initialization-on-certain-hardware/753

That is where I stopped, but I will probably put some more time into it and see if I can get something to work.

Awesome, thanks so much for testing this early version. What type of web camera do you have? And was there a specific error in the log about why it failed to startup, or does it exactly match the log spew in that link you posted? Just wondering.

Usually if I get TTV_EC_INVALID_AUTHTOKEN I just have to re-kick it a few times and it works. Strange, I know! I don’t see why the channel_commercial or metadata_events_edit scopes would be needed for you, but I’ll investigate more soon.

If others are having problems with authentication, I noticed that with the Chrome browser I had to disable the web page prefetch and sniffing features under the Advanced settings in order for Unreal Editor to be able to scrape the authentication token from the browser.


Just an update on the Twitch work in progress. We are still hung up on some legal issues so development on the feature has been paused until those get sorted out. Also the Twitch guys are looking into the various strategies for authentication on Windows platform – using an external browser is a pain for various reasons. We might end up embedding a browser to do the authentication, or using a direct authentication method for the editor itself at least. We also need to finish exposing the chat API and add expose the rest of the features to the Blueprints.

–Mike