代码之家  ›  专栏  ›  技术社区  ›  ravin.wang

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

  •  0
  • ravin.wang  · 技术社区  · 7 年前

    1. 标准化H.264视频流

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

    2. 生成MP4文件

      MP4Box-添加2@25fps@intra@640x360.h264:时间刻度=1000-fps 252@25fps@intra@640x360.mp4

    3. MP4Box-破折号5000-破折号5000-破折号比例1000-破折号说唱-片段名称“seg\u second$Number$”-片段时间线-简介直播2@25fps@intra@640x360.mp4

    4. 我想从第一段的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>

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

    1 回复  |  直到 7 年前
        1
  •  0
  •   ravin.wang    7 年前

    它在Shakaplayer中运行良好,但在Edge浏览器和VLC播放器中不起作用。

    推荐文章