mame recording/playback/encoding scripts for Linux and OS X

Thread in 'Research & Development' started by imiganai, 29 Mar 2011.

  1. For all you people not on Windows (although this would probably work with cygwin or the mingw environment):

    I recently developed a set of scripts to simplify recording, playing back, and encoding tgm2p sessions on MAME, and have posted them on GitHub, here.

    For recording, the scripts automatically date and allow you to tag or discard your TGM sessions when you close MAME.
    For playback, the scripts will list out all of your saved recordings for selection, with tab-completion.
    For encoding (this is the neat part), the scripts will run MAME unthrottled (I get about 240% playback speed), automatically close MAME at the end of the recorded input, encode in x264/faac at about 800 kbps (encodes at about 5x speed), and will (optionally) detect and crop the stream to the last game played. All user input is at the beginning of the script, so everything time-consuming happens at once without stopping.
    There's also a script for deleting saves.

    The script is designed for the TGM-modified shmupmame (probably works with other versions though), and requires ffmpeg with libx264 enabled for encoding and mplayer for the last-game scanning. If you don't want (or have) libx264, you can of course tweak the script, and if you don't have mplayer, you can simply not use the autocrop feature.

    I was unable to get mame to write to a named pipe (FIFO), so unfortunately it still writes the entire, huge AVI to disk before operating on it, which sucks. :(

    I don't really expect much to come of this, but am posting it here in the hopes that someone finds it useful. It doesn't require too much setup, but be sure to read the README. :)

    Let me know if there are any issues using it.

    tl;dr link
  2. clever, and somewhat more involved than my batch file setup on windows. I should really make some playback and encoding scripts.
  3. DeHackEd

    DeHackEd green Gm

    My Linux hacked MAME conforms to different encoding rules. But i haven't put it up for download for anybody else.

    Write two named pipes: audio and video. You can collect the audio as PCM or pipe it to an MP3/vorbis/AAC encoder, and pipe the video to mencoder to save as huffyuv/ffv1/other lossless codec, or go straight to x264.

    Advantages: no temporary files is possible, even for 2-pass mode. The only disk space used is a few megs for the 2pass log file, and the final AVI

    Disadvantages: true no-temp mode consumes a lot of RAM to prevent mencoder deadlocks. Some unix experience required.

    Does this pique anybody's interests, or should I just keep it to myself?
  4. I would be interested in a convenient way to record my games on OSX 10.6. I'm not sure I have enough unix experience though.
  5. Named pipe output is exactly what I wished MAME had. Unfortunately, unless the patch is folded into the official MAME (or one of the popular mods), it's probably not going to see much use...have you contacted any of the maintainers about it?

    The above scripts (and most linux scripts) should work. You'll need to use something like macports to install ffmpeg and mplayer.
  6. I recently discovered homebrew, which seems to me to work a lot better than MacPorts or Fink. There seem to be people with complaints about it, but it's worked for everything i've tried to install, and it doesn't install a whole lot of unnecessary packages like the other two do.
  7. I just forked tgm-record and updated it for the latest MAME and FFMPEG. I also changed it to output MP4, so you can immediately upload the video file to most services and websites:

Share This Page