Recording video in MAME

This is the main shmups forum. Chat about shmups in here - keep it on-topic please!
User avatar
RNGmaster
Posts: 2388
Joined: Mon Aug 02, 2010 9:08 pm
Location: Seattle, WA

Recording video in MAME

Post by RNGmaster »

Video recording in MAME is really hard for me. I tried to record a Ketsui run in Lagless, but it slowed the action to about 20 fps. Is there any fix for this?
User avatar
Keade
Posts: 385
Joined: Mon Jul 16, 2007 8:44 pm

Re: Recording video in MAME

Post by Keade »

I'd be surprised if there wasn't a thread on the subject.
Anyway :

1. Clear the contents of your NVRAM folder (this is needed for inputs playback consistency)
2. Start MAME while recording your gameplay to input record file (.inp). This is the -record command in MAME. MAME32 / MAMEUI have equivalents.
3. Play until you're done. You will see no difference in speed, the game will play absolutely fine unlike video recording : here MAME is only recording the input you pressed, and this is far much less information than a gameplay video.
4. Close MAME
5. Restart MAME to make it playback said inp (-playback command) while writting to a video file (-aviwrite) or writting a set of snapshots (-mngwrite)
6. Done (you can compress the video with your favorite video editing tools).
Last edited by Keade on Fri Dec 17, 2010 3:25 am, edited 2 times in total.
User avatar
Ruldra
Posts: 4222
Joined: Wed Mar 05, 2008 1:27 am
Location: Brazil

Re: Recording video in MAME

Post by Ruldra »

Alternatively, you can use a recording software like Hypercam 2. During INP playback, run the game in windowed mode and make the window as small as possible. Should make a smooth recording.
[Youtube | 1cc list | Steam]
mastermx wrote:
xorthen wrote:You guys are some hardcore MOFOs and masochists.
This is the biggest compliment you can give to people on this forum.
User avatar
Keade
Posts: 385
Joined: Mon Jul 16, 2007 8:44 pm

Re: Recording video in MAME

Post by Keade »

That works too, but if your computer's hard drive suddenly can't keep up when writing video data (because some background task suddenly slowed down your computer for instance), I think this part of the video may end messed up. I think this would be less likely an issue when MAME is directly writing the video/audio on disc.
If, on the contrary, your hard drive is fast and would be capable of writing the video faster than in real time, you can toggle throttle in MAME to make the video recording be done faster, and spare some time.

edits : many grammar corrections
Last edited by Keade on Fri Dec 17, 2010 3:13 am, edited 1 time in total.
Lance Boyle
Posts: 243
Joined: Thu Nov 11, 2010 7:30 pm

Re: Recording video in MAME

Post by Lance Boyle »

Kaede wrote:6. Done (you can compress the video with your favorite video editing tools).
What do you use?

500 MB for about 30 seconds of gameplay is pretty harsh.
User avatar
Keade
Posts: 385
Joined: Mon Jul 16, 2007 8:44 pm

Re: Recording video in MAME

Post by Keade »

I don't know much about video editing tools, couldn't really recommend what to use.

You may want to try to write MNG files instead of an uncompressed video. I think MNG files are compressed, so it should take a bit less space.
If using MNG only, don't forget to output audio separately (-wavwrite command)
User avatar
Ruldra
Posts: 4222
Joined: Wed Mar 05, 2008 1:27 am
Location: Brazil

Re: Recording video in MAME

Post by Ruldra »

Hypercam 2 records videos in compressed mode already, by the way. I use it to record my stuff and then use Virtualdub for whatever editing I need to do.
[Youtube | 1cc list | Steam]
mastermx wrote:
xorthen wrote:You guys are some hardcore MOFOs and masochists.
This is the biggest compliment you can give to people on this forum.
User avatar
Bananamatic
Posts: 3530
Joined: Fri Jun 25, 2010 12:21 pm

Re: Recording video in MAME

Post by Bananamatic »

Turning on DirectDraw makes MAME work with Fraps as well.
Lance Boyle
Posts: 243
Joined: Thu Nov 11, 2010 7:30 pm

Re: Recording video in MAME

Post by Lance Boyle »

Bananamatic wrote:Turning on DirectDraw makes MAME work with Fraps as well.
It also makes the visuals really, really ugly and filtered.
User avatar
Kaiser
Posts: 1729
Joined: Mon Jun 12, 2006 10:20 am

Re: Recording video in MAME

Post by Kaiser »

