Here are the reproduce steps:
Normalize an H.264 video stream
ffmpeg -i 2.h264 -c:v libx264 -intra -r 25 -vf scale=640x360,setdar=16:9 2@25fps@[email protected]
(*) After that, I got an H.264 stream where all pictures are H.264 IDR frames, and fps is 25, resolution is 640x360, aspect-ratio is 16:9.
Generate an MP4 file
MP4Box -add 2@25fps@[email protected]:timescale=1000 -fps 25 2@25fps@[email protected]
Make dash MP4 fragmented content, including init mp4, .m4s files and one .mpd file
MP4Box -dash 5000 -frag 5000 -dash-scale 1000 -frag-rap -segment-name 'seg_second$Number$' -segment-timeline -profile live 2@25fps@[email protected]
I want to play from 4s of the first segment, and don't display any frames before 4s, so I changed the .MPD file to modify the fields "SegmentTemplate@presentationTimeOffset", "SegmentTimeline:S@d/t", like as:
<?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>
Play the MPD url from VLC player, or Edge browser, it always starts the the first frame of the first segment, the frames between 0s ~ 4s are also displayed unexpectedly.
What's wrong with my steps? Or any other options for it?
Already clarified! It works well in Shakaplayer, but it does not work in Edge browser and VLC player.