I've been polishing up a new "autocrop" capability for ah4c. This is something that will appeal particularly to Xfinity customers that also have a LinkPi Encoder.
As Xfinity subscribers know, there are six premium movie channels offered, that are broadcast with black borders on all four sides. This is annoying to say the least, and generally results in those channels not being watched.
I though about using ffmpeg for this project, but that would mean using CPU/GPU power on a Docker host to re-process a stream already being encoded. It made more sense to me to do the needed cropping (while preserving the aspect ratio) along with the encoding. The downside is the need to use an encoder's API (which may not always be available), but LinkPi has one -- so I'm using it!
Here's what I'm doing:
For any channels specified in a new CROP_CHANNELS env var, when watching live or recording, the stream will be evaluated to determine the pixel dimensions of the viewing area (to get the aspect ratio), and to determine the pixel size of the black bars. The black bars will then be removed on the sides, and the top/bottom black bars reduced proportionally with the aspect ratio.
The process will then sleep for the length of time of the current airing, when the cropping will be removed briefly, to allow the next movie (or whatever) to begin so the process can be repeated. This allows for "marathon" viewing on a given premium channel, with autocrop adjustments made per event.
Recordings work the same way. Also, if you are watching one of these channels in real time, and tune away before the conclusion, cropping will be reset to zeros on the encoder.
If there's anyone interested in helping with some of the final testing on this, let me know, and I'll give you the details on the new Docker Compose required. I'm pretty happy with the way this is coming together, and given that I almost never watched these channels due to this black border nonsense, it's a nice upgrade.