How to Switch video codec(vp9/vp8/h264) on the fly

I’m looking to implement real-time codec switching based on the user’s browser. My goal is to use the VP9 codec when a Chrome user initiates a call. However, if a Mozilla or Safari user joins the call, I intend to seamlessly transition the codec for Chrome participants to VP8. I’m curious if this is achievable using mediasoup and, if so, how I could go about it?

You close the Producer in client and server and then create another one specifying the desired codec.

Thanks for the reply.
Introducing a new producer could potentially lead to a slight degradation in the user experience, resulting in moments of a black stream lasting mere milliseconds.

Unless you do a magic transition by not removing the former until the latter is ready.

Anyway, there is no way in WebRTC to dynamically change the codec in an ongoing stream.

A more “traditional” way that has been discussed on this forum and elsewhere is to have a re-encoder, possibly running close to the sfu. That way you don’t need to switch the producer’s codec, just re-encode into whatever you think it’s best for the consumer. See also mediasoup :: Scalability

Hi @ibc,
Is it possible to munging SDP within MediaSoup itself to switch codecs?