LiveTranscoding
Transcoding properties for RTMP streaming.
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; }
}
Properties
- width
- The 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, the Agora server adjusts it to 64; if greater than 1920, it adjusts to 1920.
- For audio-only streams, set both
widthandheightto 0.
- height
- The 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, the Agora server adjusts it to 64; if greater than 1080, it adjusts to 1080.
- For audio-only streams, set both
widthandheightto 0.
- videoBitrate
- Video encoding bitrate in Kbps. See BITRATE. You don't need to set this parameter; keep the default STANDARD_BITRATE. The SDK automatically matches the optimal bitrate based on your video resolution and frame rate. For more on resolution and frame rate, see Video Profile.
- videoFramerate
- Frame rate of the output video for RTMP streaming. Range is (0,30], in fps. Default is 15 fps.
Note: The Agora server adjusts any frame rate above 30 fps to 30 fps.
- lowLatency
-
Note: Deprecated. Not recommended for use.Low-latency mode
- true: Low latency, lower video quality.
- false: (Default) Higher latency, better video quality.
- videoGop
- GOP (Group of Pictures) of the output video for RTMP streaming, in frames. Default is 30.
- videoCodecProfile
- Codec profile of the output video for RTMP streaming. Can be set to 66, 77, or 100. See VIDEO_CODEC_PROFILE_TYPE.
Note: If you set this to another value, the Agora server resets it to the default.
- videoCodecType
- Codec type of the output video for RTMP streaming. See VIDEO_CODEC_TYPE_FOR_STREAM.
- transcodingUsers
- Manages the users participating in the video mixing for RTMP streaming. Supports up to 17 users. See TranscodingUser.
- transcodingExtraInfo
- Reserved parameter: Custom information sent to the RTMP client, used to populate SEI frames in H264/H265 video. Max length: 4096 bytes.
- backgroundColor
- Background color of the output video for RTMP streaming, represented as a hexadecimal RGB integer without the # symbol. For example, 0xFFB6C1 is light pink. Default is 0x000000 (black).
- userCount
- Number of users participating in the video mixing. Default is 0. Range: [0,17].
- metadata
- Metadata sent to CDN clients.
Note: Deprecated. Not recommended for use.
- watermark
- Watermark(s) on the live video. PNG format is required. See RtcImage.
You can add one watermark or use an array to add multiple. Use this parameter together with
watermarkCount. - backgroundImage
- Background image(s) on the live video. PNG format is required. See RtcImage.
You can add one background image or use an array to add multiple. Use this parameter together with
backgroundImageCount. - audioSampleRate
- Audio sample rate (Hz) of the output media stream for RTMP streaming. See AUDIO_SAMPLE_RATE_TYPE.
- audioBitrate
- Bitrate of the output audio for RTMP streaming, in Kbps. Default is 48, maximum is 128.
- audioChannels
- Number of audio channels in the output audio for RTMP streaming. Default is 1. Valid values are integers in [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
- Codec profile of the output audio for RTMP streaming. See AUDIO_CODEC_PROFILE_TYPE.
- watermarkCount
- Number of watermarks on the live video. The total number of watermarks and background images must be between 0 and 10. Use this parameter 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. Use this parameter together with
backgroundImage. - advancedFeatures
- Advanced features for transcoding and streaming. See LiveStreamAdvancedFeature.
- advancedFeatureCount
- Number of enabled advanced features. Default is 0.