A couple scripts to assist in automatically recording, playing back and encoding TGM2P sessions.
- A version of MAME that takes single-dash parameters. Or you can modify the script to use double-dash parameters.
- zenity for displaying the tag dialog in tgm-record if there is no terminal. Or you can just always run it in a terminal.
- ffmpeg with libx264 support enabled for encoding. Or you can modify the script to not use libx264.
- mplayer for searching for the last game in a record. Or you can just always encode the entire session and manually trim it or whatever.
- On macOS, you might need to set up mame.ini manually before MAME will work; I've prepared some template mame.ini files in another repository to help you get up and running.
- Set the MAMEROOT environment variable, or change mameroot at the top of each script.
- Tweak the tgm-launcher script to launch your games with the appropriate parameters. By default it supports tgm2p and tgmj without extra parameters.
- Modify the script in any additional ways required by the prerequisites above. If you already fulfil the prerequisites, you probably don't need to change anything here.
- Run tgm-record with the game name (e.g. tgm2p, tgmj) to play a game. Example:
$ tgm-record tgm2p
- When you quit MAME, you will be asked to "tag" the record, or discard it. Example tag:
> death_gm
- Each tagged record will also have the date and time in its filename.
- The latest discarded record is also kept, just in case.
- To play back, run tgm-playback with the game name. Example:
$ tgm-playback tgm2p
- It will list the recorded sessions available.
- Specify a record to play back. Tab-completion works.
- Answer any other questions it asks.
- The rest is entirely automated; it will run MAME, stop it when the input is finished, and process and encode the output.
- You can use tgm-delete with the game name to delete a saved record. Example:
$ tgm-delete tgmj
Unfortunately, MAME refuses to dump an AVI into a FIFO, so you must have enough space for the entire AVI file of the session you are playing back, which can be several gigabytes for long sessions. This is true even if you are only saving the last game, as that only affects the encoding phase. It is thus recommended that you restart MAME every couple of games to keep the records short.
Hopefully this can be resolved at some point.