Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playback stopping with Buffer stalled error #2893

Closed
4 of 5 tasks
vobruba-martin opened this issue Jul 15, 2020 · 9 comments
Closed
4 of 5 tasks

Playback stopping with Buffer stalled error #2893

vobruba-martin opened this issue Jul 15, 2020 · 9 comments
Labels
Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. Wontfix

Comments

@vobruba-martin
Copy link

vobruba-martin commented Jul 15, 2020

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:

Test stream

Checklist

  • The stream has correct Access-Control-Allow-Origin headers (CORS)
  • 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

@robwalch
Copy link
Collaborator

Give this fix a try if you can disable CORs on your test stream #2894

@robwalch
Copy link
Collaborator

robwalch commented Jul 16, 2020

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

@robwalch robwalch added Invalid Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. and removed Invalid labels Jul 16, 2020
@vobruba-martin
Copy link
Author

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}

@robwalch
Copy link
Collaborator

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.

@vobruba-martin
Copy link
Author

vobruba-martin commented Jul 16, 2020 via email

@robwalch
Copy link
Collaborator

robwalch commented Jul 16, 2020

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:
Screen Shot 2020-07-16 at 11 28 30 AM

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.

@Lilsax
Copy link

Lilsax commented Nov 7, 2022

@robwalch what tool u are using to anaylsis any stream

@robwalch
Copy link
Collaborator

robwalch commented Nov 7, 2022

@robwalch what tool u are using to anaylsis any stream

The HLS.js demo page: https://hls-js.netlify.app/demo/

@RTUnit
Copy link

RTUnit commented Jan 3, 2023

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: jellyfin/jellyfin#8744

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. Wontfix
Projects
None yet
Development

No branches or pull requests

4 participants