Mame Video Capturing

Aus Hardedge Wiki
Version vom 10. Januar 2009, 11:04 Uhr von Subarashii (Diskussion | Beiträge) (Die Seite wurde neu angelegt: - Version 1.00 - Created, edited and compiled by subarashii - Last update 2 January, 2008 Copyright This capture guide and everything within it cannot be reproduced...)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

- Version 1.00 - Created, edited and compiled by subarashii - Last update 2 January, 2008


Copyright

This capture guide and everything within it cannot be reproduced, altered or copied without permission from the author. This is a a free document that cannot be used in any sort of commercial sense. This document is part of a huge tech guide and will be updated from time to time. Big thanks for Boki for letting me host this document.


Motivation behind this guide

   * I own quite a lot Jamma PCBs including NeoGeo MVS, CPS1/CPS2 and recording from such devices was and will always be
     a reak pain in the ass. Plus analog capturing suffers from loss of picturequality. So my main motivation behind this guide was to
     record clean and hardware-native fps arcade footage.
   * The second point is to provide a solid mame capture guide for combomovie performers and other editors as well. Most of them
     are already familiar with the well known and awesome kawaks emulator but only a few tried mame based projects. Mame features
     such nice and wellmade (but yet! unexplored) fighting games. I want to encourage other combomaker to try theses new grounds.
   * Kaillera netplay fighting has become very popular since ~2001. This guide makes it possible to record inputfiles from online
     played sessions without the usage of shareware screen capture tools. Everything in this guide is done with freeware tools ;)

General Introduction and current problems

This guide (as it is now) is unfortunately not a 100% solution for capturing emulated games but it works well for most systems and games. The mame emulator is always under heavy development and a lot things may change but it is getting better with every new version. I am trying to show the current capture abilities as they are now. Mame was designed to emulate arcade systems/chipsets as accurate as possible. This strength is sometimes also it´s greatest weakness. First: Not all games run at 60fps. This is simply a lie! This will be the first problem you may encounter. Mame emulates the internal frequency and that means: A game like Ultimate Mortal Kombat will not run at 60fps but at 54.815170Hz. This is where the real capturing fun starts. 4245 out of 6930 mame 0122u2 games run at 60fps. I will show a virtualdub workaround to correct this to 60fps later in this guide. And I will also update this guide if another (mame internal) solution becomes available.

NeoGeo games crash during recording (under mame32 plus plus v0.119). I haven´t found out why but i am working on it. Everything else works fine. NeoGeo recording works in mame 0.122 but with input desyncs.


What you need:

   * Basically every newer mame built will do its job (e.g. 0.119 and newer). Newer, bugfixed versions are recommended.
     I am using Mame32 Plus Plus v0.119 in this guide because of its kaillera support and overall netplay popularity.
     Download it here.
   * The next tool you need is: AdvanceCOMP (a collection of recompression utilities for various mame files) download
   * Any virtualdub version to put your later results together. You can download the newest version here.
   * A bunch recorded input files. Remember: your inputfile version and mame version must match!Version missmatches
     will result in desyncs or won´t work at all!


OK Lets go!

First configure your mame and game settings as you wish. The video output does not depend on the video settings you have made so don´t worry to mess up the result. The output is always raw and unfilterd.

   *
     The default folder for input files is called inp. If your mame (like the mame version in this guide!) does not have one please create
     it and place your input files there when mame asks you to. When you chose to play and record input mame will ask you where to save
     the input file. Save it to the inp folder. Otherwise the later script won´t work.
   * The second thing you should do is a little but necessary modification in the default game properties window. Enable the Skip game
     info. It disables the annoying infoscreen upon startup. Some games need this to be enabled otherwise they desync. Ultimate
     Mortal Kombat 3 gave me a lot of trouble without this. But midway games are real troublemaker anyway.

Now you are set up and ready to do some input recording. I assume that you know how to play and record mame input so I am not going to explain this any further.

A simple recording example

You need to create a little batch file which does the entire capturing work for you. Here is an example. It is explained below.

This is the line for capturing Super Street Fighter 2 X. I´ve chosen this game as an example. What this batch file does is quite simple:

   * This batch script opens up your mame with your inputfile as an argument and does a playback of the
     stuff you have recorded previously.
   * The next thing it does is: It writes a mng video stream to your harddisk together with an uncompressed
     wave file. The mng stream is nothing more than a every frame of gameplay saved to a png file and then
     merged together to a mng file.
   * The resulting mng video stream can be found in your snap folder


Explanation in detail:

