...
Supported codecs
WebRTC video:
WebRTC audio:
- Opus
Implementation basics
...
Code Block | ||
---|---|---|
| ||
codecs_exclude_sfu=alaw,ulaw,g729,speex16,g722,mpeg4-generic,telephone-event,flv,mpv,vp8,h265
webrtc_cc_min_bitrate=1000000
profiles=42e01f,640028 |
...
1. Open SFU client example in browser, for example https://demo.flashphoner.com:8888/client2/sfu/examples/client/main.html, enter server URL, room name, pin code and user name, then click Enter
...
If participant publishes more than one stream from camera, only the first published stream will be available at WCS side.
...
TURN support
A standard RTCPeerConnection
object is used in browser to publish and play audio and video tracks, so this object should be configured properly to relay a media traffic via TURN server. For example, all the streams are published directly to WCS instance in SFU Two Way Streaming example:
Code Block | ||||
---|---|---|---|---|
| ||||
pc = new RTCPeerConnection();
... |
The code should be changed as follows to use a TURN server, for example, internal WCS TURN server:
Code Block | ||||
---|---|---|---|---|
| ||||
let connectionConfig = {
iceServers: [
{
urls: 'turn:wcs:3478?transport=tcp',
credential: 'coM77EMrV7Cwhyan',
username: 'flashphoner'
}
],
iceTransportPolicy: "relay"
};
pc = new RTCPeerConnection(connectionConfig);
... |
Where:
wcs
- WCS server address;flashphoner
- WCS internal TURN server default username;coM77EMrV7Cwhyan
- WCS internal TURN server default password
In this case all the media traffic will pass through the WCS internal TURN server. This feature may be also used to wrap WebRTC traffic to TCP if the client has a bad channel, because WCS does not support TCP transport for SFU streams.
VP9 support
Since WCS build 5.2.1908 and SFU SDK build 2.0.268, VP9 codec is supported for SFU mediatraffic publishing and playback
Code Block | ||
---|---|---|
| ||
codecs=opus,alaw,ulaw,g729,speex16,g722,mpeg4-generic,telephone-event,h264,vp8,vp9,flv,mpv |
VP9 must be excluded for the cases when it is not supported by other party (SIP calls for instance)
Code Block | ||
---|---|---|
| ||
codecs_exclude_sip=mpeg4-generic,flv,mpv,h265,vp9
codecs_exclude_sip_rtmp=opus,g729,g722,mpeg4-generic,vp8,vp9,mpv,h265 |
It is necessary to exclude H264 and VP8 codecs for SFU to enable VP9
Code Block | ||
---|---|---|
| ||
codecs_exclude_sfu=alaw,ulaw,g729,speex16,g722,mpeg4-generic,telephone-event,h265,flv,mpv,vp8,h264,h265 |
VP9 codec allows to use SVC (Scalable Video Coding) at browser side by setting scalabilityMode
in encoding profile
Code Block | ||||
---|---|---|---|---|
| ||||
{
"room": {
...
},
"media": {
"audio": {
"tracks": [
]
},
"video": {
"tracks": [{
"source": "camera",
"width": 1280,
"height": 720,
"codec": "vp9",
"encodings": [
{
"rid": "nonsense",
"active": true,
"scalabilityMode": "L1T3"
}
]
}]
}
}
} |
In this example, a video track will be published in one resolution (L1) with 3 FPS layers (T3). A full scalability modes list is available here.
Known limits
1. It is not recommended to use Simulcast (using a number of encoding profiles) and SVC simultaneously because this may not be properly supported in a browser.
2. Only one spatial layer (L1) is available for screen sharing, other settings are ignored. The limit is hardcoded at WebRTC library level and applied in any browser.
Known issues
1. A stream captured from a screen window simulcast publishing will crash Chrome browser tab on minimizing this window
...
Solution: there is the Chromium bug, a stream capturing from a screen window should be publihed in only one quality (no simulcast) until this bug is fixed (in Chrome build 98.0.4736.0)