Contents
Share Your Experience: YouTube Integration In Games
 
 
Printer-Friendly VersionPrinter-Friendly Version
 


Part of:



[More information...]
 

Latest News
spacer View All spacer
 
November 22, 2009
 
Video Game Watchdog National Institute On Media And The Family Shutting Down [11]
 
Modern Warfare 2 Infinity Ward's 'Most Successful PC Version' Yet [12]
 
New Tech, Design Details Of Project Natal To Emerge At Gamefest In February
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
November 22, 2009
 
Sucker Punch Productions
Character Artist
 
Sucker Punch Productions
3D Environment Artist
 
Sucker Punch Productions
Network Programmer
 
Sucker Punch Productions
Texture Artist
 
Sony Online Entertainment
Brand Manager
 
Monolith Productions
Sr. Software Engineer, Engine - Monolith Productions - #113767
 
Crystal Dynamics
Sr. Level Designer
 
Gargantuan Studios
Lead World Designer
spacer
Latest Features
spacer View All spacer
 
November 22, 2009
 
arrow Upping The Craft: Susan O'Connor On Games Writing [6]
 
arrow Small Developers: Minimizing Risks in Large Productions - Part II [6]
 
arrow iPhone Piracy: The Inside Story [48]
 
arrow And Yet It Grows: Analyzing the Size and Growth of the European Game Market [5]
 
arrow NPD: Behind the Numbers, October 2009 [13]
 
arrow Reflecting On Uncharted 2: How They Did It [5]
 
arrow Sponsored Feature: Rasterization on Larrabee -- Adaptive Rasterization Helps Boost Efficiency
 
arrow Postmortem: Wadjet Eye's The Blackwell Convergence [2]
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
November 22, 2009
 
Accepting the Inherent Value of Games
 
Planckogenesis, Part II: Song Structure & Gravy Train [1]
 
Designing Games Is About Matching Personalities [1]
spacer
About
spacer News Director:
Leigh Alexander
Features Director:
Christian Nutt
Editor At Large:
Chris Remo
Advertising:
John 'Malik' Watson
Recruitment/Education:
Gina Gross
 
Features
  Share Your Experience: YouTube Integration In Games
by Claus Höfele
1 comments
Share RSS
 
 
November 22, 2008 Article Start Previous Page 4 of 4
 

Uploading Videos

The demo application already provides request and response operators for authentication, search, and video upload. To simplify the API's usage, I added inline methods that fill in known details of a request, such as which function objects to use, and call YouTubeService::service() internally. A video upload can be achieved with only a few lines of code:

YouTubeService youTubeService("YouTubeDeveloperKey");

YouTubeAuthenticationData authenticationData;
authenticationData.userName = "user";
authenticationData.password = "password";
youTubeService.authenticate(authenticationData);
ASSERT(youTubeService.isAuthenticated());

YouTubeUploadData uploadData;
uploadData.fileName = "screen.ogv";
uploadData.mimeType = "video/ogg";
uploadData.title = "Title";
uploadData.description = "Test upload";
uploadData.category = "Tech";
uploadData.isPrivate = false;
uploadData.developerTag = "TagName";
uploadData.keywords = "1Dot, 2Dots, 3Dots, more";

YouTubeVideoEntry videoEntry;
YouTubeServiceState upload =
youTubeService.upload(uploadData, videoEntry);
ASSERT(upload == YouTubeServiceStates::Ok);

When uploading the video file, you have a number of options that describe the contents, such as title, description, and category. Useful is the developer tag, which is an invisible marker that's only accessible to your application.

This tag can be used in search requests to filter videos uploaded by your application. With the private flag, you can decide whether the video is accessible to everyone or only the user.

Once uploaded, it usually takes 5-10 minutes for YouTube to process the video and enable it for viewing on YouTube's web site. You can check the status of a video under My Account / My Videos / Uploaded Videos for the account that was used to upload the file. You can watch some sample videos on the test account I created for this article.

Summary

As you have seen, adding YouTube upload to your game is straightforward, but requires some planning.

To start with, you need to decide how you are going to record the game footage. From the discussed options, a framebuffer capture is the easiest to add to an existing game, but recording game state or player input gives you more flexibility to apply changes to the recording. If you want to change the camera angle later on, for example, game state recordings allow you to do that.

I chose the Theora video format to turn the recording into a video because the encoder comes with an easy to use reference implementation and doesn't require license fees. Other video formats accepted by YouTube include DivX and most formats of the MPEG suite.

Finally, an application can upload videos with YouTube's RESTful interface; a protocol based on HTTP. The demo application for this article comes with an implementation for authentication, search, and video upload requests that you can use for your own game.

Note: Demo updated 5 January 2009. Note from the author: "Update v1.1: Fixed a bug where I mixed up the color channels when reading from the DirectX render target. DXUT sets the render target to D3DFMT_X8R8G8B8 by default where the color channels are ordered BGRX in memory. For this reason, I added ImageFormat::B8G8R8A8 as a new image format and a new code path to ImageUtils::convertToYCbCr420p() to handle this format."

[EDITOR'S NOTE: This article was independently published by Gamasutra's editors, since it was deemed of value to the community. Its publishing has been made possible by Intel, as a platform and vendor-agnostic part of Intel's Visual Computing microsite.]

 
Article Start Previous Page 4 of 4
 
Comments

Bryson Whiteman
profile image
This article made a light-bulb appear above my head. I haven't been hip to games making use of this You-Tube API. It sounds like it would be possible to even make a Flash game that you can upload footage from using these, or similar techniques. It might require some server-side scripts to encode video but I think it'd be possible.

I'm going to look into it.


none
 
Comment:
 


Submit Comment