savonet / liquidsoap

Liquidsoap is a statically typed scripting general-purpose language with dedicated operators and backend for all thing media, streaming, file generation, automation, HTTP backend and more.
http://liquidsoap.info
GNU General Public License v2.0
1.39k stars 128 forks source link

Add support for low-latency HLS #2246

Open smimram opened 2 years ago

smimram commented 2 years ago

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

moleculezz commented 1 year ago

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.

toots commented 1 year ago

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?

moleculezz commented 1 year ago

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.

toots commented 1 year ago

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)
moleculezz commented 1 year ago

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)?

toots commented 1 year ago

Shouldn't be, no