重新排序短划线细分列表

时间:2016-12-12 12:24:11

标签: video-streaming streaming mpeg-dash

我有一个看起来像这样的实时短划线。

<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="" maxSegmentDuration="PT4S" minimumUpdatePeriod="PT595H" minBufferTime="PT2S" type="dynamic" availabilityStartTime="2016-11-20T17:00:54Z" publishTime="2016-11-20T17:00:54Z" profiles="urn:hbbtv:dash:profile:isoff-live:2012,urn:mpeg:dash:profile:isoff-live:2011" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" timeShiftBufferDepth="PT120S">
<ProgramInformation>
    <Title>Title</Title>
</ProgramInformation>
<Period start="PT0S" id="p1">
    <AdaptationSet mimeType="audio/mp4" lang="en" startWithSAP="1" contentType="audio" segmentAlignment="true">
        <Representation audioSamplingRate="48000" bandwidth="128000" id="128kb" codecs="mp4a.40.2">
            <AudioChannelConfiguration value="2" schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011"/>
            <SegmentTemplate duration="4" media="audio/128kbps/segment_$Number$.m4s" initialization="audio/128kbps/init.mp4" startNumber="0"/>
        </Representation>
    </AdaptationSet>
    <AdaptationSet mimeType="video/mp4" minWidth="426" contentType="video" maxWidth="1920" minHeight="240" segmentAlignment="true" startWithSAP="1" maxHeight="1080">
        <Representation frameRate="60000/1000" height="480" width="858" bandwidth="1200000" codecs="avc1.42c00d" id="1200kb">
            <SegmentTemplate duration="4" media="video/480p/segment_$Number$.m4s" initialization="video/480p/init.mp4" startNumber="0"/>
        </Representation>
        <!-- Some more representations -->
    </AdaptationSet>
</Period>

流式传输时,所有段都保存到磁盘,以便在流式传输会话中使用VOD和高亮显示。我通过将实时清单重新制作为静态清单来完成VOD解决方案。

我的问题是当我想要创建精彩片段时,我想重新排序片段并准确指定应下载和播放的片段。我尝试使用SegmentationList执行此操作。我的新表现 我创建了这样的内容:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

             突出测试     

<Period start="PT0S" duration="PT0H2M24.000S">
    <AdaptationSet mimeType="video/mp4" minWidth="426" contentType="video" maxWidth="1920" minHeight="240" segmentAlignment="true" startWithSAP="1" maxHeight="1080">
        <Representation frameRate="60000/1000" height="480" width="858" bandwidth="1200000" codecs="avc1.42c00d" id="1200kb">
            <SegmentList duration="61440" timescale="15360">
                <Initialization sourceURL="video/480p/init.mp4"/>
                <!--Highlight 1-->
                <SegmentURL media="video/480p/segment_9399.m4s"/>
                <SegmentURL media="video/480p/segment_9400.m4s"/>
                <!--Highlight 2-->
                <SegmentURL media="video/480p/segment_9351.m4s"/>
                <SegmentURL media="video/480p/segment_9352.m4s"/>
                <!--Highlight 3-->
                <SegmentURL media="video/480p/segment_9449.m4s"/>
                <SegmentURL media="video/480p/segment_9450.m4s"/>
            </SegmentList>
        </Representation>
    </AdaptationSet>
    <AdaptationSet mimeType="audio/mp4" lang="en" startWithSAP="1" contentType="audio" segmentAlignment="true">
        <Representation audioSamplingRate="48000" bandwidth="128000" id="128kb" codecs="mp4a.40.2">
            <AudioChannelConfiguration value="2" schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011"/>
            <SegmentList duration="192000" timescale="48000">
                <Initialization sourceURL="audio/128kbps/init.mp4"/>
                <!--Highlight 1-->
                <SegmentURL media="audio/128kbps/segment_9399.m4s"/>
                <SegmentURL media="audio/128kbps/segment_9400.m4s"/>
                <!--Highlight 2-->
                <SegmentURL media="audio/128kbps/segment_9351.m4s"/>
                <SegmentURL media="audio/128kbps/segment_9352.m4s"/>
                <SegmentURL media="audio/128kbps/segment_9357.m4s"/>
                <!--Highlight 3-->
                <SegmentURL media="audio/128kbps/segment_9449.m4s"/>
                <SegmentURL media="audio/128kbps/segment_9450.m4s"/>
            </SegmentList>
        </Representation>
    </AdaptationSet>
