# RTSP Pull

OvenMediaEngine은 RTSP 스트림을 두 가지 방식으로 가져올 수 있습니다. 첫 번째 방법은 Stream Creation API를 사용하는 것이고, 두 번째 방법은 `OriginMap` 또는 `OriginMapStore`를 사용하는 것입니다. 지원되는 코덱은 H.264, AAC(ADTS)이며, 향후 더 많은 코덱이 추가될 예정입니다.

<table><thead><tr><th width="216.666748046875">Item</th><th>Description</th></tr></thead><tbody><tr><td>Container</td><td>RTP</td></tr><tr><td>Transport</td><td>UDP / TCP</td></tr><tr><td>Codec</td><td>H.264, H.265, Opus, AAC</td></tr></tbody></table>

## Configuration

### Bind

RTSP Pull은 클라이언트로 작동하므로 바인딩 설정이 필요하지 않습니다.

### Application

RTSP Pull 기능은 각 애플리케이션별로 활성화 또는 비활성화할 수 있습니다. 아래와 같이 구성하여 RTSP Pull 기능을 활성화할 수 있습니다. RTSP Pull 기능이 활성화되지 않은 애플리케이션에서 RTSP Pull 기능을 사용하려고 하면 애플리케이션을 찾을 수 없다는 오류 메시지가 표시됩니다.

```
<!-- /Server/VirtualHosts/VirtualHost/Applications/Application -->
<Providers>
    ...
    <RTSPPull />
    ...
</Providers>
```

## Pulling streams using the Stream Creation API

[Stream Creation API](/guide/ko-kr/features/rest-api/v1/virtual-host/application/stream.md#create-stream-pull)를 사용하여 RTSP 스트림을 Pull 방식으로 가져와 스트림을 생성할 수 있습니다. [REST API](/guide/ko-kr/features/rest-api.md) 사용 방법에 대한 자세한 내용은 해당 챕터를 참고하시기 바랍니다.

## Pulling streams using the OriginMapStore

OriginMapStore가 구성되어 있고 Redis 서버가 RTSP URL을 제공하는 경우, 재생 요청이 들어오면 OvenMediaEngine은 해당 RTSP URL을 Pull합니다. 자세한 내용은 [OriginMapStore](/guide/ko-kr/features/high-availability/clustering.md#originmapstore) 문서를 참고하시기 바랍니다.

## Pulling streams using the OriginMap

### Configuration

RTSP Pull은 OriginMap 설정을 통해 제공됩니다. OriginMap은 Edge 서버가 Origin 서버의 스트림을 가져오는 규칙입니다. Edge 서버는 RTSP 및 OVT(OvenMediaEngine에서 정의한 Origin-Edge 프로토콜)를 사용하여 Origin의 스트림을 가져올 수 있습니다. OVT에 대한 자세한 내용은 [Clustering](/guide/ko-kr/features/high-availability/clustering.md) 섹션을 참고하시기 바랍니다.

```markup
<!-- /Server/VirtualHosts -->
<VirtualHost>
    ...
    <Name>default</Name>

    <Origins>
        <Origin>
            <Location>/app_name/rtsp_stream_name</Location>
            <Pass>
                <Scheme>rtsp</Scheme>
                <Urls><Url>192.168.0.200:554/</Url></Urls>
            </Pass>
        </Origin>
    </Origins>
    ...
</VirtualHost>
```

위 설정의 예에서, 플레이어가 WebRTC 스트리밍을 위해\
`ws://{OvenMediaEngine Host}[:{Signaling Port}]/{App Name}/{RTSP Stream Name}`로 요청하면,\
`rtsp://192.168.0.200:554`에서 스트림을 가져와 WebRTC로 퍼블리시합니다.

{% hint style="warning" %}
`Location`에 설정된 App Name이 존재하지 않을 경우, OvenMediaEngine은 기본 설정으로 해당 애플리케이션을 생성합니다. 기본으로 생성된 애플리케이션에는 OPUS 인코딩 프로파일이 없기 때문에 WebRTC 스트리밍을 사용하려면 설정에 해당 애플리케이션을 추가해야 합니다.
{% endhint %}

### Event to trigger pulling

Pull 방식 Provider는 퍼블리셔의 스트리밍 요청에 의해 활성화됩니다. 기본적으로 클라이언트 재생이 30초 동안 없으면 자동으로 비활성화됩니다. 이 설정을 변경하려면 [Clustering](/guide/ko-kr/features/high-availability/clustering.md) 챕터를 참고하시기 바랍니다.

다음과 같은 URL로 재생 요청이 들어오면 Origin 설정에 따라 RTSP Pull이 동작합니다.

<table><thead><tr><th width="217">Protocol</th><th>URL</th></tr></thead><tbody><tr><td>WebRTC</td><td><code>ws[s]:://{OvenMediaEngine Host}[:{Signaling Port}]/{App Name}/{RTSP Stream Name}</code></td></tr><tr><td>LLHLS</td><td><code>http[s]://{OvenMediaEngine Host}[:{LLHLS Port}]/{App Name}/{RTSP Stream Name}/llhls.m3u8</code></td></tr></tbody></table>


---

# 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://ovenmediaengine-enterprise.gitbook.io/guide/ko-kr/features/live-source/rtsp-pull.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.
