So, for my second blog entry I'm gonna talk about video capture for fighting games. Why specifically for fighting games? Well, in fighting game strategy and theory there is a lot of talk of frames, such as when talking about frame (dis-)advantage, meaty moves, recovery and more. So far people have been relying on strategy guides for their frame data, and sometimes those are hard to come by simply because they're expensive or weren't published in your country. With the right software and a modern capture card you can get your own frame data and perhaps discover new things that the strategy guides missed. All in all, pretty exciting stuff.
I don't want to talk too much about how video works, because there are other guides that explain that much better and I don't want to sacrifice the space. The most important thing is that your capture card is capable of grabbing all of the 60 frames per second of your fighting game. How you ask? Through interlacing. Each captured video frame, depending on the settings you use to capture, will contain two game frames combined into one through interlacing. By deinterlacing the video you can reconstruct the 60 fps motion that the game works with internally.
What do you need to do this?
A modern capture card that uses WDM drivers for better performance on modern machines.
Make sure you have the latest drivers and try to use your console's S-Video output if possible for better image quality.
Next is capturing your video. Start up VirtualDub and go to Capture AVI under the File menu. Set the file to which you're going to capture under the File menu again. Choose the right video and audio sources according to the program's documentation, though it's pretty straight forward. Under Video > Compression choose the Huffyuv codec. Under Video > Capture Pin choose 720 x 480. Under Capture > Timing make very sure you have unchecked "Drop frames..." and "Insert frames...". Almost done, now under Capture > Settings fill in 30 fps as capture framerate. Now hit capture video and do your thing.
Now what you have is video that is 30 FPS even though everything else on NTSC television's run at 60 'frames' per second. Not entirely true, the video signal runs at 60 FIELDS per second, and two fields make up one video frame. The process of going from a 30 fps interlaced video source to a 60 fps video is called bob-deinterlacing. It recreates the full original frame (only half of which was broadcast) using information from the current, previous and sometimes upcoming frames. This is where Avisynth is useful. Create a file in notepad and save it using the extension *.AVS. Now put in this file the follwoing script:
AviSource("C:\myCapture.avi")
ComplementParity()
Top=DoubleWeave().TomsMoComp(0,5,1).SelectEven()
Bottom=DoubleWeave().TomsMoComp(1,5,1).SelectOdd()
Interleave(Top,Bottom)
Change the first line to match the location of your capture. The second line needs to be removed if the resulting video stutters. So far this is the best way I've found to bob-deinterlace game footage. Avisynth has an internal bob deinterlacer and several others that come from plugins included in the package, but all of them have unacceptable trade-offs between motion detection and pixel preservation which is very important in game footage with low resolution sprites. This way is a bit more round-about since for some reason TomsMoCom doesn't have a bob mode.
Now it's time to re-encode your video into a handable format. Open VirtualDub again and load the AVS file, it will appear as a regular video file and you can seek through it. You'll be able to see very smooth motion. Now follow the VirtualDub documentation to specify your audio/video codecs, optional filters and save your new AVI to disk. You now have a 60 fps video. This isn't good for all purposes, since older systems might have trouble playing it back. The useful part is that you can now count the frames in VirtualDub or another program and figure out frame data for yourself. Here is an example. It is a clip from Tekken 5. It's Heihachi doing a headbutt with all of the original 60 frames reconstructed and played at 30 fps, which means it's at half the original speed. I slowed it down to show how smooth the motion can be after bob-deinterlacing.