FCEUX
The all in one NES/Famicom Emulator
Home Download Documentation Versions Contact Links

FM2 Movie file format

FM2 is the movie capture format of FCEUX

FM2 file format description

FCEUX uses a new movie file format - .fm2

This differs from the previous FCE Ultra movie format (.fcm) in the following ways:

Format

FM2 consists of two parts: Header and Input Log.
The header is always in ASCII plain text format. It consists of several key-value pairs.
The input log section can be identified by it starting with a | (pipe).
The input log section can be either in ASCII plain text format or in binary format.
The input log section terminates at EOF, unless the length key is specified in header.
Newlines may be \r\n or \n.

Header

Key-value pairs consist of a key identifier, followed by a space separator, followed by the value text.
Value text is always terminated by a newline, which the value text does not include.
The value text is parsed differently depending on the type of the key.
The key-value pairs may be in any order, except that the first key must be version.

Integer keys (also used for booleans, with a 1 for true and 0 for false) must have a value that can be stored as int32:

String keys have values that consist of the remainder of the key-value pair line. As a consequence, string values cannot contain newlines.

Inputlog

The input log section consists of movie records either in the form of text lines or in the form of binary data.

Text format (default format):

Every frame of the movie is represented by line of text beginning and ending with a | (pipe).
The fields in the line are as follows, except when fourscore is used.

commands port0 port1 port2

Field commands is a variable length decimal integer which is interpreted as a bit field corresponding to miscellaneous input states which are valid at the start of the frame. Current values for this are:

The format of port0, port1, port2 depends on which types of devices were attached.

SI_GAMEPAD

SI_ZAPPER

SIFC_NONE

If a fourscore is used, then port0 and port1 are irrelevant and ignored.

The input types must all be gamepads, and each input log record must be in the following format:

commands RLDUTSBA RLDUTSBA RLDUTSBA RLDUTSBA port2
{commands, player1, player2, player3, player4, port2}

Binary format:

Input log section starts with a | (pipe).
Every frame of the movie is represented by a record of a fixed length which can be determined by the devices on port0 and port1.

The first byte of each record stores "commands" bit field.

The remaining bytes in the record depend on which types of devices are attached to port0 and port1.

SI_GAMEPAD

SI_ZAPPER

SIFC_NONE

If a fourscore is used, then port0 and port1 are irrelevant and ignored. 4 bytes are added to the size of record. The bits of the 1st byte represent the state of buttons of the 1st joypad (bit0 = A, bit1 = B, bit2 = Select, bit3 = sTart, bit4 = Up, bit5 = Down, bit6 = Left, bit7 = Right); bits of the 2nd byte represent the state of buttons of the 2nd joypad, and so on.

Notes

All movies start from power-on, unless a savestate key-value is present

The emulator uses these framerate constants: