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

Fix HLS muxing #4401

Merged
merged 3 commits into from
Mar 12, 2025
Merged

Fix HLS muxing #4401

merged 3 commits into from
Mar 12, 2025

Conversation

toots
Copy link
Member

@toots toots commented Mar 12, 2025

There was a subtile bug in HLS muxing:

  • A id3 data stream is added to mpegts but metadata is sparse. However, ffmpeg still considers it as a stream to be interleaved.
  • The default for muxing is to interleaved when there is more than one stream.
  • The default logic above was broken.

This is tricky to fix so the changes here:

  • Add a id3 packet at stream init. This unblocks initial interleaved write when needed.
  • Fix the default interleaving logic

This shows good behavior with normal encoding params.

Some users will still need to forcefully set interleaved = false on the encoder.

The reason we're not doing this by default on hls streams is that this can also result in un-balanced A/V streams where too much audio is present etc.

tl;dr: HLS is hard and to make it work you need to properly understand your configuration. But for simple use-case like audio-only streams, this should behave just fine.

Fixes: #4398

@toots toots enabled auto-merge March 12, 2025 16:59
@toots toots added this pull request to the merge queue Mar 12, 2025
Merged via the queue into main with commit 229719d Mar 12, 2025
34 checks passed
@toots toots deleted the hls-fix-muxing branch March 12, 2025 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[output.hls] zero-length first segment
1 participant