GPAC MPEG-DASH 重新使用实时配置文件分块视频进行点播播放

GPAC MPEG-DASH Reusing Live Profile Chunked Video for On-Demand Playback

我正在尝试重新使用一组 MPEG-DASH 视频,这些视频最初是使用实时配置文件生成的,但现在需要重播。

经过一番尝试后,它似乎比我最初预期的要复杂,只是将类型从 dynamic 更改为 static 并没有奏效,大概是因为我们还缺少像结尾这样的细节显然不会出现在现场场景中但会点播的视频的一部分。我知道我可以重新构建流的完整 .mp4,然后按需重新分块,但这似乎是错误的方法。还有 Mozilla 声明 here:

You can use the same media files for both live transmission and VOD at a later stage

所以一定有办法做到...

这是原始广播的清单文件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>

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

如有任何帮助,我们将不胜感激!

好的,实际上它比我预期的要简单得多!

您首先需要将 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 上完成所有这些工作。