</Period>

我遇到这个问题的问题首先是计时器不从0开始,它从37596(9399 * 4)开始。我的第二个问题是当高亮1完成时它不会播放高亮2。相反,如果冻结好像已经到达视频的末尾。

我猜想init文件中有一些内容指定了如何播放这些段。

有没有办法通过只创建一个新的清单而不是创建一个新的初始化文件来做到这一点?

1 个答案:

答案 0 :(得分:1)

您不需要新的init文件。主要问题是媒体片段的时间戳。要解决初始时间的问题,您应该将presentationTimeOffset属性添加到Manifest,并显示您要播放的第一个片段的开始时间。

第二个问题是,不连续性(在你的情况下,两个亮点之间的时间变化)应该按照MPEG-DASH标准的建议将它们分成新的时期来处理:

  

如果出现不连续,建议添加新的Period以重置@presentationTimeOffset的值。

这两件事可以组合如下(为了简单起见,我跳过音频AdaptationSets)。在这种情况下我使用了SegmentTimeline。

<MPD type="static" mediaPresentationDuration="PT0H2M24.000S" minBufferTime="PT4S" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:mpeg:dash:schema:mpd:2011" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd" profiles="urn:mpeg:dash:profile:isoff-live:2011,urn:com:dashif:dash264">
    <Period start="PT0S" duration="PT8S">
        <!--Highlight 1-->
        <AdaptationSet mimeType="video/mp4" minWidth="426" contentType="video" maxWidth="1920" minHeight="240" segmentAlignment="true" startWithSAP="1" maxHeight="1080">
            <SegmentTemplate timescale="1" presentationTimeOffset="37596" startNumber="9399" initialization="video/480p/init.mp4" media="video/$RepresentationID$/segment_$Number$.m4s">
                <SegmentTimeline>
                    <S t="37596" d="4" r="1"/>
                </SegmentTimeline>
            </SegmentTemplate>
            <Representation frameRate="60000/1000" height="480" width="858" bandwidth="1200000" codecs="avc1.42c00d" id="480p" />
        </AdaptationSet>
    </Period>
    <Period duration="PT8S">
        <!--Highlight 2-->
        <AdaptationSet mimeType="video/mp4" minWidth="426" contentType="video" maxWidth="1920" minHeight="240" segmentAlignment="true" startWithSAP="1" maxHeight="1080">
            <SegmentTemplate timescale="1" presentationTimeOffset="37404" startNumber="9351" initialization="video/480p/init.mp4" media="video/$RepresentationID$/segment_$Number$.m4s">
                <SegmentTimeline>
                    <S t="37404" d="61440" r="1"/>
                </SegmentTimeline>
            </SegmentTemplate>
            <Representation frameRate="60000/1000" height="480" width="858" bandwidth="1200000" codecs="avc1.42c00d" id="480p" />
        </AdaptationSet>
    </Period>
    <Period duration="PT8S">
        <!--Highlight 3-->
        <AdaptationSet mimeType="video/mp4" minWidth="426" contentType="video" maxWidth="1920" minHeight="240" segmentAlignment="true" startWithSAP="1" maxHeight="1080">
            <SegmentTemplate timescale="1" presentationTimeOffset="37796" startNumber="9449" initialization="video/480p/init.mp4" media="video/$RepresentationID$/segment_$Number$.m4s">
                <SegmentTimeline>
                    <S t="37796" d="61440" r="1"/>
                </SegmentTimeline>
            </SegmentTemplate>
            <Representation frameRate="60000/1000" height="480" width="858" bandwidth="1200000" codecs="avc1.42c00d" id="480p" />
        </AdaptationSet>
    </Period>
</MPD>

当然,玩家需要同时支持presentationTimeOffset和多个时段。我认为Bitmovin Player应该有效,不确定dash.js等其他人。