Starts the local video mixing.

public abstract int startLocalVideoTranscoder(LocalTranscoderConfiguration config);


After calling this method, you can merge multiple video streams into one video stream locally. For example, you can merge the video streams captured by the camera, screen sharing, media player, remote video, video files, images, etc. into one video stream, and then publish the mixed video stream to the channel.

  • Local video mixing requires more CPU resources. Therefore, Agora recommends enabling this function on devices with higher performance.
  • If you need to mix locally captured video streams, the SDK supports the following capture combinations:
    • On the Android platform, it supports up to 2 video streams captured by cameras (the device itself needs to support dual cameras or support external cameras) + 1 screen sharing stream.
  • If you need to mix the locally collected video streams, you need to call this method after startCameraCapture or startScreenCapture.
  • If you want to publish the mixed video stream to the channel, you need to set publishTranscodedVideoTrack in ChannelMediaOptions to true when calling joinChannel [2/2] or updateChannelMediaOptions.

Applicable scenarios

You can enable the local video mixing function in scenarios such as remote conferences, live streaming, and online education, which allows users to view and manage multiple videos more conveniently, and supports portrait-in-picture effect and other functions.

The following is a typical use case for implementing the portrait-in-picture effect:
  1. Call enableVirtualBackground, and set the custom background image to BACKGROUND_NONE, that is, separate the portrait and the background in the video captured by the camera.
  2. Call startScreenCapture to start capturing the screen sharing video stream.
  3. Call this method and set the video source for capturing portraits as one of the video sources participating in the local video mixing, and the portrait picture-invideo mixing can be added in the mixed image video.
    Note: When configuring the local video mixing, it is necessary to ensure that the layer number of the video stream capturing the portrait is greater than the layer number of the screen sharing stream. Otherwise, the portrait will be covered by the screen sharing and will not be displayed in the final mixed video stream.


Configuration of the local video mixing, see LocalTranscoderConfiguration.
  • The maximum resolution of each video stream participating in the local video mixing is 4096 × 2160. If this limit is exceeded, video mixing does not take effect.
  • The maximum resolution of the mixed video stream is 4096 × 2160.


  • 0: Success.
  • < 0: Failure.