Skip to content

Real-time stream mixer with MCU functions

Since build 5.2.607 real-time stream mixer function is added. This function with MCU support is designed for real-time video confereincing. Unlike the previous implementation, a real-time mixer does not stop the output stream when some of incoming streams is late (usually due to packet loss or channel interference), and does not wait for bad quality stream to restore.


Real-time mixer is enabled by default


Mixer automatic creation when publishing a stream named like user1#room1 is also enabled by default


For conferencing, MCU support should be enabled


It is recommended to reduce mixer idle timeout


Stream name displaying in stream picture caption can be enabled if necessary


in this case caption will be displayed in picture bottom left corner for video streams and in picture center for audio only streams.

Speech indicator greenframe is enabled by default


Another mixer settings are also supported. Note that it is not recommended to enable custom losless video processor because real time function will not work in this case.

Captions management

Basic parameters and font size

Mixer captions font size can be changed if necessary depending on mixer output stream resolution:

  • for video streams, caption font size if 20pt by default


  • for audio only streams, caption font size if 40pt by default


Caption text is also displayed on black rectangle background. The following caption background parameters can be tuned:

Parameter Default value in pixels Description
mixer_text_cut_top 3 Text top cut
mixer_text_padding_bottom 5 Text bottom padding
mixer_text_padding_left 5 Text left padding
mixer_text_padding_right 4 Text right padding
mixer_text_padding_top 5 Text top padding

Text colour, background colour and opacity

Since build 5.2.741 caption text colour and background colour can be changed with the following parameters


A colour can be set as hexadecimal value with # or 0x prefix, in #RRGGBB form. Using the settings above, yellow text will be displayed on cian background:

For audio only participants, background colour fills the rectangle.

Since build 5.2.770 caption background opacity can be changed using the following parameter


Background opacity should be set in percents: 0 for full transparency, 100 for full opacity (text background will be coloured to defined colour). The default value is 100 (fully opaque).


Since build 5.2.770 it is possible to set captions font using the following parameter


The default value is Serif. Font can be chosen from X11 fonts list only, for example:

[root@centos76 ~]# fc-list | grep X11
/usr/share/X11/fonts/Type1/c0611bt_.pfb: Courier 10 Pitch:style=Bold Italic
/usr/share/X11/fonts/Type1/UTBI____.pfa: Utopia:style=Bold Italic
/usr/share/X11/fonts/Type1/c0419bt_.pfb: Courier 10 Pitch:style=Regular
/usr/share/X11/fonts/Type1/c0648bt_.pfb: Bitstream Charter:style=Regular
/usr/share/X11/fonts/Type1/cursor.pfa: Cursor:style=Regular
/usr/share/X11/fonts/Type1/UTB_____.pfa: Utopia:style=Bold
/usr/share/X11/fonts/Type1/c0583bt_.pfb: Courier 10 Pitch:style=Bold
/usr/share/X11/fonts/Type1/UTI_____.pfa: Utopia:style=Italic
/usr/share/X11/fonts/Type1/c0582bt_.pfb: Courier 10 Pitch:style=Italic
/usr/share/X11/fonts/Type1/c0633bt_.pfb: Bitstream Charter:style=Bold Italic
/usr/share/X11/fonts/Type1/c0649bt_.pfb: Bitstream Charter:style=Italic
/usr/share/X11/fonts/Type1/c0632bt_.pfb: Bitstream Charter:style=Bold
/usr/share/X11/fonts/Type1/UTRG____.pfa: Utopia:style=Regular

A full font name should be set, for example

mixer_text_font=Courier 10 Pitch

The default system font will be used if there is no the chosen font in the system.

If the chosen font contains no characters which are in caption text, those characters will not be displayed.

Caption text autoscaling

Since build 5.2.709 caption text can be autoscaled to fit the picture. The feature is enabled by default with the following parameter


If one or more publishers share a screen, a special desktop layout is enabled, in this case desktop stream caption is scaled separately


A minimal font size for text scaling is set by the following parameter


to 1pt by default

Room (mixer) name displaying

Since build 5.2.770 it is possible to disable room name displaying (which is set to stream name while automatically adding stream to mixer). This can be done with the following parameter


In this case, for stream named user1#room1 only user1 will be displayed (without room name and special character).

Custom stream label displaying

Since build 5.2.816 it is possible to display custom stream label in mixer instead of stream and room name. In fact, almost any name can be assigned including national characters.

A label should be set in stream name while publishing, for example

    streamName: "test1#m1?label=John Doe",
    display: localDisplay,

In this case the label will be displayed in mixer, including audio only streams

National characters are supported along with the following special characters


