martes, julio 07, 2009

Adding video support to the game


This past weekend, we added a video aperture sequence for the puzzles.

It turns out that the WMV support recently added to XNA, it's not as good as one may expect. We experienced some troubles trying to get the video in the exact format required by the content pipeline video importer, without ruinning the quality.

IMPORTANT: It's mandatory to use CBR compression and a single audio track in your video. VBR and no-audio is not supported by XNA right now.

The first attempt was to use my video converter tool of choice, FormatFactory. This freeware program works great for all kind of formats and portable devices. So I presumed it'd work for XNA too. Sadly, I was wrong. This tool is unable to produce a WMV video compatible with the content pipeline.

Then, I tried the simplest option, and converted the video with Windows Movie Maker. That worked, but this tool is "too simple" and you just can't configure the video output beyond the built-in profiles. So the resulting videos created with it, are plain horrible.

Finally, I installed Windows Media Encoder. It comes with a non intiuitive but very flexible interface application, that allows you to configure every aspect of the compression and the output file. So after getting used with this application, I started experimenting with the different options, first one was resolution.

It turns out that there's no way to move a 720p video smoothly in XNA. So forget about 720p :'( as start. Or maybe you can, but with zero cpu expenses in your game logic side, which isn't the case for us.

800x450 is the highest resolution I got to work without heavy framedrops. The good news is that you can increase up the bitrate as much as you need, without hitting performance problems. So we'll have to go with a not-so-high-res, but at least with a generous bitrate.

Those are the settings we're using right now:


Unfortunatelly, I can't show you the results, because the gfx are not quite definitive yet. Anyway I hope this information is useful to anyone trying to add video to theirs games.


1 comentario:

moyete dijo...

Hello!

I am having the same problem and I was hoping your post could help me solve it. But the image with the settings is not readable, and I can't open it or save it with a higher resolution. Can you send me a better copy of the image? or re-post it?

Greetings..