mediasoup-client-swift icon indicating copy to clipboard operation
mediasoup-client-swift copied to clipboard

H264 simulcast not working on ios

Open papaz0rgl opened this issue 2 years ago • 4 comments

Hello, many thanks for you library which is very well done. Integration into my project has been really smooth. I have one issue with H264 simulcast. I try to produce 2 videos layers : let lowEncoding = RTCRtpEncodingParameters() lowEncoding.maxBitrateBps = 256_000 lowEncoding.scaleResolutionDownBy = 1

        let highEncoding = RTCRtpEncodingParameters()
        highEncoding.maxBitrateBps = 5_000_000
        highEncoding.scaleResolutionDownBy = 1

It works well with VP8 but with H264 it only produces one stream at 5M. Furthermore the resolution is quite low and doesn't delivers full hd.

What am I missing ? is there some specific configuration to be done for h264 ?

Thanks for your help.

papaz0rgl avatar Dec 15 '22 10:12 papaz0rgl

I made a little progress since posting this. I 'm now able to stream full hd in h264 (but still no simulcast, only one resolution). The issue came from the version of webrtc which has a mechanism to compute the supported h264 profile for each iphone model but as the model datase is quite old it defaults to a really low profile hence no hd. Changing this solve the hd issue.

papaz0rgl avatar Feb 09 '23 22:02 papaz0rgl

For me simulcast on the h264 "just works". But I have similar problem. In case I select VP8 (a non-default) over h264 (default, listed on the first place in router capabilities) it works only without simulcast. If I create additional video layers, other clients do not receive any data and see no video. As I use only one layer, outgoing video works with VP8. But now I don't have time to dive deeper into this problem.

So maybe the root is not in codec itself but in some other differences.

fedulvtubudul avatar Aug 16 '23 12:08 fedulvtubudul

Hello, I did some tests by changing the default codec from vp8 to h264. I always have the same behaviour ie vp8 simulcast working and only one layer in h264. I also tried with different resolutions, asking for 3 layers instead of 2 etc. I always get the same result, 1 layer in h264 and all the layers I ask for in vp8

papaz0rgl avatar Aug 25 '23 16:08 papaz0rgl

@papaz0rgl could you share parameters that you pass when creating your video track producer? For the VP8 I've succeeded with simulcast after setting frame rate to the same value for all layers. Here are parameters that I use now and they work for both codecs:

[
  {
    "width": 180,
    "height": 320,
    "scalabilityMode": "S1T3",
    "dtx": false,
    "rid": "r0",
    "maxBitrate": 150000,
    "active": true,
    "maxFramerate": 12,
    "scaleResolutionDownBy": 4,
    "networkPriority": 1
  },
  {
    "width": 360,
    "height": 640,
    "maxFramerate": 12,
    "maxBitrate": 200000,
    "scalabilityMode": "S1T3",
    "active": true,
    "networkPriority": 1,
    "dtx": false,
    "rid": "r1",
    "scaleResolutionDownBy": 2
  },
  {
    "width": 720,
    "height": 1280,
    "maxFramerate": 12,
    "maxBitrate": 700000,
    "networkPriority": 1,
    "scalabilityMode": "S1T3",
    "rid": "r2",
    "active": true,
    "dtx": false,
    "scaleResolutionDownBy": 1
  }
]

fedulvtubudul avatar Oct 17 '23 08:10 fedulvtubudul