Mame Video Capturing

Aus Hardedge Wiki
Wechseln zu: Navigation, Suche


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 real pain. 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 combomakers to try theses new grounds.
  • 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

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. You may have heard this sentence: All games run at 60fps. This is simply false information! And it will be the first problem you will encounter when capturing with mame. Mame emulates the internal system 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.


Knowledge and skills

  • Basic understanding of mame and emulation in generall
  • dos navigation and writing basic batch files


  • MAMEUI32: It is recommended to use the default MAME builds. But every newer build will do its job (e.g. 0.119 or newer). Newer, bugfixed versions are recommended. I am using the newest MAMEUI32 version (0.129) available. Download.
  • Roms: Small reminder on roms: This guide does not provide any information where to get roms. Plus you are only allowed to use this emulator and roms if you own the original game!
  • AdvanceCOMP: This is a collection of recompression utilities for various mame files. Download. This toolset is needed if you are using the mngwrite/wavwrite capturing method.
  • VirtualDub: Version 1.8.0 or higher recommended. Download
  • Lagarith Lossless Codec: Lagarith is a lossless video codec intended for editing and archiving. We will be using this codec to preserve the higherst possible quality. Download.
  • Recorded input files: Your inputfile version and mame version must match. Version missmatches will result in desyncs or won´t work at all.

Setting up the capture environment

Installing the Lagarith video codec

Installing lagarith is very simple. Just unpack the zip file and rightclick the file lagarith.inf and choose install. The installer will copy the files in the appropriate location.

VideoEdit Installing Lagarith.png

Configuring Mame

  • 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 your capturing result. The output is always raw and unfilterd. Its recommended to run mame in a window.
  • The second thing you should do is a little but necessary modification in the default game properties window. Enable the Skip game info scren. It disables the infoscreen upon startup. Some games need this to be enabled otherwise the input playback desyncs.

VideoEdit Mame Default Options.png

VideoEdit Skip Game Info.png

  • The default folder for your input files is called inp. If your mame does not have one create this folder it and place your input files there when mame asks you to. When you chose to play and record inputs mame will ask you where to save the input file. Save them to the inp folder. Otherwise the later batch script won´t work and you will have to set up different paths for your input folder inside the Mame Options. So it is better to work with the inp folder in the first place.

Recording Mame Inputs

To record inputs in mame simply rightclick your game and select: Play and Record Input

VideoEdit Record Input.png

Capturing Methods

Capturing with mngwrite/wavwrite (old & complicated method)


  • Note: This capturing method is for older mame versions which do not support avi recording. If you are using a up to date mame version please use the aviwrite method described below.
  • You need to create a windows batch file which does the entire capturing work for you. This is the line for capturing Super Street Fighter 2 Turbo. I´ve chosen this game as an example. What this batch file does is quite simple:
MameUI32.exe ssf2t -pb ssf2t.inp -mngwrite ssf2t.mng -wavwrite ssf2t.wav

Brief Explanation:

  • 1. This batch script opens up your mame with your inputfile as an argument and does a playback of the stuff you have recorded previously.
  • 2. The next thing it does is: It writes a mng videostream 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 picture and then merged together to a mng file.
  • 3. The resulting mng video stream can be found in your snap folder

Explanation in detail:

This basic commandline contains eight 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 MameUI32 so in this case its: MameUI32.exe
  • The 2nd word (or argument) is the romset name of your game. I have captured Super Street Fighter 2 Turbo so its romname is: ssf2t You will find the corresponding romnames in the main list window of your mame.
  • 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: ssf2t.inp
  • The 5th word is another option switch. The -mngwrite switch tells your mame to record your gameplay into a mng videostream file.
  • The 6th word specifies the name of your mng videostream file . My mng file is called: ssf2t.mng
  • The 7th word is the last option switch. The -wavwrite switch tells your mame to record sound to a uncompressed wave stream file.
  • The last word specifies the name of your uncompressed wave file. In this case: ssf2t.wav

Writing your own batch file and recording

Writing your own batch files is very simple:

  • Open up notepad
  • Just follow the above example line and replace it with your own rom and filenames. Follow the steps above and then save the resulting file in your mame folder where your mame exe is. Your line should look like this:

VideoEdit Writing Batch Files.png

  • Remember to save it as a batch file (extension: .bat) and not txt. Something like: capturing.bat or ssf2t-combo-01.bat for better workflow. Its up to you how you name it.

Launching the script

After you have finished your batch script launch it by doubleclicking on your batch file. The result should look like this. Please note: The gameplay will stutter during the whole recording process. It depends on your equipment but it is because mame still needs to emulate the game and the mng writing process is very cpu consuming. The resulting video and audiostream will be fine.

VideoEdit Capturing Result.jpg

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(where the mame exe is). 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 archive into a folder. The easiest way to deal with the next commandline commands is to copy your mng and wave file into your extracted AdvanceCOMP folder. Note: I am using a different version of Super Street Fighter 2 Turbo ind this example. Its the japanese version and is named ssf2jx instead of ssf2t.

VideoEdit AdvanceComp.png

  • 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.

VideoEdit Command Line.png

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.. to 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.

VideoEdit AdvanceComp Cmd.png

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

VideoEdit AdvanceComp Extract.png

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:

VideoEdit VirtualDub Image Import.png

  • Virtualdub should import the sequence without problems.
  • 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.

VideoEdit VirtualDub Framerate.png

  • 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 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.

Capturing with aviwrite (new & easy method)

This method follows a different new approach. Newer mame versions support a avi writing method to ease up things. Please take a look at these two sections before you read on. They explain the commandline structure and how to write own batch scripts for recording.


Instead of using this line([[Mame_Video_Capturing#Introduction: | from above example]):

MameUI32.exe ssf2t -pb ssf2t.inp -mngwrite ssf2t.mng -wavwrite ssf2t.wav

you have to change it into:

MameUI32.exe ssf2t -pb ssf2t.inp -aviwrite ssf2t.avi

The resulting file will be saved in your snap folder. It wil contain sound so there is no need to write a wave file inside the command line. This method is very easy to use.


You can do additional work like resize the video, add some filter and do other editing. Remember: Uncompressed video files are very large! Try a lossless codec like lagarith 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 IRC (quakenet) #hardedge

Copyright (c) subarashii 2008