Character + will be replaced by whitespace, i.e. in the example above stream can be published with label

Setting or changing stream label using REST API

Since build 5.2.1635 it is possible to set a custom stream label while adding a stream to mixer with /mixer/add REST API query

 "uri": "mixer://mixer1",
 "remoteStreamName": "stream1",
 "streamLabel": "John Doe"

The label may be changed for the stream already added to the mixer by /mixer/set_stream_label query

 "streamLabel": "Mr. John Doe"


 "streamLabel": "Mr. John Doe"

The label may be cleared by passing an empty string as streamLabel

 "streamLabel": ""

In this case the stream name will be displayed as published.

Caption location

Obsoleted settings in builds from 5.2.844 to 5.2.1077


This setting is not supported since build 5.2.1079!

Since build 5.2.844, it is possible to change location of video participant's caption. By default, caption is located in left bottom corner of video.

It is possible to display caption above video using the following parameter


or under video


The distance between video and its caption can be changed using the following parameter


Captions placement above or below a picture affects picture placement even if captions diplaying is disabled.

Actual settings since build 5.2.1079

Since build 5.2.1079 the following parameter was added to set caption text alignment realtive to frame picture


Possible values

Value Caption placement
TOP_LEFT Top left corner
TOP_CENTER Top center
TOP_RIGHT Top rightcorner
CENTER In a picture center
BOTTOM_LEFT Bottom left corner (by default)
BOTTOM_CENTER Bottom center
BOTTOM_RIGHT Bottom right corner
EXTERNAL_TOP_CENTER Centered above a picture
EXTERNAL_BOTTOM_CENTER Centered below a picture

By default, captions are placed in bottom left corner of a picture frame.

The values EXTERNAL_TOP_CENTER and EXTERNAL_BOTTOM_CENTER replace obsoleted mixer_text_outside_frame parameter. For example, the following value


will act like mixer_text_outside_frame=BOTTOM

Speech indicator and audio only streams management

Thickness and position

Speech indicator frame thickness can be set (6 pixels by default)


The frame is displayed outside astream picture by default. However, if stream pictures are too close, foe example, if CenterNoPaddingGridLayout is used, the frame can affect neighbor pictures

In this case, inner speech frame displaying should be enabled


Audio only streams displaying

By default, if audio only track from some stream was added to mixer, this stream is shown in separate frame with speech indicator (see above). Sound only can be added to mixer without showing a separate participant (for example, to comment or to dub) with the following parameter if necessary


Before build 5.2.965, the stream for dubbing must contain audio and video, and must be added to mixer with the following /mixer/add REST query

    "uri": "mixer://mixer1",
    "remoteStreamName": "stream_dub",

Since build 5.2.965, audio only stream also will not be displayed if this parameter is used

Since build 5.2.1359, the parameter mixer_show_separate_audio_frame affects stream in mixer displaying when audio data are received before video. In this case, a frame with speech indicator will be displayed for such stream when default settings are used, then video will be displayed after first video data receiving. If the following parameter is set


then speech indicator frame will not be displayed until video data arrive.

Avatar pictures displaying for audio only streams


In the builds 5.2.1710 - 5.2.1725 the feature is supported in Ubuntu 20.04 and other systems with glibc 2.31 and newer only

Since build 5.2.1727 the feature is supported in Centos 7.6 (glibc 2.17) and above

Since build 5.2.1710 it is possible to set an avatar picture in PNG (with transparency), JPG or BMP formats to an audio only stream in mixer. A picture may be set while adding a stream to mixer by REST API query /mixer/add:

    "uri": "mixer://mixer1",
    "remoteStreamName": "user2",
    "hasVideo": false,
    "hasAudio": true,
    "avatar": ""

or by REST API query /mixer/set_stream_avatar for the audio only stream which already has added to the mixer:

    "uri": "mixer://mixer1",
    "remoteStreamName": "user2",
    "avatar": ""

The following ways to set a picture are supported:

  • file URI: file:///opt/avatar.png
  • local file: /opt/avatar.png

Audio only stream in mixer is displaying as follows

If stream names displaying in mixer is enabled, audio only stream name will be displayed like video stream one.

Avatar picture may be removed by REST API query /mixer/remove_stream_avatar:

    "uri": "mixer://mixer1",
    "remoteStreamName": "user2"

Since WCS build 5.2.1858 it is possible to set avatar pictures automatically by stream name, not using REST API. In this case avatar picture files should be placed to the folder


A file name should be equal to stream name. For example, the picture file stream1.png will be applied to the stream named stream1. If the stream was added to the mixer automatically, e.g. stream1#mixer1, the mixer name will not be used to get the picture, only the stream name before # character.


