0

理解一般概念的问题

使用 Shaka 播放器和 HLS 或 DASH 协议时,我需要能够切换音轨

对于 HLS,我们有 .m3u8 播放列表文件,对于 DASH,我们有 MPD 文件

这是一个可以用记事本打开的简单文件

据我了解有关其他音轨的信息,这些文件中包含字幕

例如 MDP 文件

<?xml version="1.0" encoding="UTF-8"?>
<!--Generated with https://github.com/google/shaka-packager version v2.4.1-c731217-release-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" minBufferTime="PT2S" type="static" mediaPresentationDuration="PT60S">
  <Period id="0">
    <AdaptationSet id="0" contentType="text" lang="el" subsegmentAlignment="true">
      <Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
      <Representation id="0" bandwidth="1044" codecs="wvtt" mimeType="application/mp4">
        <BaseURL>https://storage.googleapis.com/shaka-demo-assets/angel-one/text_el.mp4</BaseURL>
        <SegmentBase indexRange="727-950" timescale="1000">
          <Initialization range="0-726"/>
        </SegmentBase>
      </Representation>
    </AdaptationSet>
    <AdaptationSet id="1" contentType="text" lang="fr" subsegmentAlignment="true">
      <Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
      <Representation id="1" bandwidth="766" codecs="wvtt" mimeType="application/mp4">
        <BaseURL>https://storage.googleapis.com/shaka-demo-assets/angel-one/text_fr.mp4</BaseURL>
        <SegmentBase indexRange="727-950" timescale="1000">
          <Initialization range="0-726"/>
        </SegmentBase>
      </Representation>
    </AdaptationSet>
    <AdaptationSet id="2" contentType="text" lang="en" subsegmentAlignment="true">
      <Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
      <Representation id="2" bandwidth="736" codecs="wvtt" mimeType="application/mp4">
        <BaseURL>https://storage.googleapis.com/shaka-demo-assets/angel-one/text_en.mp4</BaseURL>
        <SegmentBase indexRange="727-950" timescale="1000">
          <Initialization range="0-726"/>
        </SegmentBase>
      </Representation>

.m3u8 播放列表示例

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="en",NAME="English",DEFAULT=YES,URI="chunklist_w1002585906_b128000_ao_slen_t64RW5nbGlzaA==.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="de",NAME="Deutsch",DEFAULT=NO,URI="chunklist_w1002585906_b128000_ao_slde_t64RGV1dHNjaA==.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="fr",NAME="Francais",DEFAULT=NO,URI="chunklist_w1002585906_b128000_ao_slfr_t64RnJhbmNhaXM=.m3u8"
#EXT-X-STREAM-INF:BANDWIDTH=600000,CODECS="avc1.42001e",RESOLUTION=640x360,AUDIO="aac"
chunklist_w1002585906_b600000_vo.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=400000,CODECS="avc1.42001e",RESOLUTION=480x270,AUDIO="aac"
chunklist_w1002585906_b400000_vo.m3u8

在播放器中,我们使用一个名为 manifest 的 URL 指向这些文件

HLS https://5b44cf20b0388.streamlock.net:8443/vod/smil:hls-maudios-prod.smil/playlist.m3u8

DASH https://storage.googleapis.com/shaka-demo-as ​​sets/angel-one/dash.mpd

Shaka 播放器使用此信息并有机会启用字幕或切换曲目。

这些文件是否仅在后端创建?或者可以在客户端形成MPD和m3u8?或者还有另一种可能添加不同的音轨和字幕?

4

0 回答 0