Processing video server-side, inside a router?

There is only one way which is to get the raw packets from mediasoup through direct or plain transport (not sure which one) and then consume them in ffmpeg, gstreamer, headless browser and process them and inject them back to mediasoup in the same way and then mediasoup will router it to the participants.

One simple way of doing this in your case can be that you use headless browser on server and then consume the video which you want to process and then process it using html canvas etc and then reproduce that stream from here to mediasoup again and then consume this processed stream in the rest of the participants just like normal stream.

Some things are described here: