Create producer for h264 codec

I want to change the broadcasters example to use h264 codec. Everything works fine up to the point where I send the POST to create a producer. I send the body like this:

{"kind": "video",

But I get the response UnsupportedError: unsupported codec [mimeType:video/h264, payloadType:101].

As far as I understand the demo the routers that are created in Room.js should have support for h264 because it’s defined in config.js → routerOptions → mediaCodecs.

I’m really thankful for any help. :pray:

I’m afraid h264 is not just a codec but a codec configuration that depends on the profile-level-id parameter and others. Those must match or be compatible (and that’s super hard to figure out unless you read the RFC of H264). And you cannot just write a random value and later send whatever h264 configuration from your RTP endpoint.

Well, that explains it :thinking:. I’m currently testing mediasoup as an alternative to janus webrtc server. When I create a router for h264 in janus I sometimes just get a black screen on the client side or the video flickers even when the profile-level-id matches. So you are saying those are compatibility issues I will also face when using mediasoup?
And why is it easier with vp8? Just because there aren’t profiles and levels?

You shouldn’t get black screens if you specify widely supported H264 profile instead of more nuanced that not all platforms support. Just stick to constrained baseline profile and nothing else and you’ll be fine.

Exactly, moreover, almost everything almost everywhere uses the same exact software implementation, so compatibility is very good. On top of it, VP8 the most tested codec.

1 Like

OK thanks a lot guys. :pray: