how to pipe:/// through a .sh or Python script, or use some sort of setting files with FFMPEG First post, so be kind please :)

So a quick bit of history. I am using tvheadend, and the inbuilt transcoder murders my CPU, and provides average quality output (it's powered by ffmpeg), if I pipe the output from tvheadend through ffmpeg I get much lower CPU usage and better quality (weird but true). (I am having to transcode because of limited player abilities)

So in tvheadend the http link goes from something like

http://avideostream

to

pipe:///usr/bin/ffmpeg -loglevel fatal -i http://avideostream -tune zerolatency -vcodec libx264 -preset veryfast -crf 28 -maxrate 1200k -bufsize 3500k -vf "scale='min(1280,iw)':'min(720,ih)'" -acodec aac -b:a 128K -f mpegts pipe:1


Big difference as you can see.

This all works, BUT if I want to change the settings in the my above pipe, i have to change them for all links (which I do through a script), but that means tvheadend re-imports and tests all of the links (as it see them as changed links, which is fair enough).

So what I want to do is wrap ffmpeg in something, so I can change the wrapper. (This is all happening on a up to date ubuntu server).

Now I am happy to say I am not a Ubuntu expert (not even close), although I have been running my own home servers for a few years now. So I don't fully understand all the aspects of "pipe".

The three options I see for above (as to date I have found no way for chosing an external transcoder option for tvheadend, without moving into weird builds, which I would like to avoid) are:

Use an external options file for ffmpeg (which I can get to work from the console, but not as part of the pipe, e.g. sudo ffmpeg -i amovie.mp4 $(cat ffmpegoptions.txt) convertedmovie.mp4, it might be as simple as file access rights, but I didn't do much debugging)

Put the ffmpeg stuff in a .sh file (but that just seems to break the pipe, and I have no idea where to even start with that)

put the ffmpeg in some sort of python script (I didn't even start investigating that, a step too far for me, I can write python, but that is currently out of my league)

Short version, I want to go from:

tvheadend >> piped to ffmpeg >> back to tvheadend >> off to player

To either

tvheadend >> piped to .sh or script wrapper >> piped to ffmpeg >> back to tvheadend >> off to player

or

tvheadend >> piped to ffmpeg (controlled by an external options file) >> back to tvheadend >> off to player

Any suggestions/help would be much appreciated. Let me know if I missed any important info out.
I didn't find an actual answer, more a work around. As this was all part of a bigger, involving plex, I found a proxy (xteve) that includes ffmpeg transcoding, and I can set the options for ffmpeg.  That is good enough for what I was trying to do.

Hope this save someone else a little time.