Hls.js: Error while trying to append buffer (The SourceBuffer is full)

Created on 12 Dec 2016  Â·  7Comments  Â·  Source: video-dev/hls.js

Environment
Steps to reproduce
  1. Begin watching a VOD video, for example, https://chew.tv/waxncats/wax-n-cats-190?debug=true
  2. Watch video for approximately 1-2 minutes

I have set maxBufferLength to 90 in the player config.

Expected behavior

The full video to play until the end.

Actual behavior

The buffer full message occurs and playback freezes. A large white box also appears over the video element.

screen shot 2016-12-12 at 14 27 02

Console output
app.js:12806 [log] > attachMedia
app.js:12806 [log] > media source opened
app.js:12806 [log] > loadSource:https://video-cdn.chew.tv/waxncats-yELqw/waxncats-yELqw_all.m3u8?access=true
app.js:12806 [log] > trigger BUFFER_RESET
app.js:12806 [log] > manifest loaded,4 level(s) found, first bitrate:224000
app.js:12806 [log] > startLoad
app.js:12806 [log] > switching to level 0
app.js:12806 [log] > (re)loading playlist for level 0
app.js:12806 [log] > set currentLevel:-1
app.js:12806 [log] > set loadLevel:-1
app.js:12806 [log] > immediateLevelSwitch
app.js:12806 [warn] > abort flushing too many retries
app.js:12806 [log] > buffer flushed
app.js:12806 [log] > level 0 loaded [0,768],duration:7682.409334
app.js:12806 [log] > Loading 0 of [0 ,768],level 0, currentTime:0.000,bufferEnd:0.000
app.js:12806 [log] > Loaded  0 of [0 ,768],level 0
app.js:12806 [log] > Parsing 0 of [0 ,768],level 0, cc 0
app.js:12806 [log] > demuxing in webworker
app.js:12806 [log] > creating sourceBuffer(audio/mp4;codecs=mp4a.40.2)
app.js:12806 [log] > creating sourceBuffer(video/mp4;codecs=avc1.42001e)
app.js:12806 [log] > track:audio,container:audio/mp4,codecs[level/parsed]=[mp4a.40.2/mp4a.40.5]
app.js:12806 [log] > track:video,container:video/mp4,codecs[level/parsed]=[avc1.42001e/avc1.42c01e]
app.js:12806 [log] > Parsed video,PTS:[0.043,10.043],DTS:[0.043/10.043],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[0.000,10.048],DTS:[0.000/10.048],nb:471,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:76/44/662/1362/2208
app.js:12806 [log] > media buffered : [0.043,10.043]
app.js:12806 [log] > switching to level 2
app.js:12806 [log] > (re)loading playlist for level 2
app.js:12806 [log] > level 2 loaded [0,768],duration:7682.333333
app.js:12806 [log] > Loading 1 of [0 ,768],level 2, currentTime:0.007,bufferEnd:10.043
app.js:12806 [log] > adjust currentTime from 0.008 to next buffered @ 0.043 + nudge 0
app.js:12806 [log] > Loaded  1 of [0 ,768],level 2
app.js:12806 [log] > Parsing 1 of [0 ,768],level 2, cc 0
app.js:12806 [log] > track:audio,container:audio/mp4,codecs[level/parsed]=[mp4a.40.2/mp4a.40.5]
app.js:12806 [log] > track:video,container:video/mp4,codecs[level/parsed]=[avc1.4d001e/avc1.4d401e]
app.js:12806 [log] > Parsed video,PTS:[10.067,20.067],DTS:[10.000/20.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[10.008,20.013],DTS:[10.008/20.013],nb:469,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:33/265/72/7/45143
app.js:12806 [log] > media buffered : [0.043,20.000]
app.js:12806 [log] > switching to level 3
app.js:12806 [log] > (re)loading playlist for level 3
app.js:12806 [log] > level 3 loaded [0,768],duration:7682.366667
app.js:12806 [log] > Loading 2 of [0 ,768],level 3, currentTime:0.374,bufferEnd:20.000
app.js:12806 [log] > Loaded  2 of [0 ,768],level 3
app.js:12806 [log] > Parsing 2 of [0 ,768],level 3, cc 0
app.js:12806 [log] > track:audio,container:audio/mp4,codecs[level/parsed]=[mp4a.40.2/mp4a.40.5]
app.js:12806 [log] > track:video,container:video/mp4,codecs[level/parsed]=[avc1.4d001f/avc1.4d401f]
app.js:12806 [log] > Parsed video,PTS:[20.067,30.067],DTS:[20.000/30.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[20.013,30.019],DTS:[20.013/30.019],nb:469,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:15/1580/65/39/36020
app.js:12806 [log] > media buffered : [0.043,30.000]
app.js:12806 [log] > Loading 3 of [0 ,768],level 3, currentTime:2.076,bufferEnd:30.000
app.js:12806 [log] > Loaded  3 of [0 ,768],level 3
app.js:12806 [log] > Parsing 3 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[30.067,40.067],DTS:[30.000/40.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[30.019,40.003],DTS:[30.019/40.003],nb:468,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:508/927/71/24/40091
app.js:12806 [log] > media buffered : [0.043,40.000]
app.js:12806 [log] > Loading 4 of [0 ,768],level 3, currentTime:3.608,bufferEnd:40.000
app.js:12806 [log] > Loaded  4 of [0 ,768],level 3
app.js:12806 [log] > Parsing 4 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[40.067,50.067],DTS:[40.000/50.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[40.003,50.008],DTS:[40.003/50.008],nb:469,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:15/483/70/21/104661
app.js:12806 [log] > media buffered : [0.043,50.000]
app.js:12806 [log] > Loading 5 of [0 ,768],level 3, currentTime:4.198,bufferEnd:50.000
app.js:12806 [log] > Loaded  5 of [0 ,768],level 3
app.js:12806 [log] > Parsing 5 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[50.067,60.067],DTS:[50.000/60.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[50.008,60.013],DTS:[50.008/60.013],nb:469,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:11/484/81/35/100586
app.js:12806 [log] > media buffered : [0.043,60.000]
app.js:12806 [log] > Loading 6 of [0 ,768],level 3, currentTime:4.810,bufferEnd:60.000
app.js:12806 [log] > Loaded  6 of [0 ,768],level 3
app.js:12806 [log] > Parsing 6 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[60.067,70.067],DTS:[60.000/70.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[60.013,70.019],DTS:[60.013/70.019],nb:469,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:13/518/79/76/91652
app.js:12806 [log] > media buffered : [0.043,70.000]
app.js:12806 [log] > Loading 7 of [0 ,768],level 3, currentTime:5.498,bufferEnd:70.000
app.js:12806 [log] > Loaded  7 of [0 ,768],level 3
app.js:12806 [log] > Parsing 7 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[70.067,80.033],DTS:[70.000/80.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[70.019,80.003],DTS:[70.019/80.003],nb:468,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:12/558/84/44/90028
app.js:12806 [log] > media buffered : [0.043,80.000]
app.js:12806 [log] > Loading 8 of [0 ,768],level 3, currentTime:6.198,bufferEnd:80.000
app.js:12806 [log] > Loaded  8 of [0 ,768],level 3
app.js:12806 [log] > Parsing 8 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[80.067,90.067],DTS:[80.000/90.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[80.003,90.008],DTS:[80.003/90.008],nb:469,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:11/1059/76/28/53540
app.js:12806 [log] > media buffered : [0.043,90.000]
app.js:12806 [log] > Loading 9 of [0 ,768],level 3, currentTime:7.372,bufferEnd:90.000
app.js:12806 [log] > Loaded  9 of [0 ,768],level 3
app.js:12806 [log] > Parsing 9 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[90.067,100.033],DTS:[90.000/100.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[90.008,100.013],DTS:[90.008/100.013],nb:469,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:10/689/495/48/52054
app.js:12806 [log] > media buffered : [0.043,100.000]
app.js:12806 [log] > Loading 10 of [0 ,768],level 3, currentTime:8.616,bufferEnd:100.000
app.js:12806 [log] > Loaded  10 of [0 ,768],level 3
app.js:12806 [log] > Parsing 10 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[100.067,110.033],DTS:[100.000/110.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[100.013,110.019],DTS:[100.013/110.019],nb:469,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:22/465/107/27/98656
app.js:12806 [log] > media buffered : [0.043,110.000]
app.js:12806 [log] > Loading 11 of [0 ,768],level 3, currentTime:9.238,bufferEnd:110.000
app.js:12806 [log] > Loaded  11 of [0 ,768],level 3
app.js:12806 [log] > Parsing 11 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[110.067,120.033],DTS:[110.000/120.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[110.019,120.003],DTS:[110.019/120.003],nb:468,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:16/349/63/22/124952
app.js:12806 [log] > media buffered : [0.043,120.000]
app.js:12806 [log] > Loading 12 of [0 ,768],level 3, currentTime:9.690,bufferEnd:120.000
app.js:12806 [log] > Loaded  12 of [0 ,768],level 3
app.js:12806 [log] > Parsing 12 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[120.067,130.033],DTS:[120.000/130.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[120.003,130.008],DTS:[120.003/130.008],nb:469,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:14/574/88/25/94184
app.js:12806 [log] > media buffered : [0.043,130.000]
app.js:12806 [log] > Loading 13 of [0 ,768],level 3, currentTime:10.393,bufferEnd:130.000
app.js:12806 [log] > Loaded  13 of [0 ,768],level 3
app.js:12806 [log] > Parsing 13 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[130.067,140.033],DTS:[130.000/140.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[130.008,140.013],DTS:[130.008/140.013],nb:469,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:10/510/72/24/105114
app.js:12806 [log] > media buffered : [0.043,140.000]
app.js:12806 [log] > Loading 14 of [0 ,768],level 3, currentTime:11.010,bufferEnd:140.000
app.js:12806 [log] > Loaded  14 of [0 ,768],level 3
app.js:12806 [log] > Parsing 14 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[140.067,150.033],DTS:[140.000/150.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[140.013,150.019],DTS:[140.013/150.019],nb:469,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:74/628/68/116/72773
app.js:12806 [log] > media buffered : [0.043,150.000]
app.js:12806 [log] > Loading 15 of [0 ,768],level 3, currentTime:11.896,bufferEnd:150.000
app.js:12806 [log] > Loaded  15 of [0 ,768],level 3
app.js:12806 [log] > Parsing 15 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[150.067,160.033],DTS:[150.000/160.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[150.019,160.003],DTS:[150.019/160.003],nb:468,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:36/1027/75/44/55900
app.js:12806 [log] > media buffered : [0.043,160.000]
app.js:12806 [log] > Loading 16 of [0 ,768],level 3, currentTime:13.080,bufferEnd:160.000
app.js:12806 [log] > Loaded  16 of [0 ,768],level 3
app.js:12806 [log] > Parsing 16 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[160.067,170.033],DTS:[160.000/170.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[160.003,170.008],DTS:[160.003/170.008],nb:469,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:12/497/67/41/105234
app.js:12806 [log] > media buffered : [0.043,170.000]
app.js:12806 [log] > Loading 17 of [0 ,768],level 3, currentTime:13.699,bufferEnd:170.000
app.js:12806 [log] > Loaded  17 of [0 ,768],level 3
app.js:12806 [log] > Parsing 17 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[170.067,180.033],DTS:[170.000/180.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[170.008,180.013],DTS:[170.008/180.013],nb:469,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:10/1337/69/27/43897
app.js:12806 [log] > media buffered : [0.043,180.000]
app.js:12806 [log] > Loading 18 of [0 ,768],level 3, currentTime:15.143,bufferEnd:180.000
app.js:12806 [log] > Loaded  18 of [0 ,768],level 3
app.js:12806 [log] > Parsing 18 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[180.067,190.033],DTS:[180.000/190.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[180.013,190.019],DTS:[180.013/190.019],nb:469,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:16/553/67/610/52546
app.js:12806 [log] > media buffered : [0.043,190.000]
app.js:12806 [log] > Loading 19 of [0 ,768],level 3, currentTime:16.390,bufferEnd:190.000
app.js:12806 [log] > Loaded  19 of [0 ,768],level 3
app.js:12806 [log] > Parsing 19 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[190.067,200.033],DTS:[190.000/200.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[190.019,200.003],DTS:[190.019/200.003],nb:468,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:28/672/89/46/83842
app.js:12806 [log] > media buffered : [0.043,200.000]
app.js:12806 [log] > Loading 20 of [0 ,768],level 3, currentTime:17.226,bufferEnd:200.000
app.js:12806 [log] > Loaded  20 of [0 ,768],level 3
app.js:12806 [log] > Parsing 20 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[200.067,210.067],DTS:[200.000/210.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[200.003,210.008],DTS:[200.003/210.008],nb:469,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:20/750/71/28/77906
app.js:12806 [log] > media buffered : [0.043,210.000]
app.js:12806 [log] > Loading 21 of [0 ,768],level 3, currentTime:18.097,bufferEnd:210.000
app.js:12806 [log] > Loaded  21 of [0 ,768],level 3
app.js:12806 [log] > Parsing 21 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[210.067,220.033],DTS:[210.000/220.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[210.008,220.013],DTS:[210.008/220.013],nb:469,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:11/526/78/26/105488
app.js:12806 [log] > media buffered : [0.043,220.000]
app.js:12806 [log] > Loading 22 of [0 ,768],level 3, currentTime:18.739,bufferEnd:220.000
app.js:12806 [log] > Loaded  22 of [0 ,768],level 3
app.js:12806 [log] > Parsing 22 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[220.067,230.033],DTS:[220.000/230.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[220.013,230.019],DTS:[220.013/230.019],nb:469,dropped:0
app.js:12806 [log] > latency/loading/parsing/append/kbps:11/819/86/40/72330
app.js:12806 [log] > media buffered : [2.043,230.000]
app.js:12806 [log] > Loading 23 of [0 ,768],level 3, currentTime:19.697,bufferEnd:230.000
app.js:12806 [log] > Loaded  23 of [0 ,768],level 3
app.js:12806 [log] > Parsing 23 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[230.067,240.033],DTS:[230.000/240.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[230.019,240.003],DTS:[230.019/240.003],nb:468,dropped:0
app.js:12806 [error] > error while trying to append buffer:Failed to execute 'appendBuffer' on 'SourceBuffer': The SourceBuffer is full, and cannot free space to append additional buffers.
app.js:12806 [warn] > reduce max buffer length to 300s and switch to IDLE state
app.js:12806 [log] > Loading 23 of [0 ,768],level 3, currentTime:20.802,bufferEnd:230.000
app.js:12806 [log] > Loaded  23 of [0 ,768],level 3
app.js:12806 [log] > Parsing 23 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[230.067,240.033],DTS:[230.000/240.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[230.019,240.003],DTS:[230.019/240.003],nb:468,dropped:0
app.js:12806 [error] > error while trying to append buffer:Failed to execute 'appendBuffer' on 'SourceBuffer': The SourceBuffer is full, and cannot free space to append additional buffers.
app.js:12806 [warn] > reduce max buffer length to 150s and switch to IDLE state
app.js:12806 [log] > Loading 23 of [0 ,768],level 3, currentTime:80.087,bufferEnd:230.000
app.js:12806 [log] > Loaded  23 of [0 ,768],level 3
app.js:12806 [log] > Parsing 23 of [0 ,768],level 3, cc 0
app.js:12806 [log] > Parsed video,PTS:[230.067,240.033],DTS:[230.000/240.000],nb:300,dropped:0
app.js:12806 [log] > Parsed audio,PTS:[230.019,240.003],DTS:[230.019/240.003],nb:468,dropped:0
app.js:12806 [error] > sourceBuffer error:[object Event]
app.js:12806 [error] > trying to append although a media error occured, flush segment and abort
app.js:12806 [log] > media source ended

Chrome Properties

Property    Value
audio_codec_name    aac
audio_dds   false
audio_decoder   FFmpegAudioDecoder
debug   Generated splice of overlap duration 18666us into new buffer at 10008000us.
duration    7682.409333
error   Append: stream parsing failed. Data size=131072 append_window_start=0 append_window_end=inf
event   PAUSE
found_audio_stream  true
found_video_stream  true
height  1080
info    Video codec: avc1.4D401F
pipeline_error  chunk demuxer: append failed
pipeline_state  kStopped
player_id   14
render_id   4041
url blob:https://chew.tv/9a6a56bd-9922-494c-b3bc-9365eae411af
video_codec_name    h264
video_dds   false
video_decoder   GpuVideoDecoder
width   1920

Chrome Log

Timestamp   Property    Value
00:00:00 00 pipeline_state  kCreated
00:00:00 00 event   WEBMEDIAPLAYER_CREATED
00:00:00 00 url blob:https://chew.tv/9a6a56bd-9922-494c-b3bc-9365eae411af
00:00:00 00 pipeline_state  kStarting
00:00:01 781    info    Audio codec: mp4a.40.2. Sampling frequency: 48000Hz. Sampling frequency(Extension): 48000Hz. Channel layout: 3.
00:00:01 781    found_audio_stream  true
00:00:01 781    audio_codec_name    aac
00:00:01 781    duration    7682.409333
00:00:01 942    info    Video codec: avc1.42C01E
00:00:01 942    found_video_stream  true
00:00:01 942    video_codec_name    h264
00:00:01 944    audio_dds   false
00:00:01 944    audio_decoder   FFmpegAudioDecoder
00:00:01 944    video_dds   false
00:00:01 944    video_decoder   GpuVideoDecoder
00:00:01 944    pipeline_state  kPlaying
00:00:03 67 event   PLAY
00:00:03 121    pipeline_state  kSeeking
00:00:03 128    pipeline_state  kPlaying
00:00:03 456    info    Audio codec: mp4a.40.2. Sampling frequency: 48000Hz. Sampling frequency(Extension): 48000Hz. Channel layout: 3.
00:00:03 457    info    Video codec: avc1.4D401E
00:00:03 496    debug   Generated splice of overlap duration 18666us into new buffer at 10008000us.
00:00:05 175    info    Audio codec: mp4a.40.2. Sampling frequency: 48000Hz. Sampling frequency(Extension): 48000Hz. Channel layout: 3.
00:00:05 175    info    Video codec: avc1.4D401F
00:00:13 232    height  480
00:00:13 232    width   854
00:00:23 223    height  1080
00:00:23 223    width   1920
00:01:23 457    error   Failed to prepare video sample for decode
00:01:23 457    error   Append: stream parsing failed. Data size=131072 append_window_start=0 append_window_end=inf
00:01:23 458    pipeline_error  chunk demuxer: append failed
00:01:23 458    event   PAUSE
00:01:23 458    pipeline_state  kStopping
00:01:23 460    pipeline_state  kStopped
Need info

Most helpful comment

by default hls.js tries to guarantee at least config.maxBufferLength buffer upfront video.currentTime . the default value is 30s
each of your frag is around 70MB, for 10s. the issue is that browser MSE internal memory is around 60 - 120 MB
once this limit will be reached (basically more than 2 frag buffered), a SourceBuffer full error will be raised by MSE stack
you need to lower this value for your specific case.
FYI I was able to play your stream with chrome and FF with config.maxBufferLength=20

All 7 comments

I got a 403 while trying your stream on demo page with CORS enabled.
could you recheck against latest v0.6.x ?

I have the same problem. (Latest Chrome, latest HLS.js)

I'm using segments of 6s length. These segment files can get as large as 30MB.

I noticed that the problem does not occur when I use smaller segments.

How can I solve this problem without using smaller segments?

I also have run into this, though only very occasionally using latest Chrome and 6.16. We are also using 6 second long segment lengths. It is quite hard to reproduce, but causes a pipeline stop like the sample above. We do not see the visual artifact, but the video freezes and does not recover on seeks or other operations. We have only seen this on live DVR video, and unfortunately I cannot provide a stream.

I have slightly different output in the media internals.
```00:08:52 17 duration 10092.584598
00:09:01 608 duration 10099.124598
00:09:08 282 duration 10104.596598
00:09:18 59 duration 10116.608598
00:09:26 417 info Audio codec: mp4a.40.2. Sampling frequency: 22050Hz. Sampling frequency(Extension): 22050Hz. Channel layout: 3.
00:09:26 433 info Video codec: avc1.4D401F
00:09:26 438 debug Generated splice of overlap duration 23242us into new buffer at 9985933287us.
00:09:27 329 info Audio codec: mp4a.40.2. Sampling frequency: 22050Hz. Sampling frequency(Extension): 22050Hz. Channel layout: 3.
00:09:27 342 info Video codec: avc1.4D401F
00:09:28 694 info Audio codec: mp4a.40.2. Sampling frequency: 22050Hz. Sampling frequency(Extension): 22050Hz. Channel layout: 3.
00:09:28 706 info Video codec: avc1.4D401F
00:09:28 709 debug Generated splice of overlap duration 23242us into new buffer at 9973928571us.
00:09:28 816 duration 10128.620598
00:09:29 398 info Audio codec: mp4a.40.2. Sampling frequency: 22050Hz. Sampling frequency(Extension): 22050Hz. Channel layout: 3.
00:09:29 406 info Video codec: avc1.4D401F
00:09:34 660 duration 10134.626598
00:09:40 402 duration 10140.632598
00:09:41 133 debug Detected AAC midstream configuration change PTS:9998495283 Sample Rate: 44100 vs 22050, ChannelLayout: 3 vs 3, Channels: 2 vs 2
00:09:42 501 info Audio codec: mp4a.40.2. Sampling frequency: 44100Hz. Sampling frequency(Extension): 44100Hz. Channel layout: 3.
00:09:42 526 error Failed to prepare video sample for decode
00:09:42 526 error Append: stream parsing failed. Data size=131072 append_window_start=0 append_window_end=inf
00:09:42 527 pipeline_error chunk demuxer: append failed
00:09:42 527 event PAUSE
00:09:42 527 pipeline_state kStopping
00:09:42 534 pipeline_state kStopped

This is particularly troubling because our audio sample rates should be constant across bitrates. I don't know if this is related to #939 where the internal buffer is getting huge.
![bitratetable](https://cloud.githubusercontent.com/assets/532634/22157513/3dc3b050-def5-11e6-8a46-99335d20aa46.png)


*Chrome Log*
```player.component.ts:747 $$ onFragParsingData: data =  Object {id: "main", level: 1, sn: 2144, startPTS: 12152.999865524287, endPTS: 12158.990613823546…}
VM611:12937 [log] > Parsed video,PTS:[12153.000,12159.006],DTS:[12153.000/12159.006],nb:180,dropped:0
VM611:12937 [warn] > negative duration computed for frag 2037,level 1, there should be some duration drift between playlist and fragment!
(anonymous) @ VM611:12937
updatePTS @ VM611:8448
updateFragPTSDTS @ VM611:8418
onFragParsingData @ VM611:4410
onEventGeneric @ VM611:8017
onEvent @ VM611:8004
EventEmitter.emit @ VM611:97
trigger @ VM611:8697
onWorkerMessage @ VM611:6201
ZoneDelegate.invokeTask @ zone.js:265
onInvokeTask @ ng_zone.js:227
ZoneDelegate.invokeTask @ zone.js:264
Zone.runTask @ zone.js:154
ZoneTask.invoke @ zone.js:335
player.component.ts:747 $$ onFragParsingData: data =  Object {id: "main", level: 1, sn: 2144, startPTS: 12152.999865524287, endPTS: 12159.005876635398…}
VM611:12937 [log] > engine state transition from PARSING to PARSED
VM611:12937 [log] > latency/loading/parsing/append/kbps:1759/2676/40/14/1038
VM611:12937 [log] > main buffered : [11602.516,12179.859]
VM611:12937 [log] > engine state transition from PARSED to IDLE
VM611:12937 [log] > Loading 2148 of [0 ,2151],level 1, currentTime:12177.182,bufferEnd:12179.859
manifest-parser.service.ts:184 [ManifestParser] resolvedAdFragments:  true
manifest-parser.service.ts:185 [ManifestParser] swapAdUrlCount:  0
manifest-parser.service.ts:214 [ManifestParser] frag.sn:  2148
VM611:12937 [log] > engine state transition from IDLE to FRAG_LOADING
VM611:12937 [log] > Loaded  2148 of [0 ,2151],level 1
VM611:12937 [log] > engine state transition from FRAG_LOADING to PARSING
VM611:12937 [log] > Parsing 2148 of [0 ,2151],level 1, cc 45
VM611:12937 [log] > Parsed audio,PTS:[12177.012,12183.026],DTS:[12177.012/12183.026],nb:259,dropped:0
VM611:12937 [warn] > negative duration computed for frag 2037,level 1, there should be some duration drift between playlist and fragment!
(anonymous) @ VM611:12937
updatePTS @ VM611:8448
updateFragPTSDTS @ VM611:8418
onFragParsingData @ VM611:4410
onEventGeneric @ VM611:8017
onEvent @ VM611:8004
EventEmitter.emit @ VM611:97
trigger @ VM611:8697
onWorkerMessage @ VM611:6201
ZoneDelegate.invokeTask @ zone.js:265
onInvokeTask @ ng_zone.js:227
ZoneDelegate.invokeTask @ zone.js:264
Zone.runTask @ zone.js:154
ZoneTask.invoke @ zone.js:335
player.component.ts:721 $$ onFragChanged: frag =  Fragment {_url: "http://sprtott4-i.akamaihd.net/hls/live/222322/Coo…/VIDEO_5_664000/set_1/OTT4_VIDEO_5_664000_2148.ts", _byteRange: Array[0], _decryptdata: LevelKey, tagList: Array[3], duration: 6.013968253906569…}
player.component.ts:747 $$ onFragParsingData: data =  Object {id: "main", level: 1, sn: 2148, startPTS: 12177.011876635397, endPTS: 12183.025844889304…}
play-pause-button.component.ts:56 play-pause-button::ngOnChanges:  Object {playerState: SimpleChange, isEnabled: SimpleChange}
VM611:12937 [log] > Parsed video,PTS:[12177.024,12183.030],DTS:[12177.024/12183.030],nb:180,dropped:0
VM611:12937 [warn] > negative duration computed for frag 2037,level 1, there should be some duration drift between playlist and fragment!
(anonymous) @ VM611:12937
updatePTS @ VM611:8448
updateFragPTSDTS @ VM611:8418
onFragParsingData @ VM611:4410
onEventGeneric @ VM611:8017
onEvent @ VM611:8004
EventEmitter.emit @ VM611:97
trigger @ VM611:8697
onWorkerMessage @ VM611:6201
ZoneDelegate.invokeTask @ zone.js:265
onInvokeTask @ ng_zone.js:227
ZoneDelegate.invokeTask @ zone.js:264
Zone.runTask @ zone.js:154
ZoneTask.invoke @ zone.js:335
player.component.ts:747 $$ onFragParsingData: data =  Object {id: "main", level: 1, sn: 2148, startPTS: 12177.023865524287, endPTS: 12183.029876635397…}
VM611:12937 [log] > engine state transition from PARSING to PARSED
VM610:590 [Html5PlayerInterface] Reporting error: code=3 message=MEDIA_ERR_DECODE
app.component.ts:222 ### notify MEDIA_STATE_CHANGE
play-pause-button.component.ts:56 play-pause-button::ngOnChanges:  Object {playerState: SimpleChange}
VM610:590 [Html5PlayerInterface] Received HTML5 event: pause. Mapped to Conviva player state: PAUSED
VM610:590 [Html5PlayerInterface] Changing Conviva player state to: PAUSED
vast-manager.service.ts:77 [VastTracker] pause >> id: 254042 ad#: 2 of 3
VM611:12937 [error] > sourceBuffer error:[object Event]
(anonymous) @ VM611:12937
onSBUpdateError @ VM611:2159
ZoneDelegate.invokeTask @ zone.js:265
onInvokeTask @ ng_zone.js:227
ZoneDelegate.invokeTask @ zone.js:264
Zone.runTask @ zone.js:154
ZoneTask.invoke @ zone.js:335
VM611:12937 [error] > trying to append although a media error occured, flush segment and abort
(anonymous) @ VM611:12937
doAppending @ VM611:2392
onSBUpdateEnd @ VM611:2151
ZoneDelegate.invokeTask @ zone.js:265
onInvokeTask @ ng_zone.js:227
ZoneDelegate.invokeTask @ zone.js:264
Zone.runTask @ zone.js:154
ZoneTask.invoke @ zone.js:335
VM611:12937 [log] > media source ended
VM611:12937 [log] > loading playlist for level 1
player.component.ts:855 $$$ hls.js::onAdCuesChange:  [AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue, AdCue]
VM611:12937 [log] > live playlist, reload in 5437 ms
VM611:12937 [log] > level 1 loaded [0,2152],duration:12226.078999999801
VM611:12937 [warn] > negative duration computed for frag 2037,level 1, there should be some duration drift between playlist and fragment!
(anonymous) @ VM611:12937
updatePTS @ VM611:8448
updateFragPTSDTS @ VM611:8418
mergeDetails @ VM611:8366
onLevelLoaded @ VM611:4188
onEventGeneric @ VM611:8017
onEvent @ VM611:8004
EventEmitter.emit @ VM611:97
trigger @ VM611:8697
loadsuccess @ VM611:9752
XhrLoader.onSuccess @ xhr-loader.ts:190
(anonymous) @ xhr-loader.ts

It happens with videos having a very high bitrate like 30mbps.
I've set up a test for this now, but the problem is that the site is not serving the files quickly enough.
So, for testing this, you would have to download the files and serve from a local webserver:
https://hlstest.000webhostapp.com/hls/

by default hls.js tries to guarantee at least config.maxBufferLength buffer upfront video.currentTime . the default value is 30s
each of your frag is around 70MB, for 10s. the issue is that browser MSE internal memory is around 60 - 120 MB
once this limit will be reached (basically more than 2 frag buffered), a SourceBuffer full error will be raised by MSE stack
you need to lower this value for your specific case.
FYI I was able to play your stream with chrome and FF with config.maxBufferLength=20

here are chrome buffer limits
https://cs.chromium.org/chromium/src/media/filters/source_buffer_platform.cc?l=9
12 MB for audio, 150 MB for video

Thanks @mangui!

I have reduced fragment file size and everything seems to run smoothly thus far. Closing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fredvb picture fredvb  Â·  3Comments

krsvital picture krsvital  Â·  3Comments

dan-ziv picture dan-ziv  Â·  4Comments

shalommeoded picture shalommeoded  Â·  3Comments

neuman picture neuman  Â·  4Comments