# ABR

## Adaptive Bitrate Streaming (ABR)

v0.14.0 버전부터 OvenMediaEngine은 동일한 소스를 여러 비트레이트의 Rendition으로 인코딩하여 플레이어에 전달할 수 있습니다.

아래 예제 설정과 같이 `<OutputProfile>`에 `<Playlists>`를 추가하면 ABR을 구성할 수 있습니다. 여러 개의 Playlist를 생성할 수 있으며, 각 Playlist는 `<FileName>`을 통해 접근할 수 있습니다.

LLHLS를 통해 Playlist에 접근하는 방법은 다음과 같습니다.

`http[s]://<domain>[:port]/<app>/<stream>/`**`<FileName>`**`.m3u8`

HLS를 통해 Playlist에 접근하는 방법은 다음과 같습니다.

`http[s]://<domain>[:port]/<app>/<stream>/`**`<FileName>`**`.m3u8?format=ts`

WebRTC를 통해 Playlist에 접근하는 방법은 다음과 같습니다.

`ws[s]://<domain>[:port]/<app>/<stream>/`**`<FileName>`**

`<FileName>`에는 `playlist` 또는 `chunklist`와 같은 문자열을 포함해서는 안 됩니다. 이는 시스템 내부에서 예약어로 사용되기 때문입니다.

`<Rendition>`을 설정하려면 `<Encodes>` 요소에 `<Name>`을 추가해야 합니다. 설정된 `<Name>`을 `<Rendition><Video>` 또는 `<Rendition><Audio>`에 연결하세요.

아래 예시에서는 세 가지 품질의 렌디션이 제공되며, abr 재생 목록을 LLHLS로 재생하는 URL은 `https://domain:port/app/stream/abr.m3u8`이고 WebRTC 재생 URL은 `wss://domain:port/app/stream/abr`입니다.

{% hint style="info" %}
HLS에서 사용되는 TS 파일은 오디오/비디오가 미리 멀티플렉싱되어 있어야 하므로 재생 목록에서 `EnableTsPackaging` 옵션을 설정해야 합니다.
{% endhint %}

```xml
<OutputProfile>
	<Name>bypass_stream</Name>
	<OutputStreamName>${OriginStreamName}</OutputStreamName>
	<!--LLHLS URL : https://domain/app/stream/abr.m3u8 --> 
	<Playlist>
		<Name>For LLHLS</Name>
		<FileName>abr</FileName>
		<Options> <!-- Optional -->
			<!-- 
			Automatically switch rendition in WebRTC ABR 
			[Default] : true
			-->
			<WebRtcAutoAbr>true</WebRtcAutoAbr> 
			<EnableTsPackaging>true</EnableTsPackaging>
		</Options>
		<Rendition>
			<Name>Bypass</Name>
			<Video>bypass_video</Video>
			<Audio>bypass_audio</Audio>
		</Rendition>
		<Rendition>
			<Name>FHD</Name>
			<Video>video_1280</Video>
			<Audio>bypass_audio</Audio>
		</Rendition>
		<Rendition>
			<Name>HD</Name>
			<Video>video_720</Video>
			<Audio>bypass_audio</Audio>
		</Rendition>
	</Playlist>
	<!--LLHLS URL : https://domain/app/stream/llhls.m3u8 --> 
	<Playlist>
		<Name>Change Default</Name>
		<FileName>llhls</FileName>
		<Rendition>
			<Name>HD</Name>
			<Video>video_720</Video>
			<Audio>bypass_audio</Audio>
		</Rendition>
	</Playlist> 
	<Encodes>
		<Audio>
			<Name>bypass_audio</Name>
			<Bypass>true</Bypass>
		</Audio>
		<Video>
			<Name>bypass_video</Name>
			<Bypass>true</Bypass>
		</Video>
		<Audio>
			<Codec>opus</Codec>
			<Bitrate>128000</Bitrate>
			<Samplerate>48000</Samplerate>
			<Channel>2</Channel>
		</Audio>
		<Video>
			<Name>video_1280</Name>
			<Codec>h264</Codec>
			<Bitrate>5024000</Bitrate>
			<Framerate>30</Framerate>
			<Width>1920</Width>
			<Height>1280</Height>
			<Preset>faster</Preset>
		</Video>
		<Video>
			<Name>video_720</Name>
			<Codec>h264</Codec>
			<Bitrate>2024000</Bitrate>
			<Framerate>30</Framerate>
			<Width>1280</Width>
			<Height>720</Height>
			<Preset>faster</Preset>
		</Video>
	</Encodes>
</OutputProfile>
```

## Supported codecs by streaming protocol

여러 코덱을 설정하더라도 OME가 지원하는 각 스트리밍 프로토콜에 맞는 코덱이 정해져 있으므로, 프로토콜에 맞는 코덱을 자동으로 선택하여 스트리밍할 수 있습니다. 하지만, 사용하려는 스트리밍 프로토콜에 맞는 코덱을 설정하지 않으면 스트리밍이 되지 않습니다.

다음은 각 스트리밍 프로토콜에 해당하는 코덱 목록입니다:

| Protocol | Supported Codec   |
| -------- | ----------------- |
| WebRTC   | VP8, H.264, Opus  |
| LLHLS    | H.264, H.265, AAC |

따라서 표에 나와 있는 대로 설정해야 합니다. LLHLS를 사용하여 스트리밍하려면 H.264, H.265 및 AAC를 설정해야 하며, WebRTC를 사용하여 스트리밍하려면 Opus를 설정해야 합니다.

또한, 모든 플랫폼에서 WebRTC를 사용하려면 VP8과 H.264를 모두 구성해야 합니다. 브라우저마다 지원하는 코덱이 다르기 때문입니다(예: VP8만 지원, H.264만 지원, 또는 둘 다 지원).

하지만 걱정하지 마십시오. 코덱을 올바르게 설정하기만 하면 OME가 브라우저에서 요청하는 코덱의 스트림을 자동으로 전송합니다.


---

# 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/transcoding-and-processing/abr.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.
