Package io.agora.rtc2.live
Class LiveTranscoding
java.lang.Object
io.agora.rtc2.live.LiveTranscoding
A class for managing user-specific CDN live audio/video transcoding settings.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSelf-defined audio codec profile.static enumAudio sample rate (Hz).static classThe transcodingUser class which defines the video properties of the user displaying the video in the CDN live.static enumSelf-defined video codec profile.static enumThe video codec type of the output video stream. -
Field Summary
FieldsModifier and TypeFieldDescriptionintBitrate (Kbps) of the CDN live audio output stream.intThe number of audio channels for the CDN live stream.Audio codec profile type:AudioCodecProfileType.Self-defined audio-sample rate:AudioSampleRateType.intDeprecated.This parameter is deprecated.intThe height of the video in pixels.booleanDeprecated.Deprecated as of v2.8.0.Deprecated.This parameter is deprecated.Reserved property.intDeprecated.This parameter is deprecated.intThe bitrate (Kbps) of the video.Video codec profile type:VideoCodecProfileType.The video codec type of the output video stream.intThe frame rate (fps) of the video.intGop of the video frames in the CDN live stream.intThe width of the video in pixels. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBackgroundImage(AgoraImage backgroundImage) add background image to backgroundImageListintAdds a user displaying the video in CDN live.voidaddWatermark(AgoraImage watermark) add watermark to listChecks whether advanced features of the RTMP or RTMPS streaming with transcoding are enabled.intGets the background color in hex.get object attribute of backgroundImageListintgetBlue()Deprecated.Gets the background color's blue component.intgetGreen()Deprecated.Gets the background color's green component.intgetRed()Deprecated.Gets the background color's red component.intGets the number of users transcoded in CDN live.getUsers()Gets the user list in CDN live.get object attribute of watermarkListbooleanremoveBackgroundImage(AgoraImage backgroundImage) remove background from background image listintremoveUser(int uid) Removes a user from CDN live.booleanremoveWatermark(AgoraImage watermark) remove watermark from listvoidsetAdvancedFeatures(String featureName, Boolean opened) Enables/Disables advanced features of the RTMP or RTMPS streaming with transcoding.voidsetBackgroundColor(int color) Sets the background color of the CDN live stream in the format of RGB hex.voidsetBackgroundColor(int red, int green, int blue) Sets the background color in RGB format.voidsetBlue(int blue) Deprecated.Sets the background color's blue component.voidsetGreen(int green) Deprecated.Sets the background color's green component.voidsetRed(int red) Deprecated.Sets the background color's red component.voidSets the users in batches in CDN live.voidSets the users in batches in CDN live.
-
Field Details
-
width
public int widthThe 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
public int heightThe 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
public int videoBitrateThe bitrate (Kbps) of the video. The default value is 400. Set this parameter according to theVideo Bitrate Table. If you set a bitrate beyond the proper range, the SDK automatically adapts it to a value within the range. -
videoFramerate
public int videoFramerateThe frame rate (fps) of the video. The value range is (0, 30]. The default value is 15. The Agora server adjusts any value over 30 to 30. -
lowLatency
Deprecated.Deprecated as of v2.8.0. Agora does not recommend using this parameter. Latency mode:- true: Low latency with unassured quality.
- false: (Default) High latency with assured quality.
-
videoGop
public int videoGopGop of the video frames in the CDN live stream. The default value is 30 fps. -
audioSampleRate
Self-defined audio-sample rate:AudioSampleRateType. -
audioBitrate
public int audioBitrateBitrate (Kbps) of the CDN live audio output stream. The default value is 48 and the highest value is 128. -
audioChannels
public int audioChannelsThe number of audio channels for the CDN live stream. 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:AudioCodecProfileType. Set it as LC-AAC or HE-AAC. The default value is LC-AAC. -
videoCodecProfile
Video codec profile type:VideoCodecProfileType. Set it as BASELINE, MAIN, or HIGH (default). If you set this parameter to other values, Agora adjusts it to the default value HIGH. -
videoCodecType
The video codec type of the output video stream. SeeVideoCodecType. -
userCount
Deprecated.This parameter is deprecated. We recommend using thegetUserCountmethod.Number of users in the live broadcast. -
backgroundColor
Deprecated.This parameter is deprecated. We recommend using thesetBackgroundColormethod to set the background color.The background color in RGB hex. Value only. Do not include a preceding #. For example, 0xFFB6C1 (light pink). The default value is 0x000000 (black). -
userConfigExtraInfo
Reserved property. Extra user-defined information to send the Supplemental Enhancement Information (SEI) for the H.264/H.265 video stream to the CDN live client. Maximum length: 4096 Bytes. For more information on SEI frames, see [SEI-related questions](https://docs.agora.io/en/faq/sei). -
metadata
Deprecated.This parameter is deprecated.The metadata sent to the CDN live client.
-
-
Constructor Details
-
LiveTranscoding
public LiveTranscoding()
-
-
Method Details
-
addWatermark
add watermark to list- Parameters:
watermark- you want to add watermark.
-
removeWatermark
remove watermark from list- Parameters:
watermark- you want to remove object.- Returns:
- if success, will return true. Otherwise, will return false.
-
getWatermarkList
get object attribute of watermarkList- Returns:
- watermark list
-
addBackgroundImage
add background image to backgroundImageList- Parameters:
backgroundImage- you want to add background to list.
-
removeBackgroundImage
remove background from background image list- Parameters:
backgroundImage- you want to remove background image- Returns:
- if success to remove, will return true. Otherwise, will return false.
-
getBackgroundImageList
get object attribute of backgroundImageList- Returns:
- backgroundImage list
-
setAdvancedFeatures
Enables/Disables advanced features of the RTMP or RTMPS streaming with transcoding.- Parameters:
featureName- The name of the advanced feature. It contains LBHQ and VEO.opened- Whether to enable the advanced feature: - `true`: Enable the advanced feature. - `false`: (Default) Disable the advanced feature.
-
getAdvancedFeatures
Checks whether advanced features of the RTMP or RTMPS streaming with transcoding are enabled.- Returns:
- The name of each advanced feature and whether the advanced feature is enabled.
-
addUser
Adds a user displaying the video in CDN live.- Parameters:
user-transcodingUser.- Returns:
- 0: Success.
- <0: Failure.
-
getUsers
Gets the user list in CDN live. This method retrieves all users in CDN live. The user list returned by this method is read-only and should not be modified.- Returns:
- User list in a array.
-
setUsers
Sets the users in batches in CDN live. This method sets all users involved in the CDN live stream. This method replaces the old user data with the new user data.- Parameters:
users- All users involved in CDN live.
-
setUsers
Sets the users in batches in CDN live. This method sets all users involved in CDN live. This method replaces the old user data with the the new user data.- Parameters:
users- All users involved in CDN live.
-
removeUser
public int removeUser(int uid) Removes a user from CDN live.- Parameters:
uid- User ID of the user to remove from CDN live.- Returns:
- 0: Success.
- < 0: Failure.
-
getUserCount
public int getUserCount()Gets the number of users transcoded in CDN live.- Returns:
- Number of users transcoded in CDN live.
-
getBackgroundColor
public int getBackgroundColor()Gets the background color in hex.- Returns:
- Background color to set in RGB hex value.
-
setBackgroundColor
public void setBackgroundColor(int color) Sets the background color of the CDN live stream in the format of RGB hex.- Parameters:
color- Background color to set in RGB hex value. Value only, do not include a #. For example, 0xFFB6C1 (light pink). The default value is 0x000000 (black).
-
setBackgroundColor
public void setBackgroundColor(int red, int green, int blue) Sets the background color in RGB format.- Parameters:
red- Red component.green- Green component.blue- Blue component.
-
getRed
Deprecated.Gets the background color's red component.- Returns:
- Background color's red component.
-
getGreen
Deprecated.Gets the background color's green component.- Returns:
- Background color's green component.
-
getBlue
Deprecated.Gets the background color's blue component.- Returns:
- Background color's blue component.
-
setRed
Deprecated.Sets the background color's red component. -
setGreen
Deprecated.Sets the background color's green component. -
setBlue
Deprecated.Sets the background color's blue component.
-