如何制作在第一段中间开始播放的 MPEG-DASH MPD?

How to make a MPEG-DASH MPD which starts the playback in the middle of the first segment?

重现步骤如下:

  1. 标准化 H.264 视频流

    ffmpeg -i 2.h264 -c:v libx264 -intra -r 25 -vf scale=640x360,setdar=16:9 2@25fps@intra@ 640x360.h264

    (*) 之后,我得到一个H.264流,所有图片都是H.264 IDR帧,fps是25,分辨率是640x360,宽高比是16:9.

  2. 生成 MP4 文件

    MP4Box -add 2@25fps@intra@640x360.h264:timescale=1000 -fps 25 2@25fps@intra@640x360.mp4

  3. 制作dash MP4碎片化内容,包括init mp4、.m4s文件和1个.mpd文件

    MP4Box -dash 5000 -frag 5000 -dash-scale 1000 -frag-rap -segment-name 'seg_second$Number$' -segment-timeline -profile live 2@25fps @intra@640x360.mp4

  4. 将所有这些文件复制并发布到一台 HTTPD 服务器下的文件夹中
  5. 我想从第一段4s开始播放,4s之前不显示任何帧,所以我改了.MPD文件修改字段"SegmentTemplate@presentationTimeOffset","SegmentTimeline:S@d/t",如:
    <?xml version="1.0"?> <MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H0M26.000S" maxSegmentDuration="PT0H0M5.000S" profiles="urn:mpeg:dash:profile:isoff-live:2011"> <Period duration="PT0H0M26.000S"> <AdaptationSet segmentAlignment="true" maxWidth="640" maxHeight="360" maxFrameRate="25" par="16:9" lang="und"> <SegmentTemplate presentationTimeOffset="4000" media="seg_second$Number$.m4s" timescale="1000" startNumber="1" initialization="seg_secondinit.mp4"> <SegmentTimeline> <S d="1000" t="4000"/> <S d="5000" r="4"/> </SegmentTimeline> </SegmentTemplate> <Representation id="1" mimeType="video/mp4" codecs="avc3.64101E" width="640" height="360" frameRate="25" sar="1:1" startWithSAP="1" bandwidth="2261831"> </Representation> </AdaptationSet> </Period> </MPD>

  6. 从VLC播放器或Edge浏览器播放MPD url,总是从第一段的第一帧开始,0s ~ 4s之间的帧也意外显示。

我的步骤有什么问题?或者还有其他选择吗?

已经澄清了! 在Shakaplayer中运行良好,但在Edge浏览器和VLC播放器中不可用