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

FFmpeg trac at avcodec.org
Tue Dec 19 18:14:53 EET 2017


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

Comment (by beloko):

 Yes I'm agree with you that would be easier ;)

 The mediastreamvalidator tool complements the RFC8216 to validate the HLS
 streams. However I already got some bugged result with the
 mediastreamvalidator tool. For example sometimes it detect a wrong pixel
 resolution.

 Also the Apple developer website gives some additionals recommandations to
 broadcast properly any HLS streams. Not described in the Roger Pantos's
 RFC8216.

 ----

 Because I was tired last night, I lately made a new HLS stream as sample
 today. My video source is the Tears of Steel 4K version.

 Here is the FFMPEG command line :

 {{{
 ffmpeg.exe -i
 http://ftp.nluug.nl/pub/graphics/blender/demo/movies/ToS/tearsofsteel_4k.mov
 -loglevel verbose -threads 0 -c:a aac -sn -c:v libx264 -x264opts
 scenecut=-1 -force_key_frames "expr:gte(t,n_forced*4)" -r 25
 -min_seg_duration 4000000 -window_size 99999 -t 60 -hls_playlist 1
 "C:\inetpub\wwwroot\fmp4_x264\TOS.mpd"
 }}}

 DASH segmenter created two separated streams for video and audio tracks.
 The video playlist is named : media_0.m3u8
 And the audio stream is named : media_1.m3u8

 So to mux video and audio tracks I manually created a master.m3u8 file.

 Here is the right content to use :

 {{{
 #EXTM3U
 #EXT-X-INDEPENDENT-SEGMENTS
 #EXT-X-VERSION:6

 #EXT-X-MEDIA:TYPE=AUDIO,GROUP-
 ID="media_1",NAME="media_1",LANGUAGE="en",URI="media_1.m3u8"

 #EXT-X-STREAM-INF:BANDWIDTH=23106870,AVERAGE-
 BANDWIDTH=12649180,CODECS="avc1.640033,mp4a.40.2",RESOLUTION=3840x1714,AUDIO="media_1"
 media_0.m3u8
 }}}

 Windows Edge browser or Safari browser give a good playback. Video and
 audio streams looks properly synchronised. No problem with seeking the
 duration bar.

 But the mediastreamvalidator tool returns some errors to fix.

 Here is the full report :


 {{{
 Belokos-Mac:~ beloko$ mediastreamvalidator
 http://192.168.1.3/fmp4_x264/master.m3u8
 mediastreamvalidator: Version 1.2(170822)

 [/fmp4_x264/master.m3u8] Started root playlist download
 [media_0.m3u8] Started media playlist download
 [media_1.m3u8] Started media playlist download
 Can't deal with multiple sample timings per sample buffer
 Can't deal with multiple sample timings per sample buffer
 Can't deal with multiple sample timings per sample buffer
 Can't deal with multiple sample timings per sample buffer
 Can't deal with multiple sample timings per sample buffer
 Can't deal with multiple sample timings per sample buffer
 Can't deal with multiple sample timings per sample buffer
 Can't deal with multiple sample timings per sample buffer
 [media_1.m3u8] All media files delivered and have end tag, stopping
 [media_0.m3u8] All media files delivered and have end tag, stopping

 --------------------------------------------------------------------------------
 media_0.m3u8
 --------------------------------------------------------------------------------
 Processed 15 out of 15 segments
 Average segment duration: 4.000000
 Total segment bitrates (all discontinuities): average: 12517.68 kb/s, max:
 22974.29 kb/s
 Playlist max bitrate: 23106.870000 kb/s
 Audio Group ID: media_1


 Discontinuity: sequence: 0, parsed segment count: 15 of 15, duration:
 60.000 sec, average: 12517.68 kb/s, max: 22974.29 kb/s
 Track ID: 1
 Video Codec: avc1
 Video profile: High
 Video level: 5.1
 Video resolution: 3840x1714
 Video average IDR interval: 4.000000, Standard deviation: 0.000000
 Video frame rate: 25.000

 --------------------------------------------------------------------------------
 media_1.m3u8
 --------------------------------------------------------------------------------
 Processed 15 out of 15 segments
 Average segment duration: 4.000000
 Total segment bitrates (all discontinuities): average: 131.50 kb/s, max:
 132.58 kb/s
 Rendition group ID: media_1


 Discontinuity: sequence: 0, parsed segment count: 15 of 15, duration:
 60.000 sec, average: 131.50 kb/s, max: 132.58 kb/s
 Track ID: 1
 Audio Codec: AAC-LC
 Audio sample rate: 44100 Hz
 Audio channels: 2
 Audio channel layout: Stereo (L R)

 --------------------------------------------------------------------------------
 MUST fix issues
 --------------------------------------------------------------------------------

 Error: Zero sample count
 --> Detail:  Track ID 295
 --> Source:  media_1.m3u8 - chunk-stream1-00015.m4s

 Error: Different target durations detected
 --> Detail:  Target duration: 5 vs Target duration: 4
 --> Source:  media_1.m3u8
 --> Compare: media_0.m3u8
 }}}

 I don't know what's the "zero sample count" error means for now in segment
 fifteen and what the "Track ID 295" is really.

 But you can see the message about "different target durations detected"
 between media_0.m3u8 and media_1.m3u8. However the mediastreamvalidator
 tool detect an "Average segment duration: 4.000000" for the audio playlist
 media_1.m3u8.

 This issue doesn't block to playback an HLS video stream. But I know Apple
 can refuse your apps to be published in its store because it contains
 invalid HLS streams. It happened to a person I know. His iPhone app was
 rejected because some HLS streams had a wrong bandwith peak (exceding 10%)
 setted in its master.m3u8 file.

 Don't know if the Apple segmenter can cut audio streams at the exactly
 specified duration. Perhaps Apple segmenter can't do better.

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


More information about the FFmpeg-trac mailing list