This is exactly why I love open source. I fixed my tuning issue where when I would restart one of my encoders, tuning would initially fail.
It's a change to main.go Wrap encoder body in stall-tolerant reader (option 3) · mackid1993/ah4c@1bdc0f2 · GitHub
Essentially when you reboot your HDMI encoder (or any time bmitune.sh switches channels on a cold tuner), the encoder needs a few seconds to lock onto the new source. During that window it either stops sending TS data or closes the connection entirely. AH4C currently passes the encoder's stream straight through to Channels DVR, so when the encoder hiccups, Channels DVR sees the stream die and gives up on the tune. You end up having to start it again.
This patch puts a small buffering layer between the encoder and Channels DVR. AH4C reads from the encoder into a queue, and Channels DVR reads from the queue. If the encoder closes the connection or goes quiet for more than 5 seconds, AH4C reconnects to it behind the scenes and keeps trying until it works.
The part that makes this actually solve the problem: while AH4C is reconnecting (or the encoder is just paused), Channels DVR keeps getting MPEG-TS NULL packets, the standard "filler" packets every TS demuxer drops. From Channels DVR's side, bytes are still flowing, so it doesn't time out. As soon as the encoder is producing real data again, the NULLs stop and the real stream takes over seamlessly.
Normal warm tunes are unaffected, same speed as today. The recovery only kicks in when something actually breaks, and when it does, you don't have to do anything. The tune just works. @bnhf maybe you can take a look at this and see if maybe you can make it better as you always do but I will also open a PR to make things easier.
edit: (fix) Tuning fails after rebooting HDMI encoder by mackid1993 · Pull Request #9 · sullrich/ah4c · GitHub
If anyone wants to try this build, I published it at: ghcr.io/mackid1993/ah4c:latest. Hopefully it helps reliability for some other people too and can be considered for merging into main.