gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 23:24:56 25 4
gpt4 key购买 nike

以下是重现步骤:

  • 标准化 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。
  • 生成 MP4 文件

    MP4Box -add 2@25fps@intra@640x360.h264:timescale=1000 -fps 25 2@25fps@intra@640x360.mp4
  • 制作 dash MP4 碎片化内容,包括 init mp4、.m4s 文件和一个 .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
  • 将所有这些文件复制并发布到一台 HTTPD 服务器下的文件夹
  • 我想从第一段的 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>
  • 从 VLC 播放器或 Edge 浏览器播放 MPD url,总是从第一段的第一帧开始,0s ~ 4s 之间的帧也意外显示。

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

    最佳答案

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

    关于ffmpeg - 如何制作在第一段中间开始播放的 MPEG-DASH MPD?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52352353/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com