Sigh, should have stood quiet. Now 10 people are going to vibe code this and it's going to be slop and full of security holes. I have to say though, I would love something along these lines. After X number of days on server, downgrade to x265 720p. Would be great for space saving.
OP: I've gone though so many dead disks that I have to rebuild from scratch before my NAS, ONLY keep what you are going to watch/use. If you want to keep the other stuff (harder to find only imo) burn it off to throw it at some external spinning disks that you can unplug and put into long term storage.
Why the mental gymnastics to basically say "Hey, i really like free shit!"