jwz

Further HLS antics


Listen Later

I think maybe I have gotten the DNA Lounge webcast behaving better, but not entirely, and I could use some help understanding what's going wrong.

I think one of the things that did help was increasing the segment size from 2s to 6s, which flies in the face of 100% of the advice online.

I have also gotten my hls-continuity thing working again, which is the HLS proxy that I wrote with the intent that the stream should never stop sending video even when the source disconnects. I had to basically rewrite it to work with mediamtx instead of nginx, and I don't really understand what about it meant that it had been working fine with nginx, but was working decidedly not-fine with mediamtx. But it seems to mostly be working now?

A few things about it are a little wonky, and if someone who understands this crap could help me diagnose this, that would be greatly appreciated:

  1. When it goes into colorbars mode, the player often does a little "loading" animation for a few seconds before showing the first colorbars segment. I absolutely do not understand why this is, because the m3u8 file already has the proper duration and number of segments. I believe all segments start with a keyframe.

  2. When coming out of colorbars mode and going back to real video, sometimes the video frame is frozen. Audio continue playing. Video comes back "after a while" or if you bonk the play-head slider.

  3. When I was serving the raw, non-proxied stream from mediamtx, the player's play-head behaved as I expected: always pegged to the right side, with the "live" light lit up. But with my proxy in place, very often the play-head will end up lagging behind. Even when colorbars are not involved. Dragging it to the right or bonking the "live" button brings it back, but shortly it happens again.

    As the proxy does not transcode video -- it uses exactly the same TS files, just with a regenerated m3u8 file with different sequence numbers -- I do not understand how this is possible or what is different.

  4. Sometimes I'll go a whole day without it going into colorbars mode. Sometimes, like right now for instance, it happens a lot, and usually for short durations, like 12 seconds / 2 segments. It seems that mediamtx is behaving as if the source had disconnected and then immediately reconnected. I don't know whether to blame OBS, mediamtx, Monkeybrains, or all three.

    OBS consistently says 0 dropped frames, 4% CPU.

    Sometimes I see this: the internal mediamtx will say:

    2025/06/13 14:06:14 WAR [RTMP] [conn [::1]:52386] connection is too slow, discarding 2 frames 2025/06/13 14:06:15 WAR [RTMP] [conn [::1]:52386] connection is too slow, discarding 26 frames 2025/06/13 14:06:18 WAR [RTMP] [conn [::1]:52386] connection is too slow, discarding 10 frames 2025/06/13 14:06:19 WAR [RTMP] [conn [::1]:52386] connection is too slow, discarding 37 frames 2025/06/13 14:06:20 WAR [RTMP] [conn [::1]:52386] connection is too slow, discarding 35 frames 2025/06/13 14:06:21 WAR [RTMP] [conn [::1]:52386] connection is too slow, discarding 2 frames 2025/06/13 14:06:25 INF [RTMP] [conn [::1]:52386] closed: too many reordered frames (27) 2025/06/13 14:06:30 INF [RTMP] [conn [::1]:52427] opened

    and the external one will say:

    2025/06/13 14:06:25 INF [RTMP] [conn 52.119.114.44:52388] closed: EOF 2025/06/13 14:06:25 INF [HLS] [muxer live] destroyed: terminated 2025/06/13 14:06:33 INF [RTMP] [conn 52.119.114.44:52429] opened

    This sounds like the server is hanging up on OBS and it is reconnecting, but OBS doesn't give me any indication of that.

    It says a connection is too slow, but how could the connection between localhost OBS and localhost mediamtx be too slow, with 4% OBS load, load average 1.7, on a Mac mini M1? OBS is using Apple hardware MPEG encoding. (Or when it says "too slow" is it referring to the outgoing uplink connection? How would it even know?)

  5. Also sometimes the external server says this, which, WTAF, how is this even possible? Sometimes that number just keeps going up:

    2025/06/13 14:13:08 WAR [HLS] [muxer live] segment duration changed from 6s to 8s - this will cause an error in iOS clients

Ways in which you could help me out with this:

  1. Examine the DNA Lounge video stream as-is, and tell me what seems to be wrong with it; or

  2. Run hls-continuity.pl on your own system, proxying your own OBS / mediamtx stream, and see if you can detect any problems with that when you toggle the source on and off.

The Bothans thank you in advance.

Previously, previously, previously.

...more
View all episodesView all episodes
Download on the App Store

jwzBy