LiveTranscoding

Transcoding properties for CDN live streaming.

class LiveTranscoding {
  const LiveTranscoding(
      {this.width,
      this.height,
      this.videoBitrate,
      this.videoFramerate,
      this.lowLatency,
      this.videoGop,
      this.videoCodecProfile,
      this.backgroundColor,
      this.videoCodecType,
      this.userCount,
      this.transcodingUsers,
      this.transcodingExtraInfo,
      this.metadata,
      this.watermark,
      this.watermarkCount,
      this.backgroundImage,
      this.backgroundImageCount,
      this.audioSampleRate,
      this.audioBitrate,
      this.audioChannels,
      this.audioCodecProfile,
      this.advancedFeatures,
      this.advancedFeatureCount});

  @JsonKey(name: 'width')
  final int? width;

  @JsonKey(name: 'height')
  final int? height;

  @JsonKey(name: 'videoBitrate')
  final int? videoBitrate;

  @JsonKey(name: 'videoFramerate')
  final int? videoFramerate;

  @JsonKey(name: 'lowLatency')
  final bool? lowLatency;

  @JsonKey(name: 'videoGop')
  final int? videoGop;

  @JsonKey(name: 'videoCodecProfile')
  final VideoCodecProfileType? videoCodecProfile;

  @JsonKey(name: 'backgroundColor')
  final int? backgroundColor;

  @JsonKey(name: 'videoCodecType')
  final VideoCodecTypeForStream? videoCodecType;

  @JsonKey(name: 'userCount')
  final int? userCount;

  @JsonKey(name: 'transcodingUsers')
  final List<TranscodingUser>? transcodingUsers;

  @JsonKey(name: 'transcodingExtraInfo')
  final String? transcodingExtraInfo;

  @JsonKey(name: 'metadata')
  final String? metadata;

  @JsonKey(name: 'watermark')
  final List<RtcImage>? watermark;

  @JsonKey(name: 'watermarkCount')
  final int? watermarkCount;

  @JsonKey(name: 'backgroundImage')
  final List<RtcImage>? backgroundImage;

  @JsonKey(name: 'backgroundImageCount')
  final int? backgroundImageCount;

  @JsonKey(name: 'audioSampleRate')
  final AudioSampleRateType? audioSampleRate;

  @JsonKey(name: 'audioBitrate')
  final int? audioBitrate;

  @JsonKey(name: 'audioChannels')
  final int? audioChannels;

  @JsonKey(name: 'audioCodecProfile')
  final AudioCodecProfileType? audioCodecProfile;

  @JsonKey(name: 'advancedFeatures')
  final List<LiveStreamAdvancedFeature>? advancedFeatures;

  @JsonKey(name: 'advancedFeatureCount')
  final int? advancedFeatureCount;

  factory LiveTranscoding.fromJson(Map<String, dynamic> json) =>
      _$LiveTranscodingFromJson(json);

  Map<String, dynamic> toJson() => _$LiveTranscodingToJson(this);
}

Properties

width
Total width of the video stream in pixels. Default is 360.
  • For video streams, the value range is [64,1920]. If the value is less than 64, it is automatically adjusted to 64 by the Agora server; if it is greater than 1920, it is adjusted to 1920.
  • For audio-only streams, set both width and height to 0.
height
Total height of the video stream in pixels. Default is 640.
  • For video streams, the value range is [64,1080]. If the value is less than 64, it is automatically adjusted to 64 by the Agora server; if it is greater than 1080, it is adjusted to 1080.
  • For audio-only streams, set both width and height to 0.
videoBitrate
Video encoding bitrate in Kbps. You do not need to set this parameter. Keep the default value standardBitrate. The SDK automatically matches the most appropriate bitrate based on the video resolution and frame rate you set. For the mapping between resolution and frame rate, see Video Profile.
videoFramerate
Frame rate of the output video for CDN live streaming. Value range is (0,30], in fps. Default is 15 fps.
Note: The Agora server adjusts any value above 30 fps to 30 fps.
lowLatency
Note: Deprecated. Not recommended.
Low latency mode
  • true: Low latency, video quality not guaranteed.
  • false: (Default) High latency, video quality guaranteed.
videoGop
GOP (Group of Pictures) of the output video for CDN live streaming, in frames. Default is 30.
videoCodecProfile
Encoding profile of the output video for CDN live streaming. Can be set to 66, 77, or 100. See VideoCodecProfileType.
Note: If you set this parameter to other values, the Agora server adjusts it to the default value.
videoCodecType
Codec type of the output video for CDN live streaming. See VideoCodecTypeForStream.
transcodingUsers
Users participating in video mixing for CDN live streaming. Supports up to 17 users simultaneously. See TranscodingUser.
transcodingExtraInfo
Reserved parameter: Custom information sent to the CDN streaming client, used to populate SEI frames in H264/H265 video. Length limit: 4096 bytes.
backgroundColor
Background color of the output video for CDN live streaming, in hexadecimal RGB integer format without the # sign. For example, 0xFFB6C1 represents light pink. Default is 0x000000 (black).
userCount
Number of users in the video mix. Default is 0. Value range is [0,17].
metadata
Metadata sent to the CDN client.
Note: Deprecated. Not recommended.
watermark
Watermark on the live video. The image format must be PNG. See RtcImage. You can add one watermark or use an array to add multiple watermarks.
backgroundImage
Background image on the live video. The image format must be PNG. See RtcImage. You can add one background image or use an array to add multiple background images. This parameter is used together with backgroundImageCount.
audioSampleRate
Audio sample rate (Hz) of the output media stream for CDN streaming. See AudioSampleRateType.
audioBitrate
Bitrate of the output audio for CDN live streaming, in Kbps. Default is 48, maximum is 128.
audioChannels
Number of audio channels in the output audio for CDN live streaming. Default is 1. Acceptable integer values are [1,5]. Recommended values are 1 or 2. Values 3, 4, and 5 require special player support:
  • 1: (Default) Mono
  • 2: Stereo
  • 3: Three channels
  • 4: Four channels
  • 5: Five channels
audioCodecProfile
Audio codec profile of the output audio for CDN live streaming. See AudioCodecProfileType.
watermarkCount
Number of watermarks on the live video. The total number of watermarks and background images must be between 0 and 10. This parameter is used together with watermark.
backgroundImageCount
Number of background images on the live video. The total number of watermarks and background images must be between 0 and 10. This parameter is used together with backgroundImage.
advancedFeatures
Advanced features for transcoding and streaming. See LiveStreamAdvancedFeature.
advancedFeatureCount
Number of enabled advanced features. Default is 0.