# File Player

## Usage

    fileplayer.exe <feed_number> <video_file> [frame_offset]
    fileplayer.exe --help

Argument | Description
--- | ---
`feed_number` | Which feed to write to: 0, 1, or 2 (required)
`video_file` | Path to video file (required)
`frame_offset` | Skip this many frames before writing (for feed alignment)

## Description

The file player reads recorded video and writes it into a feed's shared memory, simulating a live camera. This is essential for:

- Testing the full pipeline without hardware
- Training new operators on distance measurement
- Calibrating grid lines using known recorded jumps
- Debugging motion detection settings

## Supported Formats

Extension | Format | Method
--- | --- | ---
`.mp4`, `.mkv`, `.avi`, `.mov` | Compressed video | Media Foundation (decoded to NV12)
`.yuv420`, `.i420` | Raw YUV420 planar | Direct read
Other | Raw YUV422 packed | Direct read + conversion

## Frame Alignment

When playing back multi-camera recordings, feeds may need different frame offsets to stay synchronized. Use the `frame_offset` argument:

    fileplayer.exe 0 recording.mp4 8167
    fileplayer.exe 1 recording.mp4 6015
    fileplayer.exe 2 recording.mp4 5032

The player skips the specified number of frames at the start of the file before writing to shared memory.

## Playback Timing

Frames are paced at 60fps using high-resolution timers to match real-time capture speed. This ensures motion detection behaves identically to live operation.

## See Also

- Capture — Live camera input
- Motion Detection — Processes the played-back frames
- Quick Start — Testing without cameras