LiveTranscoding

Used to configure the transcoding parameters for media streaming.

struct LiveTranscoding {
  int width;
  int height;
  int videoBitrate;
  int videoFramerate;
  bool lowLatency;
  int videoGop;
  VIDEO_CODEC_PROFILE_TYPE videoCodecProfile;
  unsigned int backgroundColor;
  VIDEO_CODEC_TYPE_FOR_STREAM videoCodecType;
  unsigned int userCount;
  TranscodingUser* transcodingUsers;
  const char* transcodingExtraInfo;
  const char* metadata;
  RtcImage* watermark;
  unsigned int watermarkCount;
  RtcImage* backgroundImage;
  unsigned int backgroundImageCount;
  AUDIO_SAMPLE_RATE_TYPE audioSampleRate;
  int audioBitrate;
  int audioChannels;
  AUDIO_CODEC_PROFILE_TYPE audioCodecProfile;
  LiveStreamAdvancedFeature* advancedFeatures;
  unsigned int advancedFeatureCount;
};

Properties

width
Video width in pixels. Default is 360.
  • When pushing video streams to CDN, the valid range for width is [64,1920]. If less than 64, it is adjusted to 64; if greater than 1920, it is adjusted to 1920.
  • When pushing audio streams to CDN, set both width and height to 0.
height
Video height in pixels. Default is 640.
  • When pushing video streams to CDN, the valid range for height is [64,1080]. If less than 64, it is adjusted to 64; if greater than 1080, it is adjusted to 1080.
  • When pushing audio streams to CDN, set both width and height to 0.
videoBitrate
Video encoding bitrate (Kbps). You do not need to set this parameter. Keep the default value STANDARD_BITRATE. The SDK automatically matches the optimal bitrate based on the video resolution and frame rate. See Video profile for details.
videoFramerate
Frame rate (fps) of the output video stream for media streaming. Default is 15. Range is (0,30].
Note: Values greater than 30 are automatically adjusted to 30 by the Agora server.
lowLatency
Deprecated. Latency mode:
  • true: Low latency but quality not guaranteed.
  • false: (Default) High latency but guaranteed quality.
videoGop
GOP (Group of Pictures) frame rate for the streamed video, in fps. Default is 30.
videoCodecProfile
Video encoder profile type for media streaming. Can be set to 66, 77, or 100 (default). See VIDEO_CODEC_PROFILE_TYPE.
Note: If set to other values, Agora automatically adjusts to the default value.
backgroundColor
RGB hexadecimal value of the background color, value only, without prefix #. For example, 0xFFB6C1 represents light pink. Default is 0x000000 (black).
videoCodecType
Video encoder type used for media streaming. See VIDEO_CODEC_TYPE_FOR_STREAM.
userCount
Number of users in the media stream. Range is [0,17].
transcodingUsers
User layout configuration in the media stream. Supports up to 17 transcoding users. See TranscodingUser.
transcodingExtraInfo
Reserved parameter. Used to send user-defined information in the SEI of H.264/H.265 video streams to CDN clients. Maximum length is 4096 bytes.
metadata
Deprecated. Not recommended. Metadata sent to CDN clients.
watermark
Watermark in the live video. The image must be in PNG format. You can add one watermark or use an array to add multiple watermarks. This parameter works with watermarkCount. See RtcImage.
watermarkCount
Number of watermarks in the live video. The total number of watermarks and background images must be between 0 and 10. This parameter works with watermark.
backgroundImage
Background image in the live video. The image must be in PNG format. You can add one background image or use an array to add multiple background images. This parameter works with backgroundImageCount. See RtcImage.
backgroundImageCount
Number of background images in the live video. The total number of watermarks and background images must be between 0 and 10. This parameter works with backgroundImage.
audioSampleRate
Audio sample rate (Hz) of the output media stream. See AUDIO_SAMPLE_RATE_TYPE.
audioBitrate
Audio bitrate (Kbps) of the media stream. Default is 48. Maximum is 128.
audioChannels
Number of audio channels in the media stream.
  • 1: (Default) Mono.
  • 2: Stereo.
  • 3: Three channels.
  • 4: Four channels.
  • 5: Five channels.
Agora recommends using 1 or 2. Using 3, 4, or 5 requires special player support.
audioCodecProfile
Audio codec profile type for media streaming. See AUDIO_CODEC_PROFILE_TYPE.
advancedFeatures
Advanced features for transcoded media streaming. See LiveStreamAdvancedFeature.
advancedFeatureCount
Number of enabled advanced features. Default is 0.