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
Live audio out-of-sync (fMP4, 12 segment manifest size, 60000/1001 fps) #2545
Comments
@elv-peter Thank you for reporting the issue. Changed |
One of the things I've noticed is that hls.js attempt to sync the main and audio track playlist is pretty flawed, and consistently thrown off when each playlist updates at different intervals. You'd think we'd try using sequence-number, at least until PDT or internal timecode is known, but it seems to just try to align the indexes, and then all the code that established timecode offsets for each list messes things up... Sorry I don't have a more accurate description of the problem, but there's a good deal of work necessary to clean this up and make it reliable. It is a priority for me though so stay tuned. |
Let me know if I can do anything to help. I don't mind taking a stab at it, but that's with zero knowledge of the codebase. |
I noticed that my test is in-sync on the feature/v1.0.0 branch. Did you fix something already? |
@elv-peter No. I’ve observed that sync depends on the initial playlist responses when you first load the stream. There are differences in v1’s handling at startup. The bug is still there. |
@robwalch thanks very much for working this. do you have any idea an eta on a fix? understand that it is tedious. |
@elv-peter there's a bit of a problem with your script. It updates the playlist faster than realtime - basically as fast as ffmpeg can write the segments. I need a an example that will update at clock speed so that playback and buffering can keep up with the playlist window. I ended up adding |
Hi @elv-peter, Let me know if v0.14.6 resolves the audio sync problem for you. From what I can tell, #2919 fixed it. Feel free to open a new issue or comment here with additional information if that's not the case. |
What version of Hls.js are you using?
v0.13.2
What browser and OS are you using?
Chrome MacOS
Test stream:
You can generate one locally with this script: https://gist.github.com/elv-peter/eb37e930047ebaa8a4b228ae723e0288
Usage:
./sync_test.sh ffmpeg
Use any HTTP server to serve the output, e.g. nodejs:
http-server . -p 80 --cors
We will try to host this stream as well (TBD)
Checklist
Actually, I think this might be the same issue as #1733 by @fredvb, but I'll create this ticket since the other is closed.
Steps to reproduce
Generate the stream using the script above, then wait about 5 minutes. Play the stream in the HLS.js player to check if the audio is synced when loaded.
It's always reproducible, though sometimes the player will be in sync when the stream is loaded - I don't know exactly what situations.
Expected behavior
What you expected to happen
The beeps should match the video. Safari and Bitmovin handle it properly I think.
Actual behavior
What actually happened
The audio is synced if you join the stream from the beginning. However, if you join the live stream after some time has past, sometimes the audio is out-of-sync.
My best guess at what is going on is that HLS.js chooses the correct audio and video segments to load, but does not synchronize them when it starts playing. That is, if the segments are not PTS-aligned, then audio will be out-of-sync. For example, the following is 1 second off (1000 vs 1001 seconds):
Console output
The text was updated successfully, but these errors were encountered: