# Media IO

Constructs to perform media IO.

## Summary

| ### Functions ||
|---|---|
| `https://docs.cloud.google.com/vision-ai/docs/reference/cpp/group/media-io#group__media__io_1ga1cfd35ab24cab23ab9ddac13d6d787ab(const ServiceConnectionOptions & options, absl::string_view stream_id, absl::string_view file_name)` | `absl::Status` Ingests an MP4 video file on the local file system named `file_name` into a stream of id `stream_id`. |
| `https://docs.cloud.google.com/vision-ai/docs/reference/cpp/group/media-io#group__media__io_1ga433f1815d32c410e809cd13bd885681d(const ServiceConnectionOptions & options, absl::string_view stream_id, absl::string_view rtsp_url)` | `absl::Status` Ingests an RTSP camera endpoint `rtsp_url` into a stream of id `stream_id`. |

## Functions

### IngestMp4

```c++
absl::Status IngestMp4(
  const ServiceConnectionOptions & options,
  absl::string_view stream_id,
  absl::string_view file_name
)
```
Ingests an MP4 video file on the local file system named `file_name` into a stream of id `stream_id`.

This call blocks until the file is fully ingested.

The file is ingested at the rate of its playback. For example, if the playback duration of the video is 1 minute, then this function will take 1 minute to complete.

Returns OK on success; otherwise, an error message telling why the ingestion could not complete successfully.

### IngestRtsp

```c++
absl::Status IngestRtsp(
  const ServiceConnectionOptions & options,
  absl::string_view stream_id,
  absl::string_view rtsp_url
)
```
Ingests an RTSP camera endpoint `rtsp_url` into a stream of id `stream_id`.

This call blocks and ingests the RTSP feed indefinitely. It may complete if the RTSP feed reaches the end, or is otherwise terminated for any reason.

Returns OK on success; otherwise, an error message telling why the ingestion could not complete successfully.