MXF Signature Format: Documentation & Recovery Example

Material Exchange Format (MXF) Format & Recovery Example

Material eXchange Format (MXF) is a container format for professional digital video and audio media defined by a set of SMPTE standards.

MXF is a "wrapper" format which supports a number of different streams of coded "essence", encoded in any of a variety of video and audio compression formats, together with a metadata wrapper which describes the material contained within the MXF file. MXF has been designed to address a number of problems with non-professional formats. MXF has full timecode and metadata support, and is intended as a platform-agnostic stable standard for future professional video and audio applications.

Material Exchange Format (MXF) files consist of consecutive blocks. Each block has 84 byte header, starting with a 4-byte signature (hex: 06 0E 2B 34), and having other parameters that need to be validated, including block size (big-endian, high byte first).

Iterating all blocks, until validation fails, we compose Material Exchange Format (MXF) Professional Video & Audio file.

Let's examine the sample

When inspecting sample.mxf file's binary data using any Hex Viewer, like Active@ Disk Editor we can see it starts with a signature, hex: 06 0E 2b 34 at offset 0, which defines MXF File Type. Next parameters, including version look valid. For the first block Footer Partition size is 619,008 (hex: 00 00 00 00 00 09 72 00, big-endian, high byte first). MXF Professional Video and Audio format - header inspection

The next block is located at the offset 619,008 (hex: 09 72 00). Material Exchange Format format - header inspection It starts with a proper signature (hex: 06 0E 2b 34), confirming the MXF file block. Next parameters, including version look valid. For the second and all other blocks size is defined as: ((FromBigEndian(Partition Length) & 0x00FFFFFF) + 20). For this particular block Partition Length in hex: 83 00 00 78. After conversion to litle-endian and removing high byte, hex: 78. Which is 120 bytes. Adding 20 and current block offset, calculating the next block offset, which is: 619,148 == 619,008 + 120 + 20 (hex: 00 09 72 8C). The third block is located at the offset 00 09 72 8C, has a valid signature and looks all other params look valid, so we can move to another block. Thus picking up all blocks we assemble MXF file, presuming data is not fragmented.

 

More info:

Material Exchange Format
MXF Technical Overview

MXF Files Header:

        struct _mxf_part {
                quint32  x00_Signature;                // Must be, hex: 06 0E 2B 34
                quint8   x04_CategoryDesignator;       // Must be 02
                quint8   x05_RegistryDesignator;       // Must be 05
                quint8   x06_StructureDesignator;      // Must be 01
                quint8   x07_VersionNumber;            // Must be 01
                quint8   x08_ItemDesignator;           // Must be 0D
                quint8   x09_Organization;
                quint8   x0A_Application;
                quint8   x0B_StructureVersion;
                quint8   x0C_OperationalPatternDefinition;
                quint8   x0D_PackKind;
                quint8   x0E_PartitionStatus;
                quint8   x0F_Reserved;
                quint32  x10_PartitionLength;           // All but first block size
                quint16  x14_MajorVersion;              // Must be, hex: 01 00 
                quint16  x16_MinorVersion;
                quint32  x18_SizeKAG;
                quint64  x1C_ThisPartition;
                quint64  x24_PreviousPartition;
                quint64  x2C_FooterPartition;           // First block size
                quint64  x34_HeaderByteCount;
                quint64  x3C_IndexByteCount;
                quint32  x44_IndexSID;
                quint64  x48_BodyOffset;
                quint32  x50_BodySID;
        };