restreamer
restreamer copied to clipboard
FFmpeg memory leaks (until OOM) when got Non-monotonous DTS error
Describe the bug
I have many RTP/UDP multicast sources from a streamer that is pulling Free to Air TV channels from a satellite. Sometimes, one or two channel source got a little bit bad, then from the Process Details log, I got bunch of DTS error like this:
output omitted..
@1697789423 [hls] Non-monotonous DTS in output stream 0:1; previous: 999202502, current: 894696902; changing to 999202503.
output omitted..
The channel's video itself runs fine, but the audio is gone, I hear nothing. FFMpeg memory usage was also fine until this error came and eats a lot of memory that can cause OOM for the container.
I have tried using different fflags like the genpts, igndts, discard_corrupt, etc.. and tried using the use_wallclock_as_timestamps or copyts, or start_at_zero. All of them does nothing to prevent or even to restart the stream. Because the process simply needed to be restarted, and I have done this manually by clicking the disconnect and connect button, that its always working back normal again, until another DTS error came back.
To Reproduce Steps to reproduce the behavior:
- Try to make a stable multicast stream to an unstable multicast stream. e.g lowering the total bitrate than the effective bitrate, or wait for a cloud/storm that the FTA satellite signal may get disturbed or lost (because its free).
- Go to each channel and inspect the log inside the process details button
- See error
Expected behavior The ffmpeg / restreamer can automatically restarts the process if DTS error happens so much (sometimes if its only happening a little bit it can corrects by itself)
Screenshots
DTS Error logs
One of the ffmpeg process that is starting to eats ram (normally only using 0.3%, and it will spike until OOM kicks out)
Additional context
I noticed there are memory_mbytes and the memory_bytes variable inside the Process report log button which is used to set the memory limit and read the current memory usage of the ffmpeg process. Why don't we set it from the GUI, because its a little bit annoying that I need to set limit inside the db.json manually for all of the channel so that it won't eat RAM more than I allowed to. But it is more annoying that sometimes after I set that, it came back to default values '0' (which is unlimited). I would be thankful if we can set the limit in each channel on the GUI, or even set it for all channel
I really want to use this tool because it has bunch of features.. Any suggestions is appreciated, maybe I'm missing something because I just recently used Restreamer with this setup I can provide additional info if needed, thank you guys..
This seems to be a bug in ffmpeg itself. With a later version this might get fixed.
Regarding your suggestion for setting the memory and CPU limits for a process, we will put it on our feature request list.
okay thank you.. I really appreciate it!