Introduction
C3D is a binary file for biomechanics and motion capture. One file holds the 3D
positions of markers or computed points, frame by frame, together with analog signals
such as force platform and muscle (EMG) channels sampled in step with them, and named
parameters describing both. This page covers the public “3D Point” form of the format.
Some CAD programs use the .c3d extension for unrelated drawing
formats.
Structure
A file is a series of 512-byte blocks (256 words of 16 bits), numbered from 1. Each section starts on a block boundary.
| Section | Position |
|---|---|
| Header | Block 1 |
| Parameters | The block named in the first header byte, usually 2; at most 255 blocks |
| 3D and analog data | The block given by POINT:DATA_START; the last block is padded with zero bytes. There is no end marker |
Number formats
The fourth byte of the parameter section gives the processor type, which fixes byte order and the floating-point layout of the whole file. The common readers take the values 84 for Intel, 85 for DEC and 86 for SGI/MIPS.
| Type | Integers | 32-bit floats |
|---|---|---|
| Intel | Little-endian | IEEE, little-endian |
| DEC | Little-endian | DEC layout: with the stored bytes numbered 0 to 3, the little-endian IEEE bytes are 2, 3, 0 and 1, with 1 subtracted from the last of them when it is not zero |
| SGI/MIPS | Big-endian | IEEE, big-endian |
Integers were originally all signed. Since about 2004, values that can never be negative, such as counts and block numbers, are read as unsigned, with nothing in the file to say so. Name lengths and group and parameter numbers stay signed.
Header block
Words are numbered from 1; word n starts at byte offset 2(n − 1). Unlisted words are unused.
| Words | Content |
|---|---|
| 1 | First byte: block number of the parameter section. Second byte: 0x50 |
| 2 | Points in each 3D frame, as POINT:USED |
| 3 | Analog samples in each 3D frame, all channels together; 0 when there are none |
| 4, 5 | First and last frame numbers of the raw data the file was made from; not a reliable frame count |
| 6 | Longest interpolation gap, in frames |
| 7–8 | 3D scale factor, float: positive means 16-bit integer data, negative means float data |
| 9 | First block of the data section, unsigned |
| 10 | Analog samples per channel in each 3D frame; the number of channels is word 3 divided by word 10 |
| 11–12 | 3D frame rate in hertz, float |
| 148, 149 | The User Guide counts words 13 to 149 as unused, to be zero in new files and preserved in edited ones. ezc3d names these two a key-label flag and the first block of a key-label section, and only reads and writes them back |
| 150 | 0x3039 (12345) when event labels have four characters; older files use two |
| 151 | Number of header events, 0 to 18 |
| 153–188 | 18 event times, floats, in seconds; the first frame is 0.0 |
| 189–197 | 18 one-byte event flags: 1 on, 0 off |
| 199–234 | 18 four-character event labels, ASCII padded with spaces |
Header events are independent of the EVENT parameter group. They are
added at the end of the list, and deleting one moves the later ones down.
Parameter section
The section opens with four bytes. The first two mean something only in old files whose first word is the start of the parameters, and are otherwise ignored; the third is the number of parameter blocks; the fourth is the processor type. Group and parameter records follow from the fifth byte, in any order, and a parameter may come before its group.
| Field | Group record | Parameter record |
|---|---|---|
| Name length, signed byte | 1 to 127; negative means locked | The same |
| Number, signed byte | Group number, −1 to −127 | Number of the owning group, +1 to +127 |
| Name | Capitals, digits and underscore, starting with a letter | No UTF-8 |
| 16-bit offset | Distance to the next record, counted from the offset word itself; 0 marks the last record | |
| Data type, signed byte | Absent | −1 character, 1 byte, 2 16-bit integer, 4 float |
| Dimension count, byte | Absent | 0 (a single value) to 7 |
| Dimensions, one byte each | Absent | Size of each dimension |
| Values | Absent | Arrays in FORTRAN order, first index fastest |
| Description | One length byte, 0 to 255, then the text, which may be UTF-8 | |
In a character array the first dimension is the length of each string, and strings are
padded with spaces. Group numbers need not be consecutive and differ between files, so
parameters are found by group and name, written GROUP:NAME. Unknown
parameters should be preserved. Early software treated only the first six characters
of a name as significant. Applications may add groups of their own and may encrypt
their values; the format defines no encryption.
Data section
Frames follow one another. Each frame holds POINT:USED points in the
order of POINT:LABELS, then the analog samples taken during that frame:
header word 10 sets, each with one value for every channel in channel order. A file
may hold only points or only analog data. The sign of POINT:SCALE
chooses 16-bit integers or floats for both; float files are twice the size.
3D points
A point is four values: X, Y, Z and a combined residual and camera word. In an integer file the coordinates are multiplied by the scale factor. In a float file they are already scaled, and the fourth value is the signed integer word stored as a float.
| Part of the fourth word | Meaning |
|---|---|
| Negative (usually −1) | The point is not valid in this frame |
| Bit 15 | Sign |
| Bits 8–14 | One bit for each of cameras 1 to 7 that saw the point; bit 8 is camera 1 |
| Bits 0–7 | Residual, to be multiplied by the absolute value of POINT:SCALE. 0 marks a point that was interpolated, filtered or modelled, and then no camera bits are set |
The User Guide’s example: the word 0x3E10 with a scale of 0.0833333 means
cameras 2 to 6 and a residual of 1.333.
Analog samples
The physical value is (stored − ANALOG:OFFSET) × ANALOG:SCALE ×
ANALOG:GEN_SCALE, for integer and float files alike: float files normally keep
the unscaled converter reading. Samples are signed unless ANALOG:FORMAT
is UNSIGNED, which makes the offsets unsigned too. Signed data usually has
offset 0; typical unsigned offsets are 127 (8 bits), 2047 or 2048 (12), 8191 (14) and
32767 (16).
POINT parameters
| Parameter | Meaning |
|---|---|
USED | Points in each frame; required, 0 for none |
FRAMES | Number of frames, integer or float; see below |
LONG_FRAMES | Frame count as a float, written by C-Motion software |
SCALE | 3D scale factor, float; also scales residuals. For integer data the advice is at least the largest coordinate divided by 32000; it is not set to exactly −1 |
RATE | Frames each second |
DATA_START | First data block, unsigned; required even with no points |
LABELS, LABELS2, LABELS3 | Point names, originally four characters, 16 or fewer recommended; up to 255 in each, so further points go in the numbered parameters |
DESCRIPTIONS, DESCRIPTIONS2, DESCRIPTIONS3 | Text for each point, typically 32 characters |
UNITS | Four-character length unit such as mm; documentation only |
X_SCREEN, Y_SCREEN | The axes pointing right and up on screen, such as +X and -Z |
Long recordings
When POINT:FRAMES is not 65535 it is the frame count. Otherwise the count
comes from POINT:LONG_FRAMES or from Vicon’s TRIAL group:
ACTUAL_START_FIELD and ACTUAL_END_FIELD each hold two
unsigned words, low word first, and the count is end − start + 1. The group also
holds CAMERA_RATE. The User Guide combines the two words as
first + second × 65535, although a 32-bit value would use 65536. Writers use an
unsigned integer below 65535 frames and a float from 65535.
ANALOG parameters
| Parameter | Meaning |
|---|---|
USED | Number of channels, 0 for none |
RATE | Samples a second, the same for every channel |
GEN_SCALE | Scale applied to all channels, float |
SCALE | Scale for each channel, float |
OFFSET | Zero reading for each channel, integer |
LABELS, DESCRIPTIONS, UNITS | Name, text and unit for each channel |
FORMAT | SIGNED or UNSIGNED; absent means signed |
BITS | Converter resolution, 12, 14 or 16; assume 12 when absent |
LABELS2, DESCRIPTIONS2, SCALE2, OFFSET2, UNITS2 | Continuations for channels beyond 255 |
GAIN | Vendor addition: 0 unknown, 1 ±10 V, 2 ±5 V, 3 ±2.5 V, 4 ±1.25 V |
FORCE_PLATFORM parameters
| Parameter | Meaning |
|---|---|
USED | Number of platforms; present even when 0 |
TYPE | For each platform: 1 = channels FX FY FZ PX PY MZ; 2 = FX FY FZ MX MY MZ; 3 = eight sensor channels Fx1-2, Fx3-4, Fy1-4, Fy2-3 and Fz1 to Fz4; 4 = type 2 with a full calibration matrix. Vendors have added further types |
CHANNEL | Analog channel numbers, six or eight for each platform; eight for all if any is type 3, with unused entries 0 |
CORNERS | Floats, 3 × 4 × platforms, in point units: the corners in the plate’s quadrants +x+y, −x+y, −x−y, +x−y |
ORIGIN | Floats, 3 × platforms. Type 1: only the third value, from origin to surface. Types 2 and 4: vector from the plate’s origin to the centre of the working surface, Z normally negative. Type 3: sensor offset from the y axis, offset from the x axis, and origin-to-surface distance |
ZERO | Two frame numbers bounding the baseline, by default 1 and 10; 0, 10 is read as 1 to 10, and 0, 0 means none |
CAL_MATRIX | Floats, 6 × 6 × platforms, stored by columns; corrected values are the matrix times the measured channels in volts. Rows 1–3 give N per volt, rows 4–6 Nmm per volt. ezc3d takes an empty matrix, as some Motion Analysis files have, to be the identity |
FPCOPPOLY | Read by ezc3d for type 3: 12 floats for each platform, P0 to P11, correcting the centre of pressure (x, y) in the plate’s own frame. Subtract (P0 y⁴ + P1 y² + P2) x³ + (P3 y⁴ + P4 y² + P5) x from x, and (P6 x⁴ + P7 x² + P8) y³ + (P9 x⁴ + P10 x² + P11) y from y |
UNITS | Read by ezc3d as the force unit, N when absent; the moment unit is that followed by the point unit |
LABELS, DESCRIPTIONS | Name and text of each platform, as listed by the Biomechanical ToolKit (BTK) |
Force channel scales are entered as negative numbers so that the result is the
reaction force. For types 1 to 4, ezc3d reverses the whole ORIGIN vector
when its third value is positive.
Further platform types
The User Guide removed its brief descriptions of types 5, 6, 7, 11, 12 and 21 in 2020, saying that C-Motion had created them for internal calculations without documenting them in detail. BTK’s source summarises them as below; it processes types 1 to 5 and reports the others as unsupported, and ezc3d processes types 1 to 4 only.
| Type | BTK’s description |
|---|---|
| 5 | The eight sensor channels of type 3 with a calibration matrix given as 6 columns by 8 rows |
| 6 | 12 channels, FX, FY and FZ of sensors 1 to 4, with a 12 × 12 calibration matrix |
| 7 | The eight sensor channels of type 3 with an 8 × 8 calibration matrix |
| 11 | Kistler split-belt treadmill: 8 channels, an 8 × 8 calibration matrix, a 2 × 6 polynomial correction matrix, and a translation and rotation of the centre of pressure |
| 12 | Gaitway treadmill: 8 channels, Fz11 to Fz14 and Fz21 to Fz24, with an 8 × 8 calibration matrix |
| 21 | AMTI stairs: two platforms of 6 channels, a 6 × 6 calibration matrix, and data locating the corners of the four steps |
EVENT and EVENT_CONTEXT parameters
| Parameter | Meaning |
|---|---|
EVENT:USED | Number of events |
EVENT:CONTEXTS, LABELS, DESCRIPTIONS | Context (16 characters), name and text of each event |
EVENT:TIMES | Two floats for each event, whole minutes and seconds; frame 1 is 0.0 |
EVENT:SUBJECTS, ICON_IDS | Subject and icon of each event |
EVENT:GENERIC_FLAGS | Non-zero for general-purpose events |
EVENT_CONTEXT:USED, ICON_IDS, LABELS, DESCRIPTIONS | The list of contexts, such as General, Left, Right and Invalid |
EVENT_CONTEXT:COLOURS | Red, green and blue, 0 to 255, for each context |
Other groups
| Group | Content |
|---|---|
MANUFACTURER | COMPANY, SOFTWARE, VERSION (text or integers; some use VERSION_LABEL) and EDITED, an unlocked list of text entries |
SEG | Tracking settings, among them MARKER_DIAMETER, DATA_LIMITS (minimum and maximum XYZ), ACC_FACTOR (nominally 50), NOISE_FACTOR (nominally 10 mm), RESIDUAL_ERROR_FACTOR (2 to 3) and INTERSECTION_LIMIT (7 mm or less) |
ANALYSIS | Results such as gait measures, defined by each vendor |
SUBJECTS, older SUBJECT | Information about the people recorded, defined by each application |
Rotation extension
The ezc3d library reads segment rotations kept in a data area of their own. This is
not part of the User Guide. Nothing in the header block announces them: ezc3d looks for
rotation data when the parameter section has a ROTATION group, and then
requires DATA_START, USED and either RATIO or
RATE in it. The rotation figures that its Python interface lists under
the header are calculated from the group and the header frame numbers.
| Item | Content |
|---|---|
ROTATION:DATA_START | First block of the rotation data, so it starts at byte (value − 1) × 512. ezc3d writes the area after the point and analog data, from a new block |
ROTATION:USED | Number of rotations |
ROTATION:RATIO or RATE | Rotation samples in each point frame, given directly or as rotation samples a second, to be divided by the point frame rate |
ROTATION:LABELS | Names of the rotations, written and read by Kinetics Toolkit, which uses ezc3d |
| Order | For each point frame, RATIO samples, each holding USED rotations |
| Each rotation | 17 floats in the file’s processor format: a 4 × 4 matrix, column by column, then a reliability value, negative when invalid. ezc3d writes the 16 matrix values of an invalid rotation as not-a-number |
Divergence between sources
The two open-source readers disagree about the fourth point value. py-c3d follows the User Guide: the camera bits are in the high byte of the word and the residual in the low byte. ezc3d takes them the other way round: the camera bits from the low byte and the residual from the high byte, in its writer too, and it does not read MIPS point data. A program exchanging files between the two should check residuals against the values it expects. The Guide also gives both 127 and 255 as the longest parameter name, and calls Intel “processor type 1” where the readers expect 84.
Not described
Known, not yet covered
- Reference: the full list of
SEGparameters, given in the AMASS software manual, which was not obtained. - Reference: individual vendors’ parameters in
ANALYSIS,SUBJECTSand other application groups. - Reference: C-Motion’s own descriptions of rotation data and of force platform types above 4, in its documentation wiki, which refused automated reading; the parameter names that types 11 and 21 use for their extra data.
- Viewer: C3D files cannot be opened on this site.
Unknown
- Reference: the layouts of private forms of the format whose second header byte is not
0x50.
Links
Software
- C3D.org – the format’s home site, with documents and applications
Developers
- ezc3d – C3D library with Python and MATLAB bindings (C++; Windows, macOS, Linux)
- py-c3d – C3D reader and writer (Python)
- Biomechanical ToolKit – library with force platform processing for C3D data (C++)
- Kinetics Toolkit – biomechanics package that reads and writes C3D points, analog signals and rotations (Python)
Reference
- The C3D File Format, A Technical User Guide – Motion Lab Systems, updated 6 October 2021 (PDF)