이번에 영상 플레이어를 작업하면서 MPD 파일에 대해 알게 되어서 찾아보고 정리해보는 시간을 가져보자
MPEG-DASH MPD(Media Presentation Description)는 미디어 세그먼트에 대한 정보, 세그먼트 간의 관계 및 선택에 필요한 정보, 클라이언트에 필요할 수 있는 기타 메타데이터를 포함하는 XML 문서입니다.
이 게시물에서는 최상위 수준(기간)에서 시작하여 아래쪽(세그먼트)으로 이동하는 MPD의 가장 중요한 부분에 대해 설명합니다.
자세한 내용은 ISO에서 무료로 제공하는 최신 버전의 ISO/IEC 23009-1을 참조하십시오.
MPD 파일 예시
<?xml version="1.0"?>
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" profiles="urn:mpeg:dash:profile:full:2011"
minBufferTime="PT1.5S">
<!-- Ad -->
<Period duration="PT30S">
<BaseURL>ad/</BaseURL>
<!-- Everything in one Adaptation Set -->
<AdaptationSet mimeType="video/mp2t">
<!-- 720p Representation at 3.2 Mbps -->
<Representation id="720p" bandwidth="3200000" width="1280" height="720">
<!-- Just use one segment, since the ad is only 30 seconds long -->
<BaseURL>720p.ts</BaseURL>
<SegmentBase>
<RepresentationIndex sourceURL="720p.sidx"/>
</SegmentBase>
</Representation>
<!-- 1080p Representation at 6.8 Mbps -->
<Representation id="1080p" bandwidth="6800000" width="1920"
height="1080">
<BaseURL>1080p.ts</BaseURL>
<SegmentBase>
<RepresentationIndex sourceURL="1080p.sidx"/>
</SegmentBase>
</Representation>
</AdaptationSet>
</Period>
<!-- Normal Content -->
<Period duration="PT10M">
<BaseURL>main/</BaseURL>
<!-- Just the video -->
<AdaptationSet mimeType="video/mp2t">
<BaseURL>video/</BaseURL>
<!-- 720p Representation at 3.2 Mbps -->
<Representation id="720p" bandwidth="3200000" width="1280" height="720">
<BaseURL>720p/</BaseURL>
<!-- First, we'll just list all of the segments -->
<!-- Timescale is "ticks per second", so each segment is 1 minute
long -->
<SegmentList timescale="90000" duration="5400000">
<RepresentationIndex sourceURL="representation-index.sidx"/>
<SegmentURL media="segment-1.ts"/>
<SegmentURL media="segment-2.ts"/>
<SegmentURL media="segment-3.ts"/>
<SegmentURL media="segment-4.ts"/>
<SegmentURL media="segment-5.ts"/>
<SegmentURL media="segment-6.ts"/>
<SegmentURL media="segment-7.ts"/>
<SegmentURL media="segment-8.ts"/>
<SegmentURL media="segment-9.ts"/>
<SegmentURL media="segment-10.ts"/>
</SegmentList>
</Representation>
<!-- 1080p Representation at 6.8 Mbps -->
<Representation id="1080p" bandwidth="6800000" width="1920"
height="1080">
<BaseURL>1080/</BaseURL>
<!-- Since all of our segments have similar names, this time
we'll use a SegmentTemplate -->
<SegmentTemplate media="segment-$Number$.ts" timescale="90000">
<RepresentationIndex sourceURL="representation-index.sidx"/>
<!-- Let's add a SegmentTimeline so the client can easily see
how many segments there are -->
<SegmentTimeline>
<!-- r is the number of repeats _after_ the first one, so
this reads:
Starting from time 0, there are 10 (9 + 1) segments
with a duration of (5400000 / @timescale) seconds. -->
<S t="0" r="9" d="5400000"/>
</SegmentTimeline>
</SegmentTemplate>
</Representation>
</AdaptationSet>
<!-- Just the audio -->
<AdaptationSet mimeType="audio/mp2t">
<BaseURL>audio/</BaseURL>
<!-- We're just going to offer one audio representation, since audio
bandwidth isn't very important. -->
<Representation id="audio" bandwidth="128000">
<SegmentTemplate media="segment-$Number$.ts" timescale="90000">
<RepresentationIndex sourceURL="representation-index.sidx"/>
<SegmentTimeline>
<S t="0" r="9" d="5400000"/>
</SegmentTimeline>
</SegmentTemplate>
</Representation>
</AdaptationSet>
</Period>
</MPD>
<Period>
는 최상위 MPD엘리먼트를 포함하고, 컨텐트의 일부 시작 시간과 지속 시간을 설명합니다<AdaptationSets>
은 미디어 스트림 또는 미디어 스트림세트를 포함한다Adaptation Sets
으로 분할할 수 있습니다.Adaptation Sets
와 여러 오디오 Adaptation Sets
(지원되는 각 언어에 대해 하나씩)가 있는 것입니다. Adaptation Sets
에는 자막이나 임의의 메타데이터도 포함될 수 있습니다.Representations
을 통해 AdaptationSets
는 다른 방식으로 인코딩된 동일한 콘텐츠를 포함할 수 있습니다.Representations
은 다양한 화면 크기와 대역폭으로 제공됩니다.Representations
은 다른 코덱으로 인코딩할 수도 있으며, 다른 지원 코덱(브라우저에서 발생하는 것처럼 일부는 MPEG-4 AVC/h.264를 지원하고 일부는 VP8을 지원함)을 가진 클라이언트를 지원하거나 더 높은 품질의 표현을 새로운 클라이언트에 제공하는 동시에 레거시 클라이언트(예를 들어 h.264와 h.265를 모두 제공함)를 지원한다.Representation Index Segment
는 항상 별도의 파일이지만 Single Index Segment
는 미디어 세그먼트와 동일한 파일의 바이트 범위일 수 있습니다.