liquidsoap icon indicating copy to clipboard operation
liquidsoap copied to clipboard

Add support for low-latency HLS

Open smimram opened this issue 4 years ago • 6 comments

This would be nice and useful (e.g. #2219). Some doc here: https://developer.apple.com/documentation/http_live_streaming/enabling_low-latency_hls

smimram avatar Feb 14 '22 20:02 smimram

Yes, this would be useful for our usecase. We do phone calls during live broadcast and the delay with HLS is too great to be usable.

moleculezz avatar Apr 12 '23 12:04 moleculezz

I have had a look at the specs. Low-latency HLS heavily depends on specifics of the user-facing server. This does not seem to be a good fit for us, where liquidsoap typically is not exposed to listeners load for stability (also, our webserver currently cannot handle it).

I'd be down to consider other way to inter-operate with a third party solution, though. What are the low-latency HLS servers currently available? How do they operate?

toots avatar May 04 '23 14:05 toots

What are the low-latency HLS servers currently available? How do they operate?

I have yet to find one currently available. I've been searching for one but have not found one yet. I have spoken to support from RSAS, they have HLS support, but they have not yet considered LL-HLS

EDIT: Looking again and I found this mediamtx.

moleculezz avatar May 04 '23 14:05 moleculezz

Great @moleculezz you should be able to send a RTSP stream using the %ffmpeg encoder I believe.

To lower. latency, you'd have to use a short frame duration. There was a similar situation described for alsa here: https://www.liquidsoap.info/doc-2.1.4/cookbook.html#alsa-unbuffered-output

Essentially, you should be able to do this:

# Set correct frame size:
# This makes it possible to set any audio frame size.
# Make sure that you do NOT use video in this case!
video.frame.rate.set(0)

# Now set the audio frame size exactly as required:
settings.frame.audio.size.set(2048)

toots avatar May 05 '23 14:05 toots

Great @moleculezz you should be able to send a RTSP stream using the %ffmpeg encoder I believe.

So, there is no need to send a HLS stream from the source. So only HLS at the server (mediamtx)?

moleculezz avatar May 05 '23 17:05 moleculezz

Shouldn't be, no

toots avatar May 05 '23 17:05 toots