Hi everyone,
I’m building a backend-driven streaming application using Mediasoup + FFmpeg + PlainTransport.
My goal is to switch between different media sources (e.g. welcome.mp4, waiting.mp4, streaming.ts) from backend, while keeping the same PlainTransport alive to avoid the overhead of tearing down and rebuilding the pipeline.
Current Setup:
Backend: NestJS server with Mediasoup
Media ingest: FFmpeg sends RTP stream to PlainTransport
Producer: created after FFmpeg starts
Frontend: React client that consumes via Consumer after signaling
What I want:
When the backend Start streaming a file (e.g., welcome.mp4), I want to:
Start FFmpeg again with welcome.mp4 using the same RTP ports (same PlainTransport)
After welcome is wailting.mp4. When has event streaming start play streaming, end event streaming play wailting
Create a new Producer with the new stream
Notify the frontend to create a new Consumer
All this without having to destroy and recreate the PlainTransport for all event
Questions:
Is this a valid and recommended workflow in Mediasoup?
If so, does Mediasoup allow reusing the same PlainTransport across multiple Producer instances (one at a time)?
Will RTP stream re-sync correctly if FFmpeg restarts and sends new RTP packets?
Is it necessary to explicitly configure SSRC and payloadType to match, or will Mediasoup auto-detect again per new producer?
Any insights or recommendations on best practices for this dynamic switching scenario would be very helpful!
Thanks in advance