Posting video capture to youtube

I’ve seen a couple posts about using 3rd party capture software for pulling video from a unity game while it’s running - But unfortunately I need to look into taking it to the next level and was wondering - is it even possible?

We have a game, running in web player, where the players log in and blah blah blah fun stuff for them, and one of the features is to allow them to hit a button or something, maybe some setup, which starts capturing video straight from the game, then should post this video to youtube for them or bring up the link to youtube sending them through the process of posting the video they captured. Sure they may have to specify certain things for us to post it to youtube for them but that’s something my company has done before and it’s not really the part I’m concerned about, it’s the capturing video part, in a web player, is that possible?

Thanks in advance for any replies.

Im theory, possible. Problem is, you’d have to write your own video encoding in C# (unless you find out there is already a video compression library in C# someone else did which you can use), so that’s a pretty big task there.

Thanks for your reply. This is going to be my first time messing with run-time video capture, so let me know if I’m way off on this, but the way I would see capturing the video would be to use RenderTexture.GetTemporary, then assign our main camera’s RenderTexture target to the temporary one, then I should be able to use the data in the temporary rendertexture and run it through some kind of C# video compression? But after looking at the RenderTexture in the script reference I didn’t see any way of directly accessing the pixels, or would I even need that?

Sorry, again, first time with attempting video capture.

I use fraps and jingproject and get pretty nice frame rates. The free versions are just limited to short videos. Youtube only allows 10 minutes of video so these are perfect.

Texture2D has the function EncodeToPNG() which should be helpful here. Basically I think you’d be looking at assigning your render texture each frame to a Texture2D and encoding it as a PNG, then feeding the png byte arrays to your video compression utility.

For compression utilities, there are probably a few options available to you. There aren’t many in .NET that I know of, so doing the encoding on the client side could be tricky. There’s always the option of uploading the data to a server that encodes the video for you though.

Thanks, I did manage to get the EncodeToPNG working, and was saving pngs out locally. Doing this on the web in the player though was decided to be a little out of scope for the project I am working on, however, we worked out a compromise and now all I need to do is get a single screen cap, then upload that to some service like flickr.

I made another post about this recently which I have yet to see any responses. But basically, when I encode to png, any terrain is rendered as 0 alpha - not sure why this is happening, perhaps I need to modify the terrain shader or something? Or perhaps we will be forced to use a mesh as the terrain(But I’d much rather use Unity’s terrain because it’s more optimized). If you have any ideas on this it would be very helpful, I will post back here if I find out how to fix it.