Avatar picture setting with REST API query /mixer/set_stream_avatar has a higher priority then automatic picture setting

Frame colour

Since build 5.2.741 speech indicator frame colour can be changed with the following parameter


A colour can be set as hexadecimal value with # or 0x prefix, in #RRGGBB form. Using the settings above, speech indicator frame will be red.

Frame displaying when silence is in a stream

By default, speech indicator frame may blink at normal participant speech rate, which can be incomfortable for viewing. For this reason, since build 5.2.775 it is possible to set a time interval in which the frame will be displayed since silence is detected in the stream. The feature can be enabled using the following parameter


In this case, speech indicator frame will still be displayed in 500 milliseconds since silence is detected in the stream.

By default, this interval is set to 0, frame will be hidden without delay.

Mixer background management

By default, mixer applies black background. Since build 5.2.645 it is possible to set PNG picture file which will be used as mixer background. For example, to change the background to blue, prepare blue.png picture and set the following parameter


Background picture file should be placed to /usr/local/FlashphonerWebCallServer/conf folder if full path is not set. The file can be placed to any folder on the server, in this case full path to the file should be set to the parameter


Background picture will be automatically scaled to mixer output stream resolution

Audio only streams picture aspect ratio management

By default, audio only streams picture aspect ratio is set according to mixer one (16:9)


It can be changed together with mixer if necessary, for example to 4:3


Note that audio only streams picture aspect ratio settings are applied only with WCS restart.

Multithreading support and hign load optimizations

Since build 5.2.793 multithreading support is added to optimize a mixer for a big participants amount. This feature can be enabled by the following parameters


CPU threads count to mix audio amd video can be adjusted by the following parameters


Usually, MCU mixer encodes one video stream and a many ausio streams: two per every participant plus one common audio track. Therefore, it is recommended to set more CPU threads for audio encoding than for video (as shown above). Additionally, if freezes occur in MCU mixer output stream, it is recommended to enable multithreaded delivery of mixing result to the main WCS engine, to send it to subscribers.


If participants count is lower than mixing threads count (for example, 3 participants), only one CPU thread will be used for mixing.

Real-time mixer tuning

Real-time mixer can be tuned using the following parameters

Parameter Default value Description
mixer_audio_silence_threshold -50.00 Incoming stream audio silence level in Db
mixer_debug_mode false Adds some debug info to stream picture caption
mixer_in_buffering_ms 200 Incoming stream video buffer in milliseconds
mixer_incoming_time_rate_lower_threshold 0.95 Relative incoming stream time to mixer time rate lower threshold
mixer_incoming_time_rate_upper_threshold 1.05 Relative incoming stream time to mixer time rate upper threshold
mixer_video_stable_fps_threshold 15 Incoming stream FPS threshold, video buffer will be disabled for streams with low fps
audio_mixer_max_delay 300 A maximum time interval to wait for any audio data in the incoming stream, in milliseconds, when this time is expired, the stream will not be mixed until some media data receiving


  1. For test we use
  2. demo server;
  3. Chrome browser;
  4. MCU Client web application example for conferencing.

  5. Open MCU Client web application page. Enter user name user1 and room name room1

  6. Click Join. A stream from your web camera will be published and added to mixer, then mixer output stream will be displayed without your microphone audio

  7. Open MCU Client application page in another brower tab/browser/PC. Enter user name user2 and room name room1

  8. Click Join. A stream from your web camera will be published and added to mixer, then mixer output stream will be displayed with videos from both users but audio from user1 only

  9. On user1 page two videos also are playing with user2 audio only

  10. Click Leave to leave the room in both tabs/browsers

Call flow

Call flow for conferencing example based on real-time mixer with MCU function is described on MCU Client page.

Incoming streams tuning recommendations

When delay occurs in the incoming stream from one of participants, realtime mixer will freeze that stream. The following is recommended to minimize incoming stream delays:

  1. For RTMP streams, adjust encoding parameter so that:
  2. client encoder perfomance to be enough to send picture frames in time
  3. stream resolution and bitrate to fit to publishers channel from client to server

  4. For WebRTC streams, do not raise minimum video bitrate threshold higher than webrtc_cc_min_bitrate server configuration parameter defines. By default, lower video bitrate threshold is set to 30 kbps

    The publisher client browser will adopt the stream to channel quality drops. The lower bitrate the lower picture quality, but the participant stream will not be freezed in this case.

Adding one stream to two or more realtime mixers simultaneously

Since build 5.2.732 one stream can be added to two ore more realtime mixers simultaneously. Note that realtime mixer should be enabled


