VideoCodecConfig

open class VideoCodecConfig(val mimeType: String = MediaFormat.MIMETYPE_VIDEO_AVC, val startBitrate: Int, val resolution: Size = Size(1280, 720), val fps: Int = 30, val profile: Int = getBestProfile(mimeType), val level: Int = getBestLevel(mimeType, profile), val gopDurationInS: Float = 1.0f) : CodecConfig

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

Constructors

Link copied to clipboard
constructor(mimeType: String = MediaFormat.MIMETYPE_VIDEO_AVC, resolution: Size = DEFAULT_RESOLUTION, startBitrate: Int = getBestBitrate(resolution), fps: Int = DEFAULT_FPS, profileLevel: MediaCodecInfo.CodecProfileLevel, gopDurationInS: Float = 1.0f)
constructor(mimeType: String = MediaFormat.MIMETYPE_VIDEO_AVC, startBitrate: Int, resolution: Size = Size(1280, 720), fps: Int = 30, profile: Int = getBestProfile(mimeType), level: Int = getBestLevel(mimeType, profile), gopDurationInS: 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

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 gopDurationInS: Float = 1.0f

Video encoder I-frame interval in seconds. This is a best effort as few camera can not generate a fixed frame rate. 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

Whether the configuration is HDR or not.

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.

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
fun copy(mimeType: String = this.mimeType, startBitrate: Int = this.startBitrate, resolution: Size = this.resolution, fps: Int = this.fps, profile: Int = this.profile, level: Int = this.level, gopDuration: Float = this.gopDurationInS): VideoCodecConfig

Copies video configuration with new values

Link copied to clipboard
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
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
fun VideoCodecConfig.rotateDegreesFromNaturalOrientation(context: Context, @IntRange(from = 0, to = 359) rotationDegrees: Int): VideoCodecConfig

Rotatse video configuration to rotationDegrees from device natural orientation.

Link copied to clipboard

Rotates video configuration to rotation from device natural orientation.

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