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

Save HLS fragments and playlist in file system (HDD/SSD) for less RAM footprint #1322

Closed
AlienJust opened this issue Dec 21, 2022 · 8 comments · Fixed by #1567
Closed

Save HLS fragments and playlist in file system (HDD/SSD) for less RAM footprint #1322

AlienJust opened this issue Dec 21, 2022 · 8 comments · Fixed by #1567
Labels
enhancement New feature or request hls

Comments

@AlienJust
Copy link

Describe the feature

Is it possible to store video fragments on file system?
I have about 20 cameras and want to have access to their videos last 48h. IMO it is too many fragments to keep them RAM but would be easy with 1TB SSD :-)

@aler9 aler9 added the enhancement New feature or request label Jan 8, 2023
@aler9 aler9 added the hls label Jan 24, 2023
@symonenkob
Copy link

+1 Would be a great feature if implemented out of the box for llhls and hls!

It is possible, however, to achieve the following behavior by using ffmpeg and runOnReady but the segments will be generated with some delay. It did not work for us because we had to synchronize livestream and the recorded video afterwards (users may trigger some events on a live video and we must reproduce them on a recorded video). I was seeing a fragments saving delay ~2.5 sec from the live stream and use of EXT-X-PROGRAM-DATE-TIME did not help because ffmpeg overrides the original time with a system time at the moment of segment generation.
The command looks like this and I am sure it can be improved a bit.
runOnReady: ffmpeg -y -i https://localhost:8888/videostream/stream.m3u8 -c copy -f hls -live_start_index 0 -hls_list_size 0 -hls_flags +program_date_time+independent_segments -strftime 1 -hls_segment_filename 'stream_%Y%m%dT%H%M%S%z.ts' stream.m3u8

@aler9
Copy link
Member

aler9 commented Mar 11, 2023

This is being implemented in bluenviron/gohlslib#2

@aler9
Copy link
Member

aler9 commented Mar 12, 2023

implemented here: #1567

@aler9
Copy link
Member

aler9 commented Apr 1, 2023

added in v0.22.0

@marcosalberto
Copy link

Hi @aler9,

Does this feature allow using multiple mediamtx replicas in a load balancer to distribute resource usage?

Thanks for this great project.

@aler9
Copy link
Member

aler9 commented Apr 12, 2023

@marcosalberto if you want to distribute the load, use a set of HTTP caching proxies (like Squid) in front of MediaMTX. The content of a folder nowadays is not enough to produce a modern HLS stream, since it doesn't allow to provide blocking request (i.e. the ability of freezing a user request until a certain playlist or segment is available) and low-latency parts (which are not saved to disk).

This feature is intended for offloading segments from RAM, since segments occupy a significant fraction of the RAM.

@marcosalberto
Copy link

@aler9 thank you, we will check about Ingress Session Affinity to accomplish that on Kubernetes enviroment.

@github-actions
Copy link
Contributor

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.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request hls
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants