# UDP / TCP - Best

This method uses FFmpeg to stream video directly from OBS to the AI PC. It requires precise configuration.

### 1. OBS Video Configuration

First, set up the scene and resolution just like the NDI method.

1. Open OBS and go to **Settings > Video**.
2. **Base & Output Resolution:** Set both to `640x640`.
3. **FPS:** Set to **Fractional FPS**, with a numerator of `120` or higher.
4. **Scene:** Add a **Display Capture** source for your main monitor.
5. **Center:** Press `CTRL` + `D` to center the capture.
6. **Lock:** Right-click the preview and select **Lock Preview**.

### 2. FFmpeg Output Configuration

This is the critical step for network streaming.

1. Go to **Settings > Output**.
2. **Output Mode:** Set to **Advanced**.
3. Go to the **Recording** tab.
4. **Type:** Select **Custom Output (FFmpeg)**.
5. **FFmpeg Output Type:** Select **Output to URL**.

#### Configure the Stream Settings:

* **File path or URL:**
  * Replace `IPV4_ADDRESS_SECOND_PC` with the actual local IP of the PC running SpectraAI.
  * **Format:** `udp://IPV4_ADDRESS_SECOND_PC:1234?pkt_size=1316`
* **Container Format:** `mpjpeg`
* **Video Bitrate:** `3000 Kbps`
* **Keyframe interval (frames):** `1`
* **Video Encoder Settings:** `-preset ultrafast`

### 3. How to Start

The startup order depends on whether you are using UDP or TCP.

#### For UDP (Recommended):

1. In OBS, click **Start Recording**.
2. Then, start **SpectraAI**.

#### For TCP:

1. Start **SpectraAI** first (it needs to listen for the connection).
2. Then, in OBS, click **Start Recording**.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://spectra-2.gitbook.io/spectra-ai/use/capture-methods/udp-tcp-best.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
