LiveTranscoding

Transcoding configurations for Media Push.

public class LiveTranscoding
    {
        public LiveTranscoding()
        {
            width = 360;
            height = 640;
            videoBitrate = 400;
            videoFramerate = 15;
            lowLatency = false;
            videoGop = 30;
            videoCodecProfile = VIDEO_CODEC_PROFILE_TYPE.VIDEO_CODEC_PROFILE_HIGH;
            backgroundColor = 0x000000;
            videoCodecType = VIDEO_CODEC_TYPE_FOR_STREAM.VIDEO_CODEC_H264_FOR_STREAM;
            userCount = 0;
            transcodingUsers = new TranscodingUser[0];
            transcodingExtraInfo = null;
            metadata = null;
            watermark = new RtcImage[0];
            watermarkCount = 0;
            backgroundImage = new RtcImage[0];
            backgroundImageCount = 0;
            audioSampleRate = AUDIO_SAMPLE_RATE_TYPE.AUDIO_SAMPLE_RATE_48000;
            audioBitrate = 48;
            audioChannels = 1;
            audioCodecProfile = AUDIO_CODEC_PROFILE_TYPE.AUDIO_CODEC_PROFILE_LC_AAC;
            advancedFeatures = new LiveStreamAdvancedFeature[0];
            advancedFeatureCount = 0;
        }

        public LiveTranscoding(int width, int height, int videoBitrate, int videoFramerate, bool lowLatency,
            int videoGop, VIDEO_CODEC_PROFILE_TYPE videoCodecProfile, uint backgroundColor,
            VIDEO_CODEC_TYPE_FOR_STREAM videoCodecType, uint userCount, TranscodingUser[] transcodingUsers,
            string transcodingExtraInfo, string metadata, RtcImage[] watermark, uint watermarkCount,
            RtcImage[] backgroundImage, uint backgroundImageCount,
            AUDIO_SAMPLE_RATE_TYPE audioSampleRate, int audioBitrate, int audioChannels,
            AUDIO_CODEC_PROFILE_TYPE audioCodecProfile, LiveStreamAdvancedFeature[] advancedFeatures, uint advancedFeatureCount)
        {
            this.width = width;
            this.height = height;
            this.videoBitrate = videoBitrate;
            this.videoFramerate = videoFramerate;
            this.lowLatency = lowLatency;
            this.videoGop = videoGop;
            this.videoCodecProfile = videoCodecProfile;
            this.backgroundColor = backgroundColor;
            this.videoCodecType = videoCodecType;
            this.userCount = userCount;
            this.transcodingUsers = transcodingUsers;
            this.transcodingExtraInfo = transcodingExtraInfo;
            this.metadata = metadata;
            this.watermark = watermark;
            this.watermarkCount = watermarkCount;
            this.backgroundImage = backgroundImage;
            this.backgroundImageCount = backgroundImageCount;
            this.audioSampleRate = audioSampleRate;
            this.audioBitrate = audioBitrate;
            this.audioChannels = audioChannels;
            this.audioCodecProfile = audioCodecProfile;
            this.advancedFeatures = advancedFeatures;
            this.advancedFeatureCount = advancedFeatureCount;
        }
        public int width { set; get; }
        public int height { set; get; }
        public int videoBitrate { set; get; }
        public int videoFramerate { set; get; }
        public bool lowLatency { set; get; }
        public int videoGop { set; get; }
        public VIDEO_CODEC_PROFILE_TYPE videoCodecProfile { set; get; }
        public uint backgroundColor { set; get; }
        public VIDEO_CODEC_TYPE_FOR_STREAM videoCodecType { set; get; }
        public uint userCount { set; get; }
        public TranscodingUser[] transcodingUsers { set; get; }
        public string transcodingExtraInfo { set; get; }
        public string metadata { set; get; }
        public RtcImage[] watermark { set; get; }
        public uint watermarkCount { set; get; }
        public RtcImage[] backgroundImage { set; get; }
        public uint backgroundImageCount { set; get; }
        public AUDIO_SAMPLE_RATE_TYPE audioSampleRate { set; get; }
        public int audioBitrate { set; get; }
        public int audioChannels { set; get; }
        public AUDIO_CODEC_PROFILE_TYPE audioCodecProfile { set; get; }
        public LiveStreamAdvancedFeature[] advancedFeatures { set; get; }
        public uint advancedFeatureCount { set; get; }
    }

