Playback stopping with Buffer stalled error
What version of Hls.js are you using?
0.12.4 and 0.14.2
What browser and OS are you using?
Chrome on Linux/Mac/Windows
Test stream:
Checklist
- [ ] The issue observed is not already reported by searching on Github under https://github.com/video-dev/hls.js/issues
- [x] The issue occurs in the stable client on https://hls-js.netlify.com/demo and not just on my page
- [x] The issue occurs in the latest client on https://hls-js-dev.netlify.com/demo and not just on my page
- [x] The stream has correct Access-Control-Allow-Origin headers (CORS)
- [x] There are no network errors such as 404s in the browser console when trying to play the stream
Expected behavior
Play the whole video
Actual behavior
Playback stops after a while. Usually after 10/20/30/40 seconds.
Browser caching is hiding this issue for me so it is better to test with caching disabled (Developer tools > Network > Disable cache checked).
Seems like this is related to #2320
Give this fix a try if you can disable CORs on your test stream https://github.com/video-dev/hls.js/pull/2894
The stream appears to get stuck in Safari as well setting video.src = (your test stream).
hls.js reports only finding one second of audio in the first segment which should have a duration of 5 seconds:
[log] > Parsed audio,PTS:[0.000,1.022],DTS:[0.000/1.022],nb:44,dropped:0
hls.js:21439 [log] > Parsed video,PTS:[0.023,5.023],DTS:[0.023/5.023],nb:125,dropped:0
sn 2 and 3 on the 720p level have no audio. This appears to be a problem with your stream. There's an audio track with no codec and 0 channels specified (and hls.js finds no audio samples in the file).
$ ffprobe -i "https://cdn6.myairbridge.com/preview/video/vZBEQ7O63Nda1mubtaN7X1zXZ8nM1dV5fa6c1tzW/240p/segment_00001.ts/?sig=anysigshallpass"
[mpegts @ 0x7fb35f00b400] start time for stream 0 is not set in estimate_timings_from_pts
[mpegts @ 0x7fb35f00b400] stream 0 : no TS found at start of file, duration not set
[mpegts @ 0x7fb35f00b400] Could not find codec parameters for stream 0 (Audio: aac ([15][0][0][0] / 0x000F), 0 channels, fltp): unspecified sample rate
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'https://cdn6.myairbridge.com/preview/video/vZBEQ7O63Nda1mubtaN7X1zXZ8nM1dV5fa6c1tzW/240p/segment_00001.ts/?sig=anysigshallpass':
Duration: 00:00:05.00, start: 6.423222, bitrate: 253 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Audio: aac ([15][0][0][0] / 0x000F), 0 channels, fltp
Stream #0:1[0x101]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 426x240 [SAR 1:1 DAR 71:40], 25 fps, 25 tbr, 90k tbn, 50 tbc
Looks like the 0-channel layout is a bug in FFmpeg (4.2.2 and lower). But if I reencode the video using version 4.3.1 the audio looks good:
Input #0, mpegts, from 'https://cdn5.myairbridge.com/preview/video/ckZiRrLD2ejvJlgYXx9YosyyAEvM2BDOeZQXZJdu/240p/segment_00000.ts/?sig=anysigshallpass':
Duration: 00:00:05.02, start: 1.400000, bitrate: 260 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 4 kb/s
Stream #0:1[0x101]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 426x240 [SAR 1:1 DAR 71:40], 25 fps, 25 tbr, 90k tbn, 50 tbc
Now the new test stream stops near the end:
...
[warn] > Dropping 1 audio frame @ 595.035s due to -594013 ms overlap.
[warn] > Dropping 1 audio frame @ 595.035s due to -593990 ms overlap.
[warn] > Dropping 1 audio frame @ 595.035s due to -593966 ms overlap.
...
[warn] > Playback stalling at @594.947458 due to low buffer (buffer=0.08709799999996903)
Error event: {type: "mediaError", details: "bufferStalledError", fatal: false, buffer: 0.08709799999996903}
Still encountering segments without audio with the new test stream. While hls.js has some code to fill missing audio, it's not working with this stream. Since this new stream also stalls in Safari, I wouldn't expect it to.
I tried both streams in Safari on iPhone (iOS 13.6) and both play well. It just takes a few seconds before Safari starts playing them.
čt 16. 7. 2020 v 17:10 odesílatel Rob Walch [email protected] napsal:
Still encountering segments without audio with the new test stream. While hls.js has some code to fill missing audio, it's not working with this stream. Since this new stream also stalls in Safari, I wouldn't expect it to.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/video-dev/hls.js/issues/2893#issuecomment-659476141, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUUCRFKW732SKR6IWHI5QDR34J7BANCNFSM4O2SKMEQ .
You can see in the timeline panel where the audio buffer is falling short of the video buffer. This is why loading and playback is stalled:

In the console it appears that hls.js is attempting to fill empty audio, but for whatever reason it is not keeping up with the video:
[warn] > remux empty Audio
remuxEmptyAudio @
remux @
There might also be segments with some audio (like 1s of audio to 5s of video) and in those places the missing audio is not filled:
[log] > Parsed audio,PTS:[0.000,1.022],DTS:[0.000/1.022],nb:44,dropped:0
[log] > Parsed video,PTS:[0.023,5.023],DTS:[0.023/5.023],nb:125,dropped:0
I'm just not sure if this is a bug in hls.js or this is just a bad stream. mediastreamvalidator doesn't complain about the contents of your TS files, but the amount of buffering in Safari is suspicious, and I'm not inclined to provide a fix. Hopefully the information here is enough for you to look at the code and come up with a patch of your own.
@robwalch what tool u are using to anaylsis any stream
@robwalch what tool u are using to anaylsis any stream
The HLS.js demo page: https://hls-js.netlify.app/demo/
I have similar problem with bufferStalledError. I just clarified that my RAM disk is getting full which I use for transcoding. Next stream (ts file) is created empty due to lack of space, and the HLS player is stalling when it loads to play it.
There is a new feature that enables transcode throttling and deleting of old fragments that were passed to the client which I hope will fix my problem: https://github.com/jellyfin/jellyfin/pull/8744