Scurvy.Media Question
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 videocould 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
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 scurvy.media 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.
Sjors Miltenburg Said,
December 5, 2008 @ 7:02 am
Hi,
Could you please inform me if the scurvy project is still alive (last update is >5 months ago) and if 3.0 is supported?
Joel Martinez Said,
December 5, 2008 @ 8:48 am
Yes, I haven’t abandoned it
I’ve been fairly busy and haven’t had a chance to update it to the latest unfortunately. That being said, if you get the source download, I’m fairly sure that the project upgrader should update it with no problems and it will be usable in a 3.0 project.
Zune wouldn’t be supported yet as last time I worked on it I was trying to get the code working on the zune, but ran up on some dynamic texture creation issues. But when I do get back to working on it, this is what I will be striving to resolve.
Corey Paganucci Said,
March 18, 2009 @ 6:39 pm
Hi,
I’m using your suggested technique of playing videos in sequence, but I’m getting a black frame between videos. I’m using the End callback to play the next video and load the one after that (see pseudocode below). Any suggestions for getting rid of the gap?
Thanks,
Corey
pseudocode:
LoadContent()
{
vid[0].load
vid[1].load
curVid = 0;
vid[curVid].play
}
onVideoEnd()
{
curVid++
vid[curVid].play
vid[curVid+1].load
}
Joel Martinez Said,
March 19, 2009 @ 8:54 am
Hi Corey, thanks for giving this a shot … I can think of two immediate workarounds:
1. re-edit your videos so that the black frame comes at a natural dark point, such as in between scenes.
2. modify the source code to add a “PreVideoEnd” event. The event would be raised when there were only X seconds left before the end of the video. The “X” of course could be configurable via property, and would perhaps have a default of .5
I will consider perhaps a more forward looking solution for inclusion in the engine. But in the meantime, I’d be really interested in hearing the results of your efforts as it may help decide the ultimate solution.
thanks, and good luck!