This basic commandline contains 8 arguments in order to work correctly. Each argument is explained below:

   * The 1st word is the name of your mame exe file. We are using Mame32 Plus Plus v0.119 so in
     this case its: mameppkgui.exe
   * The 2nd word (or argument) is the romset name of your game. I have captured
     Super Street Fighter 2 X so its romname is: ssf2xj You will find the corresponding
     romnames in the main list window.
   * The 3rd word is called an option switch. The -pb optionswitch tells your mame to
     open up a input file and start a playback.
   * The 4th word is the input file you want to record. My file is called: ssf2xj.inp
   * The 5th word is another option switch. The -mngwrite switch tells your mame to
     record your gameplay into a mng stream file.
   * The 6th word specifies the name of your mng stream file . My mng file is called: ssf2xj.mng
   * The 7th word is the last option switch. The -wavwrtie switch tells your mame to
     record sound to a uncompressed wave stream.
   * The last word specifies the name of your uncompressed wave file.

Writing your own batch file and recording

Writing your own batch files is simple. Just follow the above example line and replace it with your own romname and filenames. Follow the steps above and then save the resulting file in your mame folder where your mame exe is. Remember to save it as a batch file (extension: .bat). Something like: record.bat or ssf2xj-combo-01.bat for better workflow. Its up to you how you name it.


After you have finished your batch script launch it by doubleclicking on your batch file. The result should look like this:

Note: The gameplay will stutter during the whole recording process. It sure depends on your equipment but it is because mame still needs to emulate the game and the mng writing process is very cpu consuming. Don´t worry. The resulting video and audiostream will be fine. To end recording just close mame and you are done.


Converting the mng stream to editable video

You will find your mng file inside the snap folder and the wave inside the root folder of your mame. The mng stream file needs to be extracted to an usable png image sequence. AdvanceCOMP will do that work for us. Extract the contents of advancecomp-1.15-windows-pentium.zip into a folder.


The easiest way to deal with the next commandline commands is to copy your mng and wave file into your AdvanceCOMP folder. Next. Open a command prompt. You can do this by clicking on start then on run. The run window pops up: Type in cmd and hit enter or click ok.


Navigate to your AdvanceCOMP folder (in my case its: E:\mame-guide\advancecomp-1.15-windows-pentium\). Here is a little help on old DOS navigation. You can navigate by typing cd.. for a parent folder or cd somefolder to navigate to a desired subfolder. To change to another drive type E:\ or another letter. In my case its drive E. This depends on how your drives are named. Notice that my ssf2xj.mng and ssf2xj.wav are already copied into this folder.

Now the interesting part: To extract the png sequence type in: advmng.exe --extract yourfile.mng (in my case its advmng.exe --extract ssf2xj.mng)

The result should look like this. The window output shows numbered png images scrolling down. The advmng tool is extracting the png image sequence to your AdvanceCOMP folder. Just wait until the extraction stops and you are done. The number at the end of the extraction is the framerate of this mng stream. It may vary.

Remember the following:

   * Nearly all games run with 60fps which means: If your mng file duration is 2min the resulting png sequence will be:
     60 frames per second * 120 seconds = 7200 png files
   * If you are recording kaillera matchvideos or local ones make sure to have enough space on your hdd. Mng and the resulting png
     sequences tend to be very large. Their size is similar to uncompressed avi material.

Putting it all together

I am not going to do any detailed introduction on virtual dub. Just the things you need to know to complete this part. Open up virtual dub and choose the first!! png file of the sequence:


Virtualdub should import the sequence without problems. Then: Click on Audio and then on WAV Audio. This brings up a file select dialog. Select your recorded wav file and hit OK. The next thing you need to do is to setup the correct framerate of the footage. To do so click on Video then select Frame Rate. This step is important. The framerate depends on the frecuency of your game. I mentioned the framerate at the end of the mng extraction earlier.

   * If the number shows 60 then select the second option change frame rate to (fps) and change it to 60.
   * For all other odd numbers (like 59 if you capture cps2) select the third option and chose: change so video and audio durations match
     like in the screenshot shown below. Note that my screenshot shows a 59.634 framerate. This is absolutley ok because if you visit the mame
     database maws ( http://www.mameworld.net/maws/romset/ssf2xj ) and scroll down to frequency you will notice: The game runs at
     59.633333Hz. This is not an error. The game really runs at that frequency. A lot older games have such strange frequencies.

You can do additional work like resize the video, add some filter and do other editing. Remember: Uncompressed AVI files are very large! Try a lossless codec to preserve quality for further editing. Select file and then Save as AVI to save your footage.

If your framerate was 60 you are done. This is probably what you wanted in the first place Sit back and enjoy your crisp, fluid 60fps video footage. If your framerate was odd ( like 59.634 for CPS2 games ) then adjust it to match 60fps. Trust me you will not notice the difference between 59.634 and 60.


Contact, credits and final notes

If you have further questions or suggestions feel free to contact me: via MSN schwarzpantsu at hotmail.com via MIRC (quakenet) #hardedge via www.hardedge.org forums (subarashii) via www.cyberfanatix.com forums (schwarzpantsu)



Copyright (c) subarashii 2008