and custom losless videoprocessor should be disabled


Known issues

1. Real-time mixer functions are disabled when custom losless videoprocessor is used

Real-time mixer functions are disabled when custom losless videoprocessor is used, mixer incoming streams cannot be played in this case.


Stream stops playing after adding to mixer


Do not use custom losless videoprocessor with real-time mixer


fontconfig library must be installed on server to display stream caption

To display stream captions in mixer, it would be necessary to install fontconfig library


Streams cannot be added to mixer with the following exception in server log

09:17:11,756 ERROR           MixerAgent - MIXER-AGENT-mixer://mixervmixdr52-9d46cd04-5867-4d74-a9d9-baf67f74e7d2 Mixer closed due to error
java.lang.InternalError: java.lang.reflect.InvocationTargetException
   at java.desktop/sun.font.FontManagerFactory$
   at java.base/
   at java.desktop/sun.font.FontManagerFactory.getInstance(
   at java.desktop/sun.font.SunFontManager.getInstance(
   at java.desktop/sun.font.FontDesignMetrics.getMetrics(
   at java.desktop/java.awt.Font.getStringBounds(
   at java.desktop/java.awt.Font.getStringBounds(
   at Source)
   at Source)
   at Source)
   at Source)
   at Source)
   at Source)
   at com.flashphoner.server.remote.B.B.Г™(Unknown Source)
   at Source)
Caused by: java.lang.reflect.InvocationTargetException
   at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(
   at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(
   at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(
   at java.base/java.lang.reflect.Constructor.newInstance(
   at java.desktop/sun.font.FontManagerFactory$
   ... 14 more
Caused by: java.lang.NullPointerException
   at java.desktop/sun.awt.FontConfiguration.getVersion(
   at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(
   at java.desktop/sun.awt.FontConfiguration.init(
   at java.desktop/sun.awt.X11FontManager.createFontConfiguration(
   at java.desktop/sun.font.SunFontManager$
   at java.base/
   at java.desktop/sun.font.SunFontManager.<init>(
   at java.desktop/sun.awt.FcFontManager.<init>(
   at java.desktop/sun.awt.X11FontManager.<init>(
   ... 20 more


Install fontconfig library:

sudo yum install -y fontconfig

3. A participant name can be drawn over speech indicator frame if stream picture is small enough

A participant name can be drawn over speech indicator frame if there are many participants in mixer and therefore participants picture is small


For small participant pictures (in desktop layout, for example) participants name can be drawn over speech indicator frame


Enable inner speech indicator frame position and decrease frame thickness


4. Mixer stream can play unsmoothly when participants stream contains B-frames

B-frames should be excluded from mixer input stream, or mixer input buffer should be increased


When mixer input stream is encoded by Main profile with B-frames, the mixer output stream is playing unsmoothly, there are short freezes with sound pauses


a) encode stream without B-frames (preferrable)

b) increase mixer input buffer (may give an additional delay)


5. An incoming stream with a high FPS may give additional server load

60 FPS stream publishing to mixer gives additional CPU and system memory load


CPU load increasing and system memory (not Java heap) consumption growing while publishing 60 FPS stream to a mixer


Use more powerful server or publish 30 FPS and lower streams to mixer

6. Captions may twitch for many participants in MCU mixer


For many (over 10) participants in MCU mixer captions may periodically twitch


Apply the following settings


7. Some participants are less audible then others when speaking simultaneously

When a number of participants are speaking simultaneously, some participants are less audible then others. The problem is typical for mixing WebRTC streams, and may ocuur in any solutions using WebRTC and audio mixing, in Discord for example: more data are encoded to one stream, more audio samples may be dropped due to fixed samplerate.


When three or more participants are speaking simultaneously, one of them is less audible then two others


Raise the audio publishing bitrate on client side to send more data per one participant

constraints: {
  audio: {
    bitrate: 128000

and raise Opus encoding bitrate on server


8. An incoming stream will be never encoded in realtime mixer if media traffic is stopped in the stream


An incoming stream freezes in the mixer when media traffic is stopped in the stream, for example, an application window captured by screen sharing is minimized to task bar


Decrease a minimal FPS threshold for mixer incoming streams


9. Mixer output stream bitrate may be unstable when incoming stream bitrate or fps drops


Mixer output stream bitrate becomes unstable when incoming stream bitrate or fps drops


Update WCS to build 5.2.1843 or newer and set the parameter


10. There may be a stuttering in mixer audio for a stream published with a packets loss


Micro freezes and stuttering occur for a certain stream in mixer


Increase the mixer incoming streams buffer