chrisbenincasa / tunarr

Spiritual successor to dizqueTV
https://tunarr.com/
zlib License
120 stars 11 forks source link

Create feature for max number of spawned ffmpeg processes #687

Open chrisbenincasa opened 1 month ago

chrisbenincasa commented 1 month ago

We should allow users to configure how many simultaneous ffmpeg instances are running at any single time, with more recent stream/concat process pairs favored.

The reason we need this is because some session-based streaming uses an inactive timeout before killing the backing ffmpeg processes. So, when flipping quickly between channels, users can theoretically spawn many ffmpeg processes while Tunarr waits for the inactive signal. Instead, we can be proactive in scenarios like this and just start killing the longest-lived process pairs. If we want to get really clever, we could also key this by client so one client cannot kill another's stream, but this option can be added later.

chrisbenincasa commented 1 week ago

This is especially necessary now as the default streaming setup for MPEGTS will spawn 3(!) ffmpeg processes: 1 for the underlying stream, 1 to great HLS segments, and 1 to concat those segments back together