Lance Boyle wrote:
Bananamatic wrote:Turning on DirectDraw makes MAME work with Fraps as well.
It also makes the visuals really, really ugly and filtered.
and FRAPS is a computer-consuming bitch. Not recommended for MAME recording.
Zenodyne R - My 2nd Steam Shmup
User avatar
emphatic
Posts: 7988
Joined: Mon Aug 18, 2008 3:47 pm
Location: Alingsås, Sweden
Contact:

Re: Recording video in MAME

Post by emphatic »

I did a Ketsui recording using these steps:

1.Run MAME with record option in my cabinet pc -> inp file (500kb)
2.Run MAME on my laptop with inp playback + avi write -> .avi file (14GB)
3. Use VirtualDub to resize the raw output (5:4 ratio) to 3:4 @ 480p -> .avi file (25GB)
4. Encode to .mp4 using Handbrake -> .mp4 file (400mb)
5. Uploaded to YouTube: http://www.youtube.com/watch?v=T6tbnLFcMIw

Pro: 60fps super smooth video with rich detail
Con: Game runs at 59.175fps, so video is slightly faster than actual gameplay.

Record to input (batch file)

Code: Select all

Shmupmame32_v22.exe ket -record ketsui.inp
(output input file to .avi file (uncompressed video)

Code: Select all

Shmupmame32_v22.exe ket -playback ketsui.inp -aviwrite Ketsui.avi
Image | My games - http://www.emphatic.se
RegalSin wrote:Street Fighters. We need to aviod them when we activate time accellerator.
Lance Boyle
Posts: 243
Joined: Thu Nov 11, 2010 7:30 pm

Re: Recording video in MAME

Post by Lance Boyle »

Holy crap encoding a 25GB file to 400 MB how long did that take you?
User avatar
austere
Posts: 680
Joined: Mon Mar 22, 2010 10:50 am
Location: USA

Re: Recording video in MAME

Post by austere »

You can combine steps 4 and 5. There's a compression settings window in virtualdub you can use. FFdshow can also do the aspect ratio correction for you (1:2 -> 3:4). Ideally it can be scripted using vdub.exe so that it can sit in the background without bothering you too much.

Nice run, btw.
<RegalSin> It does not matter, which programming language you use, you will be up your neck in math.
User avatar
emphatic
Posts: 7988
Joined: Mon Aug 18, 2008 3:47 pm
Location: Alingsås, Sweden
Contact:

Re: Recording video in MAME

Post by emphatic »

Lance Boyle wrote:Holy crap encoding a 25GB file to 400 MB how long did that take you?
About 1 hour on a crappy slow laptop.
austere wrote:You can combine steps 4 and 5. There's a compression settings window in virtualdub you can use. FFdshow can also do the aspect ratio correction for you (1:2 -> 3:4). Ideally it can be scripted using vdub.exe so that it can sit in the background without bothering you too much.
I have never quite figured out how to output h264 files from VirtualDub, that's why I added the Handbrake step (it's just super-easy in that app). I find that h264 is much better liked by YouTube for some reason and will upload faster (or it's just me).
austere wrote:Nice run, btw.
Thanks. I'm a bit rusty after taking quite a long break from Ketsui, but some moves are still working.
Image | My games - http://www.emphatic.se
RegalSin wrote:Street Fighters. We need to aviod them when we activate time accellerator.
User avatar
Bananamatic
Posts: 3530
Joined: Fri Jun 25, 2010 12:21 pm

Re: Recording video in MAME

Post by Bananamatic »

Lance Boyle wrote: It also makes the visuals really, really ugly and filtered.
Haven't noticed any difference myself...
User avatar
RNGmaster
Posts: 2388
Joined: Mon Aug 02, 2010 9:08 pm
Location: Seattle, WA

Re: Recording video in MAME

Post by RNGmaster »

emphatic wrote: Record to input (batch file)

Code: Select all

Shmupmame32_v22.exe ket -record ketsui.inp
(output input file to .avi file (uncompressed video)

Code: Select all

Shmupmame32_v22.exe ket -playback ketsui.inp -aviwrite Ketsui.avi
Where do you put this code, and what do you do to activate the command? I'm only recording a bit of Stage 3, so I start from a savestate. If it automatically activates, can it be turned on and off?
Last edited by RNGmaster on Fri Dec 17, 2010 11:00 pm, edited 1 time in total.
Lance Boyle
Posts: 243
Joined: Thu Nov 11, 2010 7:30 pm

Re: Recording video in MAME

Post by Lance Boyle »

RNGmaster wrote:Where do you put this code, and what do you do to activate the command?
Command line, press ENTER.
User avatar
emphatic
Posts: 7988
Joined: Mon Aug 18, 2008 3:47 pm
Location: Alingsås, Sweden
Contact:

Re: Recording video in MAME

Post by emphatic »

Or put it into a Notepad document and save it as "filename of your choice.bat" (you'll need to change the document type from "text" to "all" for it to not save it as just a .txt file) in the same folder as ShmupMAME. Then you can just double-click one of them to start either an .inp recording, or open a Ketsui.inp and write it to .avi. You'll need to remove any existing ketsui.inp in your inp folder each time you wanna start a new recording though.
Image | My games - http://www.emphatic.se
RegalSin wrote:Street Fighters. We need to aviod them when we activate time accellerator.
User avatar
Seahawk
Posts: 189
Joined: Sun Jan 24, 2010 7:33 pm

Re: Recording video in MAME

Post by Seahawk »

emphatic wrote:Or put it into a Notepad document and save it as "filename of your choice.bat" (you'll need to change the document type from "text" to "all" for it to not save it as just a .txt file) in the same folder as ShmupMAME. Then you can just double-click one of them to start either an .inp recording, or open a Ketsui.inp and write it to .avi. You'll need to remove any existing ketsui.inp in your inp folder each time you wanna start a new recording though.
This is what I do, but I add an extra line to delete the old input.

To record, make a batch file with this:

Code: Select all

del inp\new.inp
mame 'setname' -record new.inp
I'm have restart syndrome bad, so when I am dissatisfied with any run I just exit immediately and hit the batch file again. If I do good enough then I go into the inps folder and rename new.inp to something more meaningful. To good part about this is that if there is no file named new.inp it won't crash.

To dump video:

Code: Select all

mame 'setname' -playback XXXX.inp -aviwrite XXXX.avi
XXXX - file name of relevant file

If possible I recommend dumping the video to a secondary hard drive, it will speed things up greatly. Also, make sure frameskip is ZERO (0) otherwise you will get very choppy video. This takes longer but it's worth it.
zakk
Posts: 1407
Joined: Wed Jan 26, 2005 6:04 am
Location: New York, NY
Contact:

Re: Recording video in MAME

Post by zakk »

There are two restart commands in mame, F3 and shift-F3. If you shift-F3 it will completely restart and the inp file will start over too. So you can just use that to restart and not have to fully exit. Your inp will only contain the gameplay from the last time you hit shift-F3

Also notable is you want to use shift-F3 when you're playing stuff like gunbird/Strikers that have a 'random' stage order that's always fixed on first boot. If you just F3 it'll doesn't revert to the initial power on state.
Seahawk wrote: I'm have restart syndrome bad, so when I am dissatisfied with any run I just exit immediately and hit the batch file again. If I do good enough then I go into the inps folder and rename new.inp to something more meaningful. To good part about this is that if there is no file named new.inp it won't crash.
User avatar
emphatic
Posts: 7988
Joined: Mon Aug 18, 2008 3:47 pm
Location: Alingsås, Sweden
Contact:

Re: Recording video in MAME

Post by emphatic »

zakk wrote:There are two restart commands in mame, F3 and shift-F3. If you shift-F3 it will completely restart and the inp file will start over too. So you can just use that to restart and not have to fully exit. Your inp will only contain the gameplay from the last time you hit shift-F3
Awesome, thanks!
Image | My games - http://www.emphatic.se
RegalSin wrote:Street Fighters. We need to aviod them when we activate time accellerator.
User avatar
Drum
Banned User
Posts: 2116
Joined: Sun Feb 07, 2010 4:01 pm

Re: Recording video in MAME

Post by Drum »

Ugh, I wanted to do a Space Harrier scoring run but those file sizes are way too rich for my blood. Any way to just record at low-level youtube quality without a seperate compression process?
IGMO - Poorly emulated, never beaten.

Hi-score thread: http://shmups.system11.org/viewtopic.php?f=2&t=34327
User avatar
ED-057
Posts: 1560
Joined: Fri Jan 28, 2005 7:21 am
Location: USH

Re: Recording video in MAME

Post by ED-057 »

I did some recording from MAME by using the MNG option. The file was roughly 1MB/second (depends heavily on the resolution and color depth of the actual game though). I used advmng from AdvanceCOMP package to break it up into a bunch of PNG files and then converted those to an AVI with virtualdub. I don`t see a way to enable writing both the mng and wav from the gui, so -mngwrite and -wavwrite command line options would have to be used. Frame skipping should be disabled. Fast CPU is needed.
User avatar
GaijinPunch
Posts: 15872
Joined: Mon Jan 31, 2005 11:22 pm
Location: San Fransicso

Re: Recording video in MAME

Post by GaijinPunch »

Do the commands generally work for Mame32 and MameFX?
RegalSin wrote:New PowerPuff Girls. They all have evil pornstart eyelashes.
User avatar
ED-057
Posts: 1560
Joined: Fri Jan 28, 2005 7:21 am
Location: USH

Re: Recording video in MAME

Post by ED-057 »

A quick test shows that it works on mame plus .106, but lagless mame 1.5 crashes, and versions .99 and older don`t have the mng option. (doesn`t exactly answer the question, sorry)
User avatar
RNGmaster
Posts: 2388
Joined: Mon Aug 02, 2010 9:08 pm
Location: Seattle, WA

Re: Recording video in MAME

Post by RNGmaster »

One question here. The program you give records the inputs, but in random sections (like Stage 3 of DDP) a movement path that works one time could fail if the RNG puts bullets in different places. Unless the random attacks show up in exactly the same place (or if recording input also records bullet trajectories) when I playback the input, I could run into a bullet.

If I was doing the Stage 2 boss' last pattern in Progear, for example, I could record input and dodge the attack flawlessly. But if I were to playback the input, and the game spit out a new randomly-generated pattern, you can see that the input recording wouldn't do me much good. Unless the game spits out exactly the same bullets, input recording is not very helpful.
User avatar
emphatic
Posts: 7988
Joined: Mon Aug 18, 2008 3:47 pm
Location: Alingsås, Sweden
Contact:

Re: Recording video in MAME

Post by emphatic »

RNGmaster wrote:One question here. The program you give records the inputs, but in random sections (like Stage 3 of DDP) a movement path that works one time could fail if the RNG puts bullets in different places. Unless the random attacks show up in exactly the same place (or if recording input also records bullet trajectories) when I playback the input, I could run into a bullet.

If I was doing the Stage 2 boss' last pattern in Progear, for example, I could record input and dodge the attack flawlessly. But if I were to playback the input, and the game spit out a new randomly-generated pattern, you can see that the input recording wouldn't do me much good. Unless the game spits out exactly the same bullets, input recording is not very helpful.
If your playback file isn't working, then either your nvram file is corrupt or you are using a different MAME build to play it back. There is no such thing as "random patterns" with MAME and inputs. Only human error when playing it back.
Image | My games - http://www.emphatic.se
RegalSin wrote:Street Fighters. We need to aviod them when we activate time accellerator.
User avatar
Keade
Posts: 385
Joined: Mon Jul 16, 2007 8:44 pm

Re: Recording video in MAME

Post by Keade »

^Exactly, (most) games don't have a truly random number generation because the "randomness" is based on timers and/or user input, which are consistent from one playback to another.

Some games do have INP replayability issues but it is rather rare (and Cave games don't have too many problems afaik).
If you encounter such issues you may find info at MARP.
User avatar
RNGmaster
Posts: 2388
Joined: Mon Aug 02, 2010 9:08 pm
Location: Seattle, WA

Re: Recording video in MAME

Post by RNGmaster »

emphatic wrote: If your playback file isn't working, then either your nvram file is corrupt or you are using a different MAME build to play it back. There is no such thing as "random patterns" with MAME and inputs. Only human error when playing it back.
I didn't know how MAME computed "random" patterns. So, if I'm following, that means that if I do EXACTLY the same thing every time I play, then the game will use the exact same patterns, even with ones that seem to be randomly chosen.
User avatar
emphatic
Posts: 7988
Joined: Mon Aug 18, 2008 3:47 pm
Location: Alingsås, Sweden
Contact:

Re: Recording video in MAME

Post by emphatic »

RNGmaster wrote:
emphatic wrote:So, if I'm following, that means that if I do EXACTLY the same thing every time I play, then the game will use the exact same patterns, even with ones that seem to be randomly chosen.
It depends, are you a computer controlled robot? :lol:
Image | My games - http://www.emphatic.se
RegalSin wrote:Street Fighters. We need to aviod them when we activate time accellerator.
Post Reply