Show / Hide Table of Contents

Interface ICodecParameters

Defines an interface for accessing and modifying codec parameters, including audio, video, and general stream properties.

Namespace: FFmpeg.Codecs
Assembly: FFmpeg.dll
Syntax
public interface ICodecParameters

Properties

View Source

BitRate

Gets or sets the target bit rate in bits per second for the codec.

Declaration
int BitRate { get; set; }
Property Value
Type Description
int
View Source

BitsPerCodedSample

Gets or sets the number of bits per coded sample.

Declaration
int BitsPerCodedSample { get; set; }
Property Value
Type Description
int
View Source

BitsPerRawSample

Gets or sets the number of bits per raw (uncoded) sample.

Declaration
int BitsPerRawSample { get; set; }
Property Value
Type Description
int
View Source

BlockAlign

Gets or sets the block alignment (in bytes) for audio data.

Declaration
int BlockAlign { get; set; }
Property Value
Type Description
int
View Source

ChannelLayout

Gets or sets the channel layout, which defines the spatial arrangement of audio channels (e.g., mono, stereo, 5.1 surround).

Declaration
ChannelLayout ChannelLayout { get; set; }
Property Value
Type Description
ChannelLayout
Remarks

The channel layout determines how audio channels are positioned and should match the number of channels and the codec in use.

View Source

Channels

Gets the number of audio channels for the current codec parameters.

Declaration
int Channels { get; }
Property Value
Type Description
int
Remarks

This value indicates the number of channels in the audio stream, such as 1 for mono, 2 for stereo, or higher for surround formats. The meaning is related to the ChannelLayout property.

View Source

ChromaLocation

Gets or sets the chroma sample location for video data.

Declaration
ChromaLocation ChromaLocation { get; set; }
Property Value
Type Description
ChromaLocation
View Source

CodecId

Gets or sets the codec identifier specifying the codec type (e.g., H264, AAC).

Declaration
CodecID CodecId { get; set; }
Property Value
Type Description
CodecID
View Source

CodecTag

Gets or sets the codec tag, a four-character code or integer identifying the codec.

Declaration
FourCC CodecTag { get; set; }
Property Value
Type Description
FourCC
View Source

ColorPrimaries

Gets or sets the color primaries used for color interpretation in video streams.

Declaration
ColorPrimaries ColorPrimaries { get; set; }
Property Value
Type Description
ColorPrimaries
View Source

ColorRange

Gets or sets the color range (e.g., limited or full) for video data.

Declaration
ColorRange ColorRange { get; set; }
Property Value
Type Description
ColorRange
View Source

ColorSpace

Gets or sets the color space for video data.

Declaration
ColorSpace ColorSpace { get; set; }
Property Value
Type Description
ColorSpace
View Source

ColorTransferCharacteristic

Gets or sets the color transfer characteristic for video data.

Declaration
ColorTransferCharacteristic ColorTransferCharacteristic { get; set; }
Property Value
Type Description
ColorTransferCharacteristic
View Source

ExtraData

Gets a span containing codec-specific extra data, such as headers or tables.

Declaration
Span<byte> ExtraData { get; }
Property Value
Type Description
Span<byte>
View Source

FieldOrder

Gets or sets the field order for interlaced video (e.g., top field first).

Declaration
FieldOrder FieldOrder { get; set; }
Property Value
Type Description
FieldOrder
View Source

FrameRate

Gets or sets the frame rate for video streams.

Declaration
Rational FrameRate { get; set; }
Property Value
Type Description
Rational
View Source

FrameSize

Gets or sets the frame size, such as the number of audio samples per frame.

Declaration
int FrameSize { get; set; }
Property Value
Type Description
int
View Source

Height

Gets or sets the height of the video frame in pixels.

Declaration
int Height { get; set; }
Property Value
Type Description
int
View Source

InitialPadding

Gets or sets the initial padding for audio data, in samples.

Declaration
int InitialPadding { get; set; }
Property Value
Type Description
int
View Source

Level

Gets or sets the codec level, which may indicate the complexity or feature set.

Declaration
int Level { get; set; }
Property Value
Type Description
int
View Source

MediaType

Gets or sets the media type (e.g., audio, video, subtitle) for the stream.

Declaration
MediaType MediaType { get; set; }
Property Value
Type Description
MediaType
View Source

PixelFormat

Gets or sets the pixel format, which specifies how video frames are stored and processed.

Declaration
PixelFormat PixelFormat { get; set; }
Property Value
Type Description
PixelFormat
Remarks

Ensure the assigned value is compatible with the codec and video stream.

View Source

Profile

Gets or sets the codec profile, which defines the feature set and restrictions for the codec.

Declaration
Profile Profile { get; set; }
Property Value
Type Description
Profile
View Source

SampleAspectRatio

Gets or sets the sample aspect ratio for video frames.

Declaration
Rational SampleAspectRatio { get; set; }
Property Value
Type Description
Rational
View Source

SampleFormat

Gets or sets the sample format, which specifies how audio samples are stored and processed.

Declaration
SampleFormat SampleFormat { get; set; }
Property Value
Type Description
SampleFormat
Remarks

Ensure the assigned value is compatible with the codec and audio stream.

View Source

SampleRate

Gets or sets the audio sample rate in Hz.

Declaration
int SampleRate { get; set; }
Property Value
Type Description
int
View Source

SeekPreroll

Gets or sets the seek preroll, which is the number of samples to discard before playback starts.

Declaration
int SeekPreroll { get; set; }
Property Value
Type Description
int
View Source

TrailingPadding

Gets or sets the trailing padding for audio data, in samples.

Declaration
int TrailingPadding { get; set; }
Property Value
Type Description
int
View Source

VideoDelay

Gets or sets the video delay, which is the number of frames of delay for video decoding.

Declaration
int VideoDelay { get; set; }
Property Value
Type Description
int
View Source

Width

Gets or sets the width of the video frame in pixels.

Declaration
int Width { get; set; }
Property Value
Type Description
int

Methods

View Source

CopyFrom(CodecContext)

Copies all codec parameters from a CodecContext instance.

Declaration
void CopyFrom(CodecContext context)
Parameters
Type Name Description
CodecContext context

The source codec context to copy from.

View Source

CopyFrom(ICodecParameters)

Copies all codec parameters from another ICodecParameters instance.

Declaration
void CopyFrom(ICodecParameters other)
Parameters
Type Name Description
ICodecParameters other

The source codec parameters to copy from.

View Source

CopyTo(CodecContext)

Copies all codec parameters to a CodecContext instance.

Declaration
void CopyTo(CodecContext context)
Parameters
Type Name Description
CodecContext context

The destination codec context to copy to.

View Source

GetAudioFrameDuration(int)

Calculates the duration of an audio frame based on the number of bytes in the frame.

Declaration
int GetAudioFrameDuration(int frameBytes)
Parameters
Type Name Description
int frameBytes

The number of bytes in the audio frame.

Returns
Type Description
int

The duration of the frame in samples.

View Source

SetExtraData(ReadOnlySpan<byte>)

Sets the codec-specific extra data from the provided byte span.

Declaration
void SetExtraData(ReadOnlySpan<byte> data)
Parameters
Type Name Description
ReadOnlySpan<byte> data

A read-only span containing the extra data to set.

  • View Source
In this article
Back to top Generated by DocFX