...
Since WCS build 5.2.1504 a stream can be played from server via WebRTC in a number of video qualities like HLS ABR. A browser will play a first available quality track, then playing client can switch between quailities qualities if necessary.
Since builds WCS 5.2.1663 and SFU SDK 2.0.231 player may switch between available ABR qualities automatically when playback channel state is changing. Automatic quality switching is based on WebRTC playback statistics data.
Supported platforms and browsers
Chrome | Firefox | Safari | Chromium Edge | |
---|---|---|---|---|
Windows | + | + | + | |
Linux | + | + | + | |
Mac OS | + | + | + | + |
Android | + | + | + | |
iOS | + (iOS 14.4) | + (iOS 14.4) | + |
Supported publishing technologies
A streams published by all of the available ways can be played via WebRTC ABR:
- WebRTC
- RTMP
- RTSP
- MPEG-TS по via UDP или or SRT
- Stream mixer
Supported codecs
Any stream will be transcoded to H264+Opus to be played as WebRTC ABR.
Implementation basics
SFU functions with Simulcast are used to implement WebRTC ABR support. A stream published video track is transcoded to a number of H264 video tracks with a different parameters, and the tracks are sent to client as SFU qualities. Audio track is transcoded to Opus and is also sent to client as SFU track. An SFU room named as stream published is created on server because room is a main SFU object.
...
Code Block | ||
---|---|---|
| ||
codecs_exclude_sfu=alaw,ulaw,g729,speex16,g722,mpeg4-generic,telephone-event,flv,mpv,vp8,h265
profiles=42e01f,640028
wcs_sfu_bridge_enabled=true |
...
WCS must be restarted to apply the quality profiles settings.
Using the same video quality profiles for HLS ABR and WebRTC ABR
Since build 5.2.1665, if video quality profiles are equal for HLS ABR and WebRTC ABR configurations, the same encoders will be used. For example, with WebRTC ABR setup
Code Block | ||||
---|---|---|---|---|
| ||||
profiles:
240p:
height: 240
bitrate: 500
codec: h264
gop: 60
fps: 30
480p:
height: 480
bitrate: 1000
codec: h264
gop: 60
fps: 30
720p:
height: 720
bitrate: 1500
codec: h264
gop: 60
fps: 30 |
and HLS ABR setup
Code Block | ||||
---|---|---|---|---|
| ||||
profiles:
-240p:
audio:
codec: mpeg4-generic
rate: 48000
channels: 2
groupId: audio
video:
height: 240
bitrate: 500
codec: h264
gop: 60
fps: 30
audioGroupId: audio
-480p:
audio:
codec: mpeg4-generic
rate: 48000
channels: 2
groupId: audio
video:
width: 0
height: 480
bitrate: 1000
codec: h264
gop: 60
fps: 30
audioGroupId: audio
-720p:
audio:
codec: mpeg4-generic
rate: 48000
channels: 2
groupId: audio
video:
width: 0
height: 720
bitrate: 1500
codec: h264
gop: 60
fps: 30
audioGroupId: audio |
only 3 video encoders will be created
The following video profile parameters should be equal if they are set:
- height
- width (if set and not equal to 0)
- codec
- bitrate
- fps
- gop
- profile
- level
- codecImpl
Video quality profiles sorting
Since build 5.2.1663, video quality profiles will be sorted in the order set in /usr/local/FlashphonerWebCallServer/conf/wcs_sfu_bridge_profiles.yml
file. For example, if the profiles described like this
Code Block | ||||
---|---|---|---|---|
| ||||
profiles:
240:
height: 240
bitrate: 500
codec: h264
gop: 60
fps: 30
480:
height: 480
bitrate: 1000
codec: h264
gop: 60
fps: 30
720:
height: 720
bitrate: 1500
codec: h264
gop: 60
fps: 30
1080:
height: 1080
bitrate: 3000
codec: h264
gop: 60
fps: 30 |
a client will receive a profiles list ordered like
Code Block | ||
---|---|---|
| ||
240, 480, 720, 1080 |
If there are two profiles with the same name in the setup, an undefined behavior occurs. To resolve it, server will use only the last profile with the same name.
Force transcoding of a maximum ABR quality only if there are B-frames in a source stream
To reduce a server load while video encoding, since WCS build 5.2.1840 it is possible to transcode a maximum ABR quality (which is usually the original stream resolution and bitrate) only if there are B-frames in a source stream. The feature may be enabled by the following parameter
Code Block | ||
---|---|---|
| ||
h264_b_frames_force_transcoding=true |
In this case the server will detect B-frames in a stream analizing a certain frames count (10 by default)
Code Block | ||
---|---|---|
| ||
frame_cnt_to_determine_their_type=10 |
If there are B-frames in the stream, the maximum ABR quality will be transcoded and will be available for playback.
If there are no B-frames in the stream, the maximum ABR quality will not be transcoded. The original quality should be requested separately from a playing client.
Quick manual on testing
1. For test we use:
...