LiveTranscoding

  • HarmonyOS

更新时间不可用

旁路推流的转码属性。

TypeScript
export class LiveTranscoding {

  public width: number;

  public height: number;

  public videoBitrate: number;

  public videoFramerate: number;

  public videoGop: number;

  public watermarkList?: Array<AgoraImage>;

  public backgroundImageList?: Array<AgoraImage>;

  public audioSampleRate: Constants.AudioSampleRateType;

  public audioBitrate: number;

  public audioChannels: number;

  public audioCodecProfile: Constants.AudioCodecProfileType;

  public videoCodecProfile: Constants.VideoCodecProfileType;

  public videoCodecType: Constants.VideoCodecType;

  public userConfigExtraInfo?: string;

  public transcodingUsers: Map<number, TranscodingUser>;

  public advancedFeatures: Map<string, boolean>;
  constructor() {
    this.width = 360;
    this.height = 640;
    this.videoBitrate = 400;
    this.videoCodecProfile = Constants.VideoCodecProfileType.HIGH;
    this.videoCodecType = Constants.VideoCodecType.H264;
    this.videoGop = 30;
    this.videoFramerate = 15;
    this.audioSampleRate = Constants.AudioSampleRateType.TYPE_44100;
    this.audioBitrate = 48;
    this.audioChannels = 1;
    this.audioCodecProfile = Constants.AudioCodecProfileType.LC_AAC;
    this.advancedFeatures = new Map<string, boolean>();
    this.transcodingUsers = new Map<number, TranscodingUser>();
  }
}

参数名描述
width

推流视频的总宽度,默认值 360,单位为像素。

  • 如果推视频流,width 取值范围为 [64,1920]。如果取值低于 64,声网服务器会自动调整为 64; 如果取值高于 1920,声网服务器会自动调整为 1920。
  • 如果推音频流,请将 width 和 height 设为 0。
height

推流视频的总高度,默认值 640,单位为像素。

  • 如果推视频流,height 取值范围为 [64,1080]。如果取值低于 64,声网服务器会自动调整为 64; 如果取值高于 1080,声网服务器会自动调整为 1080。
  • 如果推音频流,请将 width 和 height 设为 0。
videoBitrate

视频编码码率,单位为 Kbps。该参数无需设置,保留默认值 STANDARD_BITRATE 即可,SDK 会根据你设定的视频分辨率和帧率自动匹配最合适的码率。有关视频分辨率和帧率的对应关系,详见视频属性。

videoFrameRate

用于旁路直播的输出视频的帧率。取值范围是 (0,30],单位为 fps。15 fps 为默认值。

注意: 声网服务器会将高于 30 fps 的帧率统一调整为 30 fps。

videoGop

用于旁路直播的输出视频的 GOP (Group of Pictures)。单位为帧。默认值为 30。

videoCodecProfile

用于旁路直播的输出视频的编码规格。可以设置为 66、77 或 100,详见 VideoCodecProfileType。

注意: 如果你把这个参数设为其他值,声网服务器会将其调整为默认值。

videoCodecType

用于旁路直播的输出视频的编解码类型。详见 VideoCodecType。

transcodingUsers

用于管理参与旁路直播的视频转码合图的用户。最多支持 17 人同时参与转码合图。详见 TranscodingUser。

userConfigExtraInfo

预留参数:用户自定义的发送到旁路推流客户端的信息,用于填充 H264/H265 视频中 SEI 帧内容。长度限制:4096 字节。关于 SEI 的详细信息,详见 SEI 帧相关问题。

audioSampleRate

用于旁路推流的输出媒体流的音频采样率 (Hz),详见 AudioSampleRateType。

audioBitrate

用于旁路直播的输出音频的码率。单位为 Kbps,默认值为 48,最大值为 128。

audioChannels

用于旁路直播的输出音频的声道数,默认值为 1。取值范围为 [1,5] 中的整型,建议取 1 或 2。3、4、5 需要特殊播放器支持:

  • 1: (默认)单声道
  • 2: 双声道
  • 3: 三声道
  • 4: 四声道
  • 5: 五声道
audioCodecProfile

用于旁路直播输出音频的编码规格。详见 AudioCodecProfileType。

表格内容超出当前宽度,可横向滚动查看更多列。

这个页面有帮助吗?