...
Code Block | ||
---|---|---|
| ||
encoder_priority=OPENH264 mixer_video_bitrate_kbps=5000 |
Mixer
...
Sometimes it is necessary to reach a minimum (zero) padding between mixer stream puctures. To do this use the following parameter in flashphoner.properties file
Code Block | ||||
---|---|---|---|---|
| ||||
mixer_use_center_no_padding_layout=true |
In this case input stream pictures are placed in mixer output stream as close as possible:
This feature works only for input streams of equal resolution with the same aspect ratio.
Mixer output stream sound management
By default, mixer output stream sound is encoded to Opus with sample rate 48 kHz. These settings may be changed using the parameters in flashphoner.properties file. For example, to use mixer output stream in SIP call the following value can be set:
Code Block | ||
---|---|---|
| ||
audio_mixer_output_codec=pcma
audio_mixer_output_sample_rate=8000 |
In this case, sound will be encoded to PCMA (alaw) with sample rate 8 kHz.
Using custom losless videoprocessor for incoming streams handling
To handle mixer incoming streams, if additional bufferizing or audio and video tracks syncronizing is required for example, the custom losless videoprocessor may be used. This feature is enabled with the following parameter in flashphoner.properties file
Code Block | ||
---|---|---|
| ||
mixer_lossless_video_processor_enabled=true |
The maximum size of mixer buffer in milliseconds is set with this parameter
Code Block | ||
---|---|---|
| ||
mixer_lossless_video_processor_max_mixer_buffer_size_ms=200 |
...
output stream sound management
By default, mixer output stream sound is encoded to Opus with sample rate 48 kHz. These settings may be changed using the parameters in flashphoner.properties file. For example, to use mixer output stream in SIP call the following value can be set:
Code Block | ||
---|---|---|
| ||
audio_mixer_output_codec=pcma
audio_mixer_output_sample_rate=8000 |
In this case, sound will be encoded to PCMA (alaw) with sample rate 8 kHz.
Using custom lossless videoprocessor for incoming streams handling
To handle mixer incoming streams, if additional bufferizing or audio and video tracks syncronizing is required for example, the custom lossless videoprocessor may be used. This feature is enabled with the following parameter in flashphoner.properties file
Code Block | ||
---|---|---|
| ||
mixer_lossless_video_processor_enabled=true |
The maximum size of mixer buffer in milliseconds is set with this parameter
Code Block | ||
---|---|---|
| ||
mixer_lossless_video_processor_max_mixer_buffer_size_ms=200 |
By default, maximum mixer buffer size is 200 ms. After filling this buffer, the custom losless lossless videoprocessor uses its own buffer and waits for mixer buffer freeing. The period of mixer buffer checking is set in milleseconds milliseconds with this parameter
Code Block | ||
---|---|---|
| ||
mixer_lossless_video_processor_wait_time_ms=20 |
By default, the mixer buffer checking period is 20 ms.
Note that usng using the custom losless lossless videoprocessor may degrade realtime perfomance.
When custom losless lossless videoprocessor is used, it is necessary to stop mixer with REST query /mixer/terminate to free all consumed resources. Mixer can be stopped also by stopping all incaming incoming streams, in this case mixer will stop when following timeout in milliseconds expires
Code Block | ||
---|---|---|
| ||
mixer_activity_timeridle_timeout=60000 |
By default, mixer will stop after 60 seconds if there are no active incoming streams.
...
By default, three mixer output stream layouts are implemented:
1. Grid layoudlayout
This layout can be enabled with the following parameter in flashphoner.properties file
...
and works for input streams of equal resolution with the same resolution and same aspect ratio only
3. Desktop (screen sharing) layout
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
package com.flashphoner.mixerlayout; import com.flashphoner.sdk.media.mixer.video.presentation.BoxIVideoMixerLayout; import com.flashphoner.sdk.media.mixer.video.presentation.BoxPositionYUVFrame; import comjava.flashphoner.media.mixer.video.presentation.VideoLayoutawt.*; import comjava.flashphoner.sdk.media.IVideoMixerLayout; import com.flashphoner.sdk.media.YUVFrame; import java.util.ArrayList; public class TestLayout extends VideoLayout { private static final int PADDING = 5; @Override public Layout[] compute(YUVFrame[] frames, int canvasWidth, int canvasHeight) { util.ArrayList; public class TestLayout implements IVideoMixerLayout { private static final int PADDING = 5; @Override public Layout[] computeLayout(YUVFrame[] yuvFrames, String[] strings, int canvasWidth, int canvasHeight) { ArrayList<IVideoMixerLayout.Layout> layout = new ArrayList<>(); for (int c = 0; c < yuvFrames.length; c++) { Point prevPoint = new Point(); Dimension prevDimension = new Dimension(canvasWidth, canvasHeight); return computeGrid(frames, canvasWidth, canvasHeight); if (layout.size() > 0) { } private IVideoMixerLayout.Layout[] computeGrid(YUVFrame[] frames, int canvasWidth, int canvasHeight) { prevPoint.setLocation(layout.get(c-1).getPoint()); Box mainBox = new Box(null, canvasWidth, canvasHeight prevDimension.setSize(layout.get(c-1).getDimension()); for (int i = 0; i < frames.length; i++) { } BoxPoint frameBoxcurrentPoint = new Box(mainBox, canvasWidth/frames.length, canvasHeight/frames.length); Point((int) (prevPoint.getX()+prevDimension.getWidth()+PADDING), frameBox.setPosition(BoxPosition.INLINE_HORIZONTAL_CENTER); frameBox.setPaddingLeft(PADDING); frameBox.setPaddingRight(PADDING(int)(prevPoint.getY()+prevDimension.getHeight())); Box frame = new Box(frameBox, frames[i]); layout.add(new IVideoMixerLayout.Layout(currentPoint, new Dimension(canvasWidth/yuvFrames.length, frame.setPosition(BoxPosition.INLINE_HORIZONTAL); frame.fillParent(); } ArrayList<IVideoMixerLayout.Layout> layout = new ArrayList<>( canvasHeight/yuvFrames.length), yuvFrames[c])); mainBox.computeLayout(layout);} return layout.toArray(new IVideoMixerLayout.Layout[layout.size()]); } } |
Then the class should be complied into byte code. To do this, create folder tree accordind according to TestLayout class package name
...