GPAC MPEG-DASH重用实时配置文件分块视频以进行按需播放

时间:2016-10-15 09:57:46

标签: video live-streaming mpeg mpeg-dash

我正在尝试重复使用最初使用实时个人资料生成但现在需要重播的一组MPEG-DASH视频。

经过一段时间的游戏似乎比我原先预期的更复杂,只是将类型从dynamic改为static大概不起作用,因为我们也错过了像视频显然不会出现在实时场景中但是按需播放。我知道我可以重新构建流的完整.mp4,然后根据需要重新组合,但这似乎是错误的方法。 Mozilla状态here

  

您可以在稍后阶段使用相同的媒体文件进行实时传输和VOD

所以必须有一些方法来做到这一点......

以下是原始广播live.mpd中的清单文件:

<?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 0.6.2-DEV-rev135-g2dd7b95-master  at 2016-04-07T11:49:25.297Z-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT4.000S" type="dynamic" publishTime="2016-04-07T11:49:25Z" availabilityStartTime="2016-04-07T11:49:05.259Z" minimumUpdatePeriod="PT0H0M2.000S" maxSegmentDuration="PT0H0M4.011S" profiles="urn:mpeg:dash:profile:isoff-live:2011">
    <ProgramInformation moreInformationURL="http://192.168.1.103:8080/recording_29/">
        <Title>1</Title>
    </ProgramInformation
    <BaseURL>http://192.168.1.103:3000/bbc_apr16/uhd0/recording_29/</BaseURL>

    <Period id="GENID_DEF" start="PT0H0M0.000S">
        <AdaptationSet segmentAlignment="true" lang="und">
            <SegmentTemplate timescale="90000" media="live_$RepresentationID$_$Number$.m4s" startNumber="1" duration="360000" initialization="live_$RepresentationID$_.mp4"/>
            <Representation id="audio" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="48000" startWithSAP="1" bandwidth="6868">
                <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
            </Representation>
        </AdaptationSet>
        <AdaptationSet segmentAlignment="true" maxWidth="3840" maxHeight="2160" maxFrameRate="25" par="16:9" lang="und">
            <SegmentTemplate timescale="90000" media="live_$RepresentationID$_$Number$.m4s" startNumber="1" duration="360000" initialization="live_$RepresentationID$_.mp4"/>
            <Representation id="video_2160p" mimeType="video/mp4" codecs="avc1.42c01f" width="3840" height="2160" frameRate="25" sar="1:1" startWithSAP="1" bandwidth="31726550">
            </Representation>
            <Representation id="video_720p" mimeType="video/mp4" codecs="avc1.42c01f" width="1280" height="720" frameRate="25" sar="1:1" startWithSAP="1" bandwidth="3175420">
            </Representation>
        </AdaptationSet>
    </Period>
</MPD>

如果我重新播放它,它会尝试从现在开始检索实时文件(显然不存在)。

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:0)

好吧所以它实际上比我想象的要简单得多!

首先,您需要将type="dynamic"更改为static。这应该允许播放文件,好像它再次是直播,没有擦洗栏......

要恢复磨砂条,我们需要设置mediaPresentationDuration。为了设置它,我们需要计算段的数量,然后将其乘以我的情况4000毫秒的段持续时间。然后把它作为格式PT1H22M12.000S

所以在这个清单中我们可以用以下调整后的清单回放文件(注意我的BaseURL也错了......):

<?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 0.6.2-DEV-rev135-g2dd7b95-master  at 2016-04-07T11:49:25.297Z-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT4.000S" type="static" publishTime="2016-04-07T11:49:25Z" availabilityStartTime="2016-04-07T11:49:05.259Z" minimumUpdatePeriod="PT0H0M2.000S" maxSegmentDuration="PT0H0M4.011S" profiles="urn:mpeg:dash:profile:isoff-live:2011" mediaPresentationDuration="PT1H22M12.000S">
    <ProgramInformation moreInformationURL="http://192.168.1.103:8080/recording_29/">
        <Title>1</Title>
    </ProgramInformation>

    <Period id="GENID_DEF" start="PT0H0M0.000S">
        <AdaptationSet segmentAlignment="true" lang="und">
            <SegmentTemplate timescale="90000" media="live_$RepresentationID$_$Number$.m4s" startNumber="1" duration="360000" initialization="live_$RepresentationID$_.mp4"/>
            <Representation id="audio" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="48000" startWithSAP="1" bandwidth="6868">
                <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
            </Representation>
        </AdaptationSet>
        <AdaptationSet segmentAlignment="true" maxWidth="3840" maxHeight="2160" maxFrameRate="25" par="16:9" lang="und">
            <SegmentTemplate timescale="90000" media="live_$RepresentationID$_$Number$.m4s" startNumber="1" duration="360000" initialization="live_$RepresentationID$_.mp4"/>
            <Representation id="video_2160p" mimeType="video/mp4" codecs="avc1.42c01f" width="3840" height="2160" frameRate="25" sar="1:1" startWithSAP="1" bandwidth="31726550">
            </Representation>
            <Representation id="video_720p" mimeType="video/mp4" codecs="avc1.42c01f" width="1280" height="720" frameRate="25" sar="1:1" startWithSAP="1" bandwidth="3175420">
            </Representation>
        </AdaptationSet>
    </Period>
</MPD>

我在GitHub创建了一个小脚本来完成所有这些操作。

相关问题