Scurvy.Media Question

By on 9/25/2008

I received a question about the Scurvy.Media library, and I figured I'd share my response in case it's useful to anyone else :-)

Hi Joel,

We are currently doing a project in XNA and are trying to inventory the abilities to play video in game. We found the scurvy media project to be the one that is the most advanced. Only on your codeplex site it is not really clear what the requirements are of the movie to be played. so far i've gathered
- it should not be compressed video (xvid / divx)
- framerate game = framerate video

could you please respond to tell me if the information i've gathered is correct?

That's partially correct :-) 

  • Theoretically, as far as compression goes, you can use whatever codec you want ... as long as the developer's machine has the same codec.  I've heard some reports of certain videos not working for certain people, but I've no way to determine whether they have the correct codec installed :-P  Beneath the scenes, the content pipeline portion uses this library to decode the AVI video.  So as long as that library can read it (and it just uses your machine's codecs), then should be able to translate it to the runtime format.
  • As far as the framerate goes ... as long as your game's framerate does not drop below the framerate of the video, the video will play at the correct framerate.  It takes the video's length and frame length into account ... it's just that if the game delays an update call to the video, there is no built in recovery mechanism for it to catch up.

A few more things to note ... the pipeline is unfortunately sensitive to video size.  Because of the way that it decodes the video into essentially a sequence of textures, the size can tend to be a little large.  This would be fine if it was able to get on disk, because of the way that the video is streamed from the file system.  But unfortunately, the content pipeline buffers the entire contents of one .xnb file in memory first before writing to disk ... so if this hits some limit, it will throw an out of memory exception.  I usually just suggest that users break down the video into multiple ones and play them sequentially if it's too long.  I know it's less than ideal, but it's the workaround for the moment.

I wish your project the best of luck ... please keep me informed of your progress using the library if you end up using it as I'm always looking for ways to improve it and user's feedback is always instrumental in this.

See more in the archives