[FFmpeg-trac] #6915(avformat:open): DASH audio segments duration doesn't match exactly with video segments duration.

FFmpeg trac at avcodec.org
Sun Dec 24 01:38:44 EET 2017


#6915: DASH audio segments duration doesn't match exactly with video segments
duration.
------------------------------------+-------------------------------------
             Reporter:  beloko      |                    Owner:  stevenliu
                 Type:  defect      |                   Status:  open
             Priority:  normal      |                Component:  avformat
              Version:  git-master  |               Resolution:
             Keywords:              |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+-------------------------------------

Comment (by beloko):

 Yes many thanks for the #EXT-X-DURATION fix.
 Now it satisfies the HLS validation tool used by the Apple Store team.
 And it doesn't produce issue with most populars HLS players.

 ----

 Fragmented MP4 protocol is only available on new mobile devices and
 operating systems. This means all HLS players supporting fMP4 (HLS version
 6) should support the AVC high profile (since HLS version 4) and the
 #EXTINF floating point duration (since HLS version 3).

 So it doesn't require to round all #EXTINF duration into an integer.

 ----

 But no segments duration in a same playlist should exceed the
 #EXT-X-DURATION. This means audio segments shoud be cut earlier in certain
 cases.

 Currently Dash segmenter produce audio playlist like this :

 {{{
 #EXTM3U
 #EXT-X-VERSION:6
 #EXT-X-TARGETDURATION:4
 #EXT-X-MEDIA-SEQUENCE:1
 #EXT-X-MAP:URI="init-stream1.m4s"
 #EXTINF:3.989333,
 chunk-stream1-00001.m4s
 #EXTINF:4.010667,
 chunk-stream1-00002.m4s
 #EXTINF:3.989333,
 chunk-stream1-00003.m4s
 #EXTINF:4.010667,
 chunk-stream1-00004.m4s
 #EXTINF:3.989333,
 chunk-stream1-00005.m4s
 #EXT-X-ENDLIST
 }}}

 4.010667 seconds exceed 4 seconds.
 But 0.010667 seconds is peanuts.

 That's why I suggest to round down only #EXTINF: values exceeding the
 #EXT-X-TARGETDURATION.

 Then we get something like this :

 {{{
 #EXTM3U
 #EXT-X-VERSION:6
 #EXT-X-TARGETDURATION:4
 #EXT-X-MEDIA-SEQUENCE:1
 #EXT-X-MAP:URI="init-stream1.m4s"
 #EXTINF:3.989333,
 chunk-stream1-00001.m4s
 #EXTINF:4.000000,
 chunk-stream1-00002.m4s
 #EXTINF:3.989333,
 chunk-stream1-00003.m4s
 #EXTINF:4.000000,
 chunk-stream1-00004.m4s
 #EXTINF:3.989333,
 chunk-stream1-00005.m4s
 #EXT-X-ENDLIST
 }}}

 However it could be better to get something like this :

 {{{
 #EXTM3U
 #EXT-X-VERSION:6
 #EXT-X-TARGETDURATION:4
 #EXT-X-MEDIA-SEQUENCE:1
 #EXT-X-MAP:URI="init-stream1.m4s"
 #EXTINF:3.989333,
 chunk-stream1-00001.m4s
 #EXTINF:3.989333,
 chunk-stream1-00002.m4s
 #EXTINF:3.989333,
 chunk-stream1-00003.m4s
 #EXTINF:3.989333,
 chunk-stream1-00004.m4s
 #EXTINF:3.989333,
 chunk-stream1-00005.m4s
 #EXT-X-ENDLIST

 }}}

 In this Apple's HLS sample the audio streams aren't cut exactly each 6
 seconds long. But around 6 seconds. Before few milliseconds. After few
 milliseconds.

 https://devstreaming-
 cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/master.m3u8

 I produced an HLS stream with FFMPEG and modified the .m3u8 audio playlist
 manually and tested the full movie with fixed #EXTINF value. The playback
 was succesfull with Apple's video players and Windows Edge browser.

 -----

 Finally I don't understand why you're using this command line to produce
 an HLS video stream.

 ffmpeg -hide_banner -i ~/bbb_sunflower_1080p_30fps_normal.mp4 -g 150 -r
 100 -x264opts "scenecut=-1" -f dash -min_seg_duration 1000000 -window_size
 99999 -t 5 -hls_playlist 1 output_Steven.mpd

 If your framerate is 100 and your fixed segment duration 1.000000 second.
 Your fixed GOP size should be 100 * 1 = 100.
 And your command line with this two parameters : -g 100 -keyint_min 100

 It should produce the same duration cut as -force_key_frames
 "expr:gte(t,n_forced*1)" parameter.

 Is it a particular need or is there a special advantage to not create an
 IFrame at regular durations ?

--
Ticket URL: <https://trac.ffmpeg.org/ticket/6915#comment:55>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list