# Capture

## Usage

    capture.exe <feed_number> [device_index]
    capture.exe --help

Argument | Description
--- | ---
`feed_number` | Which feed to write to: 0, 1, or 2 (required)
`device_index` | USB device index (default: same as feed_number)

## Description

Each capture instance reads video from one USB HDMI capture device using Windows Media Foundation. It converts from the device's native format (YUV422/NV12) to planar YUV420 and writes frames into the shared memory circular buffer for its feed.

## What It Does

1. Opens the specified USB video device via Media Foundation
2. Requests 1920x1080 at 60fps
3. For each frame:
   - Converts YUV422 or NV12 to planar YUV420
   - Crops to 540 lines with configurable vertical offset
   - Writes to the next slot in the circular buffer
   - Signals motion detection via IPC

## Device Numbering

Windows assigns device indices starting from 0 as it discovers USB video devices. The order depends on which USB controller they are connected to. If device 0 corresponds to camera feed 1, specify:

    capture.exe 1 0

This writes to feed 1 using USB device 0.

Tip: Run with no arguments to see the usage message, which lists detected USB video devices.

## See Also

- File Player — Alternative input for testing
- Hardware Setup — USB controller requirements
- Controller — Starting capture via the UI