This content was created by Tsahi Levent-Levi. This content was uploaded by Tsahi Levent-Levi. This is a YouTube video titled "How does WebRTC choose which codec to use?" containing a technical discussion between two speakers about the process of codec selection in WebRTC using SDP, recorded on July 10, 2025.
How does WebRTC choose which codec to use?
Okay, this is going to be a bit more complicated because it involves SDP. Okay, so WebR3C supports multiple audio and video codecs. For example, for audio we have opus, and technically G711. For video we have a bunch of codecs. We have mandatory to implement VPH H264. We also have VP9AV1 and depending on the hardware, H265 intro yes. And what WebRCIP does it uses STP to negotiate what codec is going to be used. So STP is going to say, I support all these codecs, gives you a list, and then it's your job to tell me which codec would you like to receive and whatever you tell me going to send.
So you send me an SDP offer with the codecs that you support, and my device or my application, the one that receives the request, will send an SDP answer. We say, well, I want that specific codec.
Yes. Which means you're going to put it first in the list of remote codecs.
Because that would be my preference.
Yes. Now, you could send multiple codecs back and then technically I could choose depending on what I would prefer, but typically it's just the first one. You're going to honor my choice.