You could use GStreamer/FFmpeg to convert into HLS/RTMP.
1. Have Mediasoup forward the RTP stream to the GStreamer/FFmpeg endpoint.
2. Encode the stream for HLS/RTMP
You may need to encode the audio if you are using opus, if you're using H264 for video you should be able to get away without encoding..
Also with HLS you will need to consider fragments/playlist length etc.