VideoConfig

class VideoConfig(val mimeType: String = MediaFormat.MIMETYPE_VIDEO_AVC, val startBitrate: Int = 2000000, val resolution: Size = Size(1280, 720), val fps: Int = 30, val profile: Int = getBestProfile(mimeType), val level: Int = getBestLevel(mimeType, profile), val gopDuration: Float = 1.0f) : Config

Video configuration class. If you don't know how to set class members, Video encoding recommendations should give you hints.

See also

Constructors

Link copied to clipboard
constructor(mimeType: String = MediaFormat.MIMETYPE_VIDEO_AVC, resolution: Size = Size(1280, 720), startBitrate: Int = getBestBitrate(resolution), fps: Int = 30, profileLevel: MediaCodecInfo.CodecProfileLevel, gopDuration: Float = 1.0f)
constructor(mimeType: String = MediaFormat.MIMETYPE_VIDEO_AVC, startBitrate: Int = 2000000, resolution: Size = Size(1280, 720), fps: Int = 30, profile: Int = getBestProfile(mimeType), level: Int = getBestLevel(mimeType, profile), gopDuration: Float = 1.0f)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Get default encoder name. If name is null, it won't be possible to start a stream.

Link copied to clipboard
val dynamicRangeProfile: DynamicRangeProfile

The dynamic range profile. It is deduced from the profile. See Also: DynamicRangeProfiles

Link copied to clipboard
val fps: Int = 30

Video framerate. This is a best effort as few camera can not generate a fixed framerate.

Link copied to clipboard
val gopDuration: Float = 1.0f

Video encoder I-frame interval in seconds. This is a best effort as few camera can not generate a fixed framerate. For live streaming, I-frame interval should be really low. For recording, I-frame interval should be higher. A value of 0 means that each frame is an I-frame. On device with API < 25, this value will be rounded to an integer. So don't expect a precise value and any value < 0.5 will be considered as 0.

Link copied to clipboard

Check if this configuration is supported by the default encoder. If format is not supported, it won't be possible to start a stream.

Link copied to clipboard
val level: Int

Video encoder level. Encoders may not support requested level. In this case, StreamPack fallbacks to default level. ** See ** MediaCodecInfo.CodecProfileLevel

Link copied to clipboard

The encoder mime type. Only MediaFormat.MIMETYPE_AUDIO_AAC is supported yet.

Link copied to clipboard
val profile: Int = 0

The encoder profile. Only applicable to AAC, AVC, HEVC, VP9, AV1.

Link copied to clipboard

Video output resolution in pixel.

Link copied to clipboard

The encoder bitrate in bits/s.

Functions

Link copied to clipboard

Get resolution according to device orientation

Link copied to clipboard

Check if this configuration is supported by the specified encoder. If format is not supported, it won't be possible to start a stream.

Link copied to clipboard
open override fun toString(): String