xteve-project / xTeVe

M3U Proxy for Plex DVR and Emby Live TV
MIT License
1.79k stars 231 forks source link

keep HDHR streams open so streams come up much faster #201

Open syadnom opened 3 years ago

syadnom commented 3 years ago

Is your feature request related to a problem? Please describe. There is a delay for the first viewer from xteve initiating a stream from an HDHomeRun, the HDHR tuning the channel, and then delivering that to Plex/Emby. The second viewer on the other hand is MUCH quicker to get the feed as the HDHR is already setup and sending to xteve.

Describe the solution you'd like I would like xteve to be able to 'idle' a tuner. Ie, keep the video flowing even when no clients in plex/emby are connected so they get the stream much faster.

This log entry: Channel: CBS - No client is using this channel anymore. Streaming Server connection has ended I'd basically want it to say Channel: CBS - No client is using this channel anymore, streaming to NULL awaiting client or something like that.

Describe alternatives you've considered Hitting xteve with mplayer in a script and pushing the video to null.... It's a brute force method but the slowness of the streams is irritating. I've also considered running separate instances of ffmpeg for each channel and then having xteve handle those via M3U file but that's also a brute force method.

Additional context I'm transcoding in xteve specifically so I can push h.265 through to plex/emby via the qsv encoder. I'm setting this to my desired bitrate so my clients direct stream it. That's adding 1-2 seconds PLUS the 6-8 seconds to get the HDHR streaming.

I want to deliver almost exclusively h.265 to my clients and since plex nor emby support transcoding to h.265, I'm doing in xteve. ffmpeg mod: "-hide_banner -loglevel error -i [URL] -c:v hevc_qsv -preset slow -adaptive_i 1 -adaptive_b 1 -load_plugin hevc_hw -b 4M -vf yadif=0:-1:1 -c:a aac -b:a 128k -f mpegts pipe:1"

This works really really well with the exception of the startup delay for the first viewer. Emby is even dropping hevc ts files in for recordings so I'm quite happy with it as is, but this would be a very welcome update.

mar-mei commented 3 years ago

If the stream is keep up all the time, it can never be terminated.The delay comes from the buffer, the higher the buffer, the longer it takes until the first data is available. If you use FFmpeg or VLC it takes even longer because these programs have to start first. If a second client requests the same stream, it is faster because the data is already available. That cannot be accelerated either.

If the stream is keep up all the time, it can never be terminated.

syadnom commented 3 years ago

That's the desired behavior. I want the stream running 24x7. I'm making a 1:1 match for tuner:channel so I really do want tuner0 to always be channel2 and tuner1 to be channel4 and so on.

mar-mei commented 3 years ago

That won't work with xTeVe. If certain channels always remain open, other users would have completely different problems.