# Publish via SRT

SRT (Secure Reliable Transport)는 Network 품질을 예측하기 어려운 환경에서도 Live Stream을 안정적으로 전송할 수 있도록 설계된 Protocol입니다. Packet loss나 Jitter가 발생하는 구간에서도 비교적 견고한 송출 품질을 기대할 수 있어, 현장 중계나 장거리 전송처럼 네트워크 변수가 큰 상황에서 특히 유용합니다.

사용자는 `SRT`로 Stream을 OvenMediaEngine Enteprise on AWS로 Publish할 수 있습니다. **Live 전송 시 Stream은 MPEG-2 TS 컨테이너로 수신**되며, 이 방식은 `RTMP`와 달리 다양한 Codec을 유연하게 수용하는 데 유리합니다. 또한, 필요에 따라 Simulcast 구성도 활용할 수 있습니다.

본 Guide에서는 SRT 기반 송출 절차와 송출 이후 기본 검증 방법을 순서대로 안내합니다.

<table><thead><tr><th width="151">Item</th><th>Supported</th></tr></thead><tbody><tr><td>Container</td><td>MPEG-2 TS</td></tr><tr><td>Transport</td><td>SRT</td></tr><tr><td>Codec</td><td>H.264, H.265, AAC</td></tr></tbody></table>

## SRT Publish 시작하기 <a href="#start-publishing-an-srt-stream" id="start-publishing-an-srt-stream"></a>

본 예제에서는 가장 보편적으로 사용되는 Live Encoder Software인 OBS Studio를 사용했습니다.

{% stepper %}
{% step %}

### Live Encoder로 송출 (OBS Studio) <a href="#publish-with-a-live-encoder" id="publish-with-a-live-encoder"></a>

<figure><img src="https://2184736704-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ6NWzeQyKbSWkDFSGwGx%2Fuploads%2FAEmmBcvIK83BsKsZSszG%2Fimage.png?alt=media&#x26;token=4ddc8444-ef26-474d-9761-31abd8ee19a8" alt=""><figcaption></figcaption></figure>

1. Open Broadcaster Software (OBS) Studio를 실행합니다.
   * OBS Studio가 설치되어 있지 않다면, 공식 링크 (<https://obsproject.com/download>)에서 다운로드하여설치하십시오.
2. 송출할 Media Source (또는 Camera, Screen Capture 등)를 추가합니다.
3. 이후 OBS 우측 하단의 <mark style="color:yellow;">\[Settings]</mark>를 클릭합니다.
   {% endstep %}

{% step %}

### OBS에서 스트리밍 설정 <a href="#configure-streaming-in-obs" id="configure-streaming-in-obs"></a>

<figure><img src="https://2184736704-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ6NWzeQyKbSWkDFSGwGx%2Fuploads%2Fqr9RsZB1GQjDmNnhvlYh%2Fimage.png?alt=media&#x26;token=ad847922-4e40-4131-9432-f2ba12ec0632" alt=""><figcaption></figcaption></figure>

4. Settings 화면 좌측에서, <mark style="color:yellow;">\[Stream]</mark> 탭을 선택합니다.
5. 그리고 <mark style="color:yellow;">\[Service]</mark>에서 <mark style="color:$primary;">**\[Custom]**</mark>을 선택한 뒤, <mark style="color:yellow;">Server</mark> 입력란에 SRT Ingress URL을 입력합니다.
   * SRT URL 형식: <mark style="color:$primary;">**`srt://`**</mark>`{Public IPv4 or Domain}:`<mark style="color:$primary;">**`9999?streamid=`**</mark>`{host}/{app}/{stream}`

{% hint style="info" %}
SRT Input 패턴을 모르는 경우, Web Conosle에서 \[Managed Stream]을 만든 후 <mark style="color:yellow;">\[URLs]</mark> 탭에서 확인할 수 있습니다.
{% endhint %}

<figure><img src="https://2184736704-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ6NWzeQyKbSWkDFSGwGx%2Fuploads%2FQgNg2uy8I4z7C72k7eTK%2Fimage.png?alt=media&#x26;token=4f49e019-9400-4159-8619-9d7383929870" alt=""><figcaption></figcaption></figure>

6. 이후 <mark style="color:yellow;">\[Output]</mark> 탭에서 원활한 초저지연 및 저지연 스트리밍을 위해 <mark style="color:$primary;">**`Keyframe Interval`**</mark>을 <mark style="color:$primary;">**1초**</mark>로, <mark style="color:$primary;">**`B-frames`**</mark>를 <mark style="color:$primary;">**0**</mark>으로 설정할 것을 권장합니다.

{% hint style="success" %} <mark style="color:yellow;">B-frames</mark>를 <mark style="color:yellow;">0</mark>으로 설정 (`bframes=0`)하는 이유는 `WebRTC` 최종 출력 시 끊김 현상을 방지하기 위함입니다.\
위 예시는 Encoder로 `x264`를 선택했을 때의 설정 화면이며, 다른 Encoder를 선택할 경우 표시되는 항목이나 세부 구성은 달라질 수 있습니다. <mark style="color:yellow;">`WebRTC`</mark><mark style="color:yellow;">를 최종 출력</mark>으로 사용하는 경우, <mark style="color:yellow;">B-frames는 0으로 설정하는 것을 권장</mark>합니다.
{% endhint %}

7. 필요에 따라 \[Audio], \[Video] 등 각 탭에서 세부 설정을 조정한 뒤, <mark style="color:yellow;">\[OK]</mark>를 클릭하여 OBS 메인 화면으로 돌아갑니다.
8. 모든 설정이 완료되었다면, <mark style="color:yellow;">\[Start Streaming]</mark>을 클릭하여 송출을 시작합니다.
   {% endstep %}

{% step %}

### Web Console에서 스트림 상태 및 재생 확인 <a href="#check-stream-status-and-playback-in-the-web-console" id="check-stream-status-and-playback-in-the-web-console"></a>

<figure><img src="https://2184736704-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ6NWzeQyKbSWkDFSGwGx%2Fuploads%2Fno4QYrqVX2WsYnsTtRQK%2Fimage.png?alt=media&#x26;token=978b62aa-b295-4ff4-acf5-881514a11cee" alt=""><figcaption></figcaption></figure>

9. <mark style="color:yellow;">Web Console</mark>에 OBS에서 송출한 Stream이 목록에 표시되는지 확인합니다.
   {% endstep %}
   {% endstepper %}
