I am not sure if you have experience encoding many videos on a server, but I assure you that it is a very costly operation. You’ll need a whole farm of GPU fitted servers to handle the load.
If you expect small number of uploads, then external service like Qencode, mux, etc. might be within reason from cost perspective, otherwise it can be prohibitive.
Scripting ffmpeg can be done, but diversity of source media can be a huge challenge, if you expect good results!
🐶🐾🫡