I use the xupnpd2 media server (https://github.com/clark15b/xupnpd2) on the router to stream a few HLS streams to the TV. The software would have to be extended by HTTPS and the HLS processing adapted (eg for HLS streams from https://www.mall.tv/zive). Unfortunately, the original author does not answer anymore. Unfortunately, I'm not a developer.
My idea is, when selecting the stream on the TV, the script xupnpd.lua should start a httpd (from busybox) and an ffmpeg (without re-encoding), that receives the stream from the Internet, stores locally as HLS streams on the routers internal memory and deliveres to xupnpd2.
Unfortunately, such a script does not exist when quitting a stream (quitting https and ffmpeg). xupnpd2 has built in a logger that lets you find out when the stream is started and stopped as a childprocess. The internal memory of the router is certainly too small for the logfile. Unfortunately, I am not familiar with the passing on and evaluation via a syslog on the box.
Messages when starting the stream:
run child, pid = 1234 using handler 'hls' for 'http: // ...'
exit child, pid = 1234
Is it possible to filter the log messages using an external script that caches the child PID when a particular stream is started (filterable via the URL) and filters for the child PID when the stream is ended, and then ends httpd and ffmpeg, and deletes the .ts segments and the .m3u8 playlist?