# Camera IP

This function block reads RTSP/HTTP camera streams in a background thread and keeps the latest frame ready with minimal CPU overhead. It is designed for live monitoring and for feeding image processing blocks reliably even when network interruptions occur.

## 📥 Inputs <a href="#inputs" id="inputs"></a>

This function block does not have any inputs.

## 📤 Outputs <a href="#outputs" id="outputs"></a>

`Image` Current frame retrieved from the configured IP camera.

## 🕹️ Controls <a href="#controls" id="controls"></a>

`Status` — Displays the current connection state (examples: Waiting for camera link, Connecting..., Live, Reconnecting...).

`Camera link` — Paste the full RTSP/HTTP link for your camera (for example rtsp\://camera-ip/stream).

`Username` — Optional camera username when authentication is required.

`Password` — Optional camera password when authentication is required.

(hint) After editing the camera link or credentials the block waits a short moment before reconnecting so you can finish typing.

## 🎯 Key Features <a href="#features" id="features"></a>

* Background threaded reader that keeps the latest frame available for downstream blocks while using minimal CPU.
* Supports RTSP and HTTP camera links, with optional username/password authentication.
* Automatic status updates to indicate connection progress and issues.
* Automatic reconnect with increasing retry delays on failures.
* Keeps the last successful frame available while reconnect attempts are ongoing.
* Optional background frame uploader (when configured) to forward frames to a remote service.

## ⚙️ How it runs <a href="#running-mechanism" id="running-mechanism"></a>

* Provide a valid camera link in the `Camera link` control (and credentials if needed).
* The block will attempt to connect in the background and update the `Status` control.
* Once connected the block continuously keeps the most recent frame ready on the `Image` output for other blocks to consume.
* On connection problems the block shows status messages and performs automatic retry attempts; the most recent good frame remains available until a new one is received.

## 📝 Usage Instructions <a href="#usage" id="usage"></a>

1. Enter the camera URL in `Camera link`.
2. If the camera requires authentication, fill `Username` and `Password`.
3. Wait until `Status` shows a live/connected state.
4. Connect the `Image` output to downstream processing or visualization blocks.

Suggested downstream blocks:

* Use `Show Image` to preview frames in a viewer.
* Use `Image Resizer` or `Image Resize` if you need to reduce frame size before processing.
* Use `Record Video` or `Image Logger` to save frames or recordings.
* Feed into AI/analysis blocks such as `Object Detection`, `Object Detection - Custom`, `Pose Estimation`, or `Mask Detection` for live inference.
* Use `Image ROI Select` / `Image ROI Polygon` / `Image ROI Polygon Multi` to crop or limit processing area before detection.
* Use `Background Removal (RMBG-1.4)` or `Background Removal (BiRefNet)` if you need foreground extraction.
* Combine with `Object_Detection_Tracker` to maintain identities across frames.

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

* If your camera supports ONVIF and you prefer occasional snapshots instead of a stream, try `Camera IP (ONVIF)`.
* For faster processing pipelines, resolution in the Camera settings.
* To debug connectivity, verify the same URL in an external player (e.g., VLC) and confirm credentials.
* Use `Show Image` to verify the frame content before routing it into detection or logging blocks.
* When recording long sessions, prefer `Record Video` to avoid filling disk with many individual images; use `Image Logger` for selective frame saving.
* If you need to analyze only parts of the scene, crop with `Image ROI Select` or define polygons with `Image ROI Polygon Multi` to reduce false detections and speed up processing.
* Combine with `Object Detection` (or `Object Detection - Custom`) and then with `Object_Detection_Tracker` for monitored tracking and counting applications (for example feeding results into `Traffic Intersection Analysis`).

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

* No connection / status stuck on waiting: Verify the camera URL is correct and reachable on the network. Try the stream in an external player.
* Authentication errors: Double-check `Username` and `Password` and reenter them.
* Intermittent frames or reconnects: This can be caused by network instability or camera-side issues; the block will retry automatically. Consider connecting a more stable network or using a local recording if needed.
* Blank or unsupported frames: Use `Show Image` to inspect the output. If the viewer reports unsupported data, try a different stream format or use the camera vendor’s recommended URL.
* High CPU usage: If downstream processing is heavy, lower the resolution with `Image Resizer` or process frames at a lower rate by inserting throttling logic (for example a custom flow control).

If you need a different camera interface (USB, specialized camera drivers, or ONVIF snapshots), check the corresponding image input blocks such as `Camera USB` or `Camera IP (ONVIF)` to match your hardware and workflow.


---

# 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://docs.augelab.com/function-blocks/input-output/image-inputs/camera-ip.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.
