bluenviron / mediamtx

Ready-to-use SRT / WebRTC / RTSP / RTMP / LL-HLS media server and media proxy that allows to read, publish, proxy, record and playback video and audio streams.
MIT License
12.15k stars 1.52k forks source link

LLHLS - seek issue #999

Closed EvgIL74 closed 2 years ago

EvgIL74 commented 2 years ago

Hi, I tried to use llhls and its working very good in real-time (latency around 5 sec) until i tried to seek back in hls.js player. I put hlsSegmentCount: 20000. It didn't work properly and got spinning circle. I tried multiply time and its same phenomena. Is some limit with seek ?

mpisat commented 2 years ago

yml file has a configuration for it.

Number of HLS segments to keep on the server.

Segments allow to seek through the stream.

Their number doesn't influence latency.

hlsSegmentCount: 7

maybe increase it to your needs?

EvgIL74 commented 2 years ago

Look at the previous post where I changed hlsSegmentCount to 20000 in the yml file. It's looking like the exe file grows up compared to hlsSegmentCount = 7, but it doesn't help the seek procedure.

EvgIL74 commented 2 years ago

Look at the previous post where I changed hlsSegmentCount to 20000 in the yml file. It's looking like the exe file grows up compared to hlsSegmentCount = 7, but it doesn't help the seek procedure.

EvgIL74 commented 2 years ago

yml file has a configuration for it.

Number of HLS segments to keep on the server.

Segments allow to seek through the stream.

Their number doesn't influence latency.

hlsSegmentCount: 7

maybe increase it to your needs?

Look at the previous post where I changed hlsSegmentCount to 20000 in the yml file. It's looking like the exe file grows up compared to hlsSegmentCount = 7, but it doesn't help the seek procedure.

mpisat commented 2 years ago

hls.js has limits in configuration, you may need a bigger buffer back to rewind. https://github.com/video-dev/hls.js/blob/master/docs/API.md

EvgIL74 commented 2 years ago

I found something suspicious with #EXT-X-GAP when I defined hlsSegmentCount to 20000. HLS file includes #EXT-X-GAP - 20000 times and first segment is seg20000.mp4.

EXT-X-GAP

EXTINF:1.00000,

gap.mp4

EXTINF:1.00000,

seg20000.mp4

EXTINF:1.00000,

seg20001.mp4

In this case HLS player calculates 5 hours stream duration when I started stream few seconds ago.

aler9 commented 2 years ago

Hello, at the moment gaps are inserted in place of segments when the number of generated segments is less than hlsSegmentCount. This is because tests showed that LL-HLS works well on iOS only when segments are at least 7. Therefore, gaps are needed in order to react at least 7 segments.

But i understand that this behavior is not optimal in case someone is interested into seeking, as gaps mess up the duration.

A new behavior could consist into adding at maximum 6 gaps, even when hlsSegmentCount is much greater than 7. This new behavior needs to be tested with iOS in order to check compatibility.

aler9 commented 2 years ago

Now the server creates only 7 gaps instead of a number of gaps equal to hlsSegmentCount. This means that this issue is fixed.

aler9 commented 2 years ago

added in v0.19.3

github-actions[bot] commented 1 year ago

This issue is being locked automatically because it has been closed for more than 6 months. Please open a new issue in case you encounter a similar problem.