VideoEncoderConfiguration
Used to set parameters for the video encoder.
public class VideoEncoderConfiguration {
public final static VideoDimensions VD_120x120 = new VideoDimensions(120, 120);
public final static VideoDimensions VD_160x120 = new VideoDimensions(160, 120);
public final static VideoDimensions VD_180x180 = new VideoDimensions(180, 180);
public final static VideoDimensions VD_240x180 = new VideoDimensions(240, 180);
public final static VideoDimensions VD_320x180 = new VideoDimensions(320, 180);
public final static VideoDimensions VD_240x240 = new VideoDimensions(240, 240);
public final static VideoDimensions VD_320x240 = new VideoDimensions(320, 240);
public final static VideoDimensions VD_424x240 = new VideoDimensions(424, 240);
public final static VideoDimensions VD_360x360 = new VideoDimensions(360, 360);
public final static VideoDimensions VD_480x360 = new VideoDimensions(480, 360);
public final static VideoDimensions VD_640x360 = new VideoDimensions(640, 360);
public final static VideoDimensions VD_480x480 = new VideoDimensions(480, 480);
public final static VideoDimensions VD_640x480 = new VideoDimensions(640, 480);
public final static VideoDimensions VD_840x480 = new VideoDimensions(840, 480);
public final static VideoDimensions VD_960x540 = new VideoDimensions(960, 540);
public final static VideoDimensions VD_960x720 = new VideoDimensions(960, 720);
public final static VideoDimensions VD_1280x720 = new VideoDimensions(1280, 720);
public final static VideoDimensions VD_1920x1080 = new VideoDimensions(1920, 1080);
public final static VideoDimensions VD_2540x1440 = new VideoDimensions(2540, 1440);
public final static VideoDimensions VD_3840x2160 = new VideoDimensions(3840, 2160);
public static final int STANDARD_BITRATE = 0;
public static final int COMPATIBLE_BITRATE = -1;
public static final int DEFAULT_MIN_BITRATE = -1;
public static final int DEFAULT_MIN_FRAMERATE = -1;
public static final int DEFAULT_MIN_BITRATE_EQUAL_TO_TARGET_BITRATE = -2;
public VideoDimensions dimensions;
public int frameRate;
public int minFrameRate;
public int bitrate;
public int minBitrate;
public ORIENTATION_MODE orientationMode;
public DEGRADATION_PREFERENCE degradationPrefer;
public MIRROR_MODE_TYPE mirrorMode;
public AdvanceOptions advanceOptions;
public VIDEO_CODEC_TYPE codecType;
}
You can customize the resolution or choose from preset resolutions. Supports setting different encoding bitrates and frame rates to adapt to different channel scenarios. You can also specify video encoding orientation, mirror mode, and encoder priority strategy.
Properties
- dimensions
-
Note: Whether 720p or higher resolutions are supported depends on device performance. If the device cannot support 720p, the frame rate may be lower than the set value. Default is 960 × 540.Video resolution. You can customize it or choose from the following list:
VD_120x120: 120 × 120VD_160x120: 160 × 120VD_180x180: 180 × 180VD_240x180: 240 × 180VD_320x180: 320 × 180VD_240x240: 240 × 240VD_320x240: 320 × 240VD_424x240: 424 × 240VD_360x360: 360 × 360VD_480x360: 480 × 360VD_640x360: 640 × 360VD_480x480: 480 × 480VD_640x480: 640 × 480VD_840x480: 840 × 480VD_960x540: 960 × 540VD_960x720: 960 × 720VD_1280x720: 1280 × 720VD_1920x1080: 1920 × 1080VD_2540x1440: 2540 × 1440VD_3840x2160: 3840 × 2160.
- frameRate
- Frame rate (fps) for encoding video frames. Default is 15. See FRAME_RATE.
- minFrameRate
- (Reserved parameter) Minimum video encoding frame rate (fps). Default is
DEFAULT_MIN_FRAMERATE(-1), which means the SDK uses the lowest encoding frame rate. - bitrate
- Video encoding bitrate (Kbps). You don’t need to manually set this parameter; keep the default value STANDARD_BITRATE. The SDK will automatically match the most appropriate bitrate based on the set resolution and frame rate.
STANDARD_BITRATE (0): Recommended standard bitrate mode.COMPATIBLE_BITRATE (-1): Adaptive bitrate mode. Generally not recommended.
- minBitrate
- Minimum encoding bitrate (Kbps). The SDK automatically adjusts the encoding bitrate to adapt to network conditions. Setting a value higher than the default may force the encoder to output high-quality images, but may result in higher packet loss and affect transmission smoothness.
Note: This parameter applies only to the interactive live streaming scenario.
- orientationMode
- Orientation mode for video encoding. See ORIENTATION_MODE.
- degradationPrefer
- Video encoding degradation preference when bandwidth is limited. See DEGRADATION_PREFERENCE.
Note: When this parameter is set to
MAINTAIN_FRAMERATE (1)orMAINTAIN_BALANCED (2),orientationModemust also be set toORIENTATION_MODE_ADAPTIVE (0), otherwise the setting is invalid. - mirrorMode
-
Note: By default, the video has no mirror effect.Sets the mirror mode when publishing the local video stream. Only affects what remote users see:
VIDEO_MIRROR_MODE_AUTO (0): SDK decides whether to enable mirror mode. Default is disabled.VIDEO_MIRROR_MODE_ENABLED (1): Enable remote mirror.VIDEO_MIRROR_MODE_DISABLED (2): Disable remote mirror.
- advanceOptions
- Advanced options for video encoding. See AdvanceOptions.
- codecType
- Codec type for the local video stream. See VIDEO_CODEC_TYPE.