不同 sdk 中设置:分辨率、码率、帧率

发布时间: 2022-01-04 15:20

回答:

一、RTCLib:直播或会议,可以在开播中动态设置 分辨率、码率、帧率:

RCRTCVideoStreamConfig.Builder videoConfigBuilder = RCRTCVideoStreamConfig.Builder.create();
// 设置分辨率
videoConfigBuilder.setVideoResolution(RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_720_1280);
// 设置帧率
videoConfigBuilder.setVideoFps(RCRTCParamsType.RCRTCVideoFps.Fps_30);
/**
 * 设置最小码率,可根据分辨率RCRTCVideoResolution设置
 * {@link RCRTCParamsType.RCRTCVideoResolution)}
 */
videoConfigBuilder.setMinRate(250);
/**
 * 设置最大码率,可根据分辨率RCRTCVideoResolution设置
 * {@link RCRTCParamsType.RCRTCVideoResolution)}
 */
videoConfigBuilder.setMaxRate(2200);
RCRTCEngine.getInstance().getDefaultVideoStream().setVideoConfig(videoConfigBuilder.build());


二、CallLib:音视频通话,在 RongCallClient#startCall 和 RongCallClient#acceptCall 去设置分辨率、码率、帧率:

RCRTCVideoStreamConfig.Builder builder = RCRTCVideoStreamConfig.Builder.create();
builder.setVideoResolution(RCRTCVideoResolution.RESOLUTION_480_640);//分辨率
builder.setVideoFps(RCRTCParamsType.RCRTCVideoFps.Fps_15);//帧率
builder.setMaxRate(900);//最大码率
builder.setMinRate(200);//最小码率
RongCallClient.getInstance().setVideoConfig(builder);


官方文档:

分辨率设置:https://doc.rongcloud.cn/call/Android/5.X/calllib/video/resolution

码率设置:https://doc.rongcloud.cn/call/Android/5.X/calllib/video/bitrate