Attributes

width

The width of the video in pixels. The default value is 360.

  • When pushing video streams to the CDN, the value range of width is [64,1920]. If the value is less than 64, Agora server automatically adjusts it to 64; if the value is greater than 1920, Agora server automatically adjusts it to 1920.
  • When pushing audio streams to the CDN, set width and height as 0.
height

The height of the video in pixels. The default value is 640.

  • When pushing video streams to the CDN, the value range of height is [64,1080]. If the value is less than 64, Agora server automatically adjusts it to 64; if the value is greater than 1080, Agora server automatically adjusts it to 1080.
  • When pushing audio streams to the CDN, set width and height as 0.
videoBitrate

The encoding bitrate (Kbps) of the video. See BITRATE.This parameter does not need to be set; keeping the default value STANDARD_BITRATE is sufficient. The SDK automatically matches the most suitable bitrate based on the video resolution and frame rate you have set. For the correspondence between video resolution and frame rate, see Video profile.

videoFrameRate

Frame rate (fps) of the output video stream set for Media Push. The default value is 15. The value range is (0,30].

Attention: The Agora server adjusts any value over 30 to 30.
lowLatency
Deprecated
This member is deprecated.

Latency mode:

  • true: Low latency with unassured quality.
  • false: (Default) High latency with assured quality.
videoGop
GOP (Group of Pictures) in fps of the video frames for Media Push. The default value is 30.
videoCodecProfile

Video codec profile type for Media Push. Set it as 66, 77, or 100 (default). See VIDEO_CODEC_PROFILE_TYPE for details.

Attention: If you set this parameter to any other value, Agora adjusts it to the default value.
videoCodecType
Video codec profile types for Media Push. See VIDEO_CODEC_TYPE_FOR_STREAM.
transcodingUsers

Manages the user layout configuration in the Media Push. Agora supports a maximum of 17 transcoding users in a Media Push channel. See TranscodingUser.

transcodingExtraInfo

Reserved property. Extra user-defined information to send SEI for the H.264/H.265 video stream to the CDN live client. Maximum length: 4096 bytes. For more information on SEI, see SEI-related questions.

backgroundColor

The background color in RGB hex value. Value only. Do not include a preceeding #. For example, 0xFFB6C1 (light pink). The default value is 0x000000 (black).

userCount

The number of users in the Media Push. The value range is [0,17].

metadata
Deprecated
Obsolete and not recommended for use.

The metadata sent to the CDN client.

watermark

The watermark on the live video. The image format needs to be PNG. See RtcImage.

You can add one watermark, or add multiple watermarks using an array. This parameter is used with watermarkCount.

backgroundImage

The number of background images on the live video. The image format needs to be PNG. See RtcImage.

You can add a background image or use an array to add multiple background images. This parameter is used with backgroundImageCount.

audioSampleRate

The audio sampling rate (Hz) of the output media stream. See AUDIO_SAMPLE_RATE_TYPE.

audioBitrate

Bitrate (Kbps) of the audio output stream for Media Push. The default value is 48, and the highest value is 128.

audioChannels

The number of audio channels for Media Push. Agora recommends choosing 1 (mono), or 2 (stereo) audio channels. Special players are required if you choose 3, 4, or 5.

  • 1: (Default) Mono
  • 2: Stereo.
  • 3: Three audio channels.
  • 4: Four audio channels.
  • 5: Five audio channels.
audioCodecProfile
Audio codec profile type for Media Push. See AUDIO_CODEC_PROFILE_TYPE.
watermarkCount
The number of watermarks on the live video. The total number of watermarks and background images can range from 0 to 10. This parameter is used with watermark.
backgroundImageCount
The number of background images on the live video. The total number of watermarks and background images can range from 0 to 10. This parameter is used with backgroundImage.
advancedFeatures
Advanced features of the Media Push with transcoding. See LiveStreamAdvancedFeature.
advancedFeatureCount
The number of enabled advanced features. The default value is 0.