Class DemuxerContext
Represents an FFmpeg input format context used for reading and demultiplexing media containers.
Inherited Members
Namespace: FFmpeg.Formats
Assembly: FFmpeg.dll
Syntax
public class DemuxerContext : FormatContext, IOptionQueryable, ILoggingContext, IDisposable, IAVPointer<_AVFormatContext>
Remarks
DemuxerContext provides access to media streams, metadata, chapters, and container information from an input source. It also exposes methods for reading packets, seeking within the media, retrieving stream information, and estimating stream properties.
Constructors
View SourceDemuxerContext(_AVFormatContext*)
Initializes a new DemuxerContext from an existing native FFmpeg.AutoGen._AVFormatContext.
Declaration
protected DemuxerContext(_AVFormatContext* context)
Parameters
| Type | Name | Description |
|---|---|---|
| _AVFormatContext* | context | The native input format context to wrap. |
Properties
View SourceBitRate
Gets the overall bit rate of the input, in bits per second.
Declaration
public long BitRate { get; }
Property Value
| Type | Description |
|---|---|
| long |
Chapters
Gets the chapters contained in the media.
Declaration
public override ChapterList Chapters { get; }
Property Value
| Type | Description |
|---|---|
| ChapterList |
Overrides
Remarks
The returned collection provides access to the chapter entries stored in the underlying format context.
Duration
Duration of the stream, in AV_TIME_BASE fractional seconds. Only set this value if you know none of the individual stream durations and also do not set any of them. This is deduced from the AVStream values if not set.
Declaration
public long Duration { get; }
Property Value
| Type | Description |
|---|---|
| long |
InputFormat
Gets the input format associated with this demuxer.
Declaration
public InputFormat? InputFormat { get; }
Property Value
| Type | Description |
|---|---|
| InputFormat? |
Remarks
Returns null if the input format has not yet been determined.
StartTime
Gets the start timestamp of the input.
Declaration
public long StartTime { get; }
Property Value
| Type | Description |
|---|---|
| long |
Remarks
The value is expressed in AV_TIME_BASE units.
Methods
View SourceDispose(bool)
Releases the resources used by the current format context.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing | Indicates whether the method is being called from the Dispose() method or a finalizer. |
Overrides
View SourceFindStreamInfo()
Reads packets from the input to gather stream information.
Declaration
public AVResult32 FindStreamInfo()
Returns
| Type | Description |
|---|---|
| AVResult32 | The result returned by |
Remarks
This method analyzes the input streams and populates codec parameters, durations, frame rates, and other stream metadata. It should typically be called immediately after opening an input.
FindStreamInfo(AVDictionary[]?)
Reads packets from the input to gather stream information using per-stream option dictionaries.
Declaration
public AVResult32 FindStreamInfo(AVDictionary[]? options)
Parameters
| Type | Name | Description |
|---|---|---|
| AVDictionary[] | options | An array containing one option dictionary for each stream, or null. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The result returned by |
FindStreamInfo(AVMultiDictionary[]?)
Reads packets from the input to gather stream information using per-stream option dictionaries.
Declaration
public AVResult32 FindStreamInfo(AVMultiDictionary[]? options)
Parameters
| Type | Name | Description |
|---|---|---|
| AVMultiDictionary[] | options | An array containing one option dictionary for each stream, or null. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The result returned by |
FindStreamInfo(IDictionary<string, string>[]?)
Reads packets from the input to gather stream information using managed dictionaries.
Declaration
public AVResult32 FindStreamInfo(IDictionary<string, string>[]? options)
Parameters
| Type | Name | Description |
|---|---|---|
| IDictionary<string, string>[] | options | A span containing one dictionary for each stream. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The result returned by |
Remarks
FFmpeg may consume or modify option entries. The supplied dictionaries are updated to reflect any changes made during the call.
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown when the number of supplied dictionaries does not equal StreamCount. |
FindStreamInfo(Span<AVDictionary>)
Reads packets from the input to gather stream information using per-stream option dictionaries.
Declaration
public AVResult32 FindStreamInfo(Span<AVDictionary> options)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<AVDictionary> | options | A span containing one option dictionary for each stream. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The result returned by |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown when the number of supplied option dictionaries does not equal StreamCount. |
FindStreamInfo(Span<AVMultiDictionary>)
Reads packets from the input to gather stream information using per-stream option dictionaries.
Declaration
public AVResult32 FindStreamInfo(Span<AVMultiDictionary> options)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<AVMultiDictionary> | options | A span containing one option dictionary for each stream. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The result returned by |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown when the number of supplied option dictionaries does not equal StreamCount. |
FindStreamInfo(Span<IDictionary<string, string>>)
Reads packets from the input to gather stream information using managed dictionaries.
Declaration
public AVResult32 FindStreamInfo(Span<IDictionary<string, string>> options)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<IDictionary<string, string>> | options | A span containing one dictionary for each stream. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The result returned by |
Remarks
FFmpeg may consume or modify option entries. The supplied dictionaries are updated to reflect any changes made during the call.
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown when the number of supplied dictionaries does not equal StreamCount. |
GuessFrameRate(AVStream)
Guesses the frame rate of the given stream.
Declaration
public Rational GuessFrameRate(AVStream avStream)
Parameters
| Type | Name | Description |
|---|---|---|
| AVStream | avStream | The stream to analyze. |
Returns
| Type | Description |
|---|---|
| Rational | A Rational representing the guessed frame rate. |
GuessFrameRate(AVStream, AVFrame?)
Estimates the frame rate of the specified stream.
Declaration
public Rational GuessFrameRate(AVStream avStream, AVFrame? frame)
Parameters
| Type | Name | Description |
|---|---|---|
| AVStream | avStream | The stream whose frame rate should be estimated. |
| AVFrame | frame | An optional decoded frame used to improve the estimation. |
Returns
| Type | Description |
|---|---|
| Rational | The estimated frame rate. |
GuessFrameRate(int)
Estimates the frame rate of the specified stream.
Declaration
public Rational GuessFrameRate(int streamIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | streamIndex |
Returns
| Type | Description |
|---|---|
| Rational | The estimated frame rate. |
GuessFrameRate(int, AVFrame?)
Estimates the frame rate of the specified stream.
Declaration
public Rational GuessFrameRate(int streamIndex, AVFrame? frame)
Parameters
| Type | Name | Description |
|---|---|---|
| int | streamIndex | |
| AVFrame | frame | An optional decoded frame used to improve the estimation. |
Returns
| Type | Description |
|---|---|
| Rational | The estimated frame rate. |
Open(InputFormat, AVDictionary?, bool)
Opens an input media file or device and initializes the DemuxerContext using only the input format.
Declaration
public static DemuxerContext Open(InputFormat input, AVDictionary? dictionary, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| InputFormat | input | The InputFormat to use for parsing the input. This format must have the NoFile flag set, indicating it does not require a file path. |
| AVDictionary | dictionary | Optional. A AVDictionary containing additional options for the input. May be null. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media or device, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This method opens the input using the specified input format with url set to null. The input format must have the NoFile flag set, indicating it does not require a file path.
Open(InputFormat, AVMultiDictionary?, bool)
Opens an input media file or device and initializes the DemuxerContext using only the input format and a multi-dictionary.
Declaration
public static DemuxerContext Open(InputFormat input, AVMultiDictionary? dictionary, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| InputFormat | input | The InputFormat to use for parsing the input. This format must have the NoFile flag set, indicating it does not require a file path. |
| AVMultiDictionary | dictionary | Optional. A AVMultiDictionary containing additional options for the input. May be null. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media or device, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This method opens the input using the specified input format with url set to null. The input format must have the NoFile flag set, indicating it does not require a file path.
Open(InputFormat, bool)
Opens an input media file or device and initializes the DemuxerContext using only the input format.
Declaration
public static DemuxerContext Open(InputFormat input, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| InputFormat | input | The InputFormat to use for parsing the input. This format must have the NoFile flag set, indicating it does not require a file path. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media or device, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This method opens the input using the specified input format with url set to null. The input format must have the NoFile flag set, indicating it does not require a file path.
Open(InputFormat, IDictionary<string, string>?, bool)
Opens an input media file or device and initializes the DemuxerContext using only the input format and a dictionary of options.
Declaration
public static DemuxerContext Open(InputFormat input, IDictionary<string, string>? dic, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| InputFormat | input | The InputFormat to use for parsing the input. This format must have the NoFile flag set, indicating it does not require a file path. |
| IDictionary<string, string> | dic | Optional. A dictionary of additional options for the input. This can be a AVDictionary, AVMultiDictionary, or a simple IDictionary<TKey, TValue>. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media or device, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This method opens the input using the specified input format with url set to null. The input format must have the NoFile flag set, indicating it does not require a file path. If a dictionary is provided as an IDictionary<TKey, TValue>, it will be converted to a AVDictionary internally.
Open(IOContext, AVDictionary?, bool)
Opens an input media stream and initializes the DemuxerContext using the specified dictionary of options and IOContext.
Declaration
public static DemuxerContext Open(IOContext ioContext, AVDictionary? dictionary, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| IOContext | ioContext | The IOContext to handle I/O operations for the media stream. It is responsible for setting up reading and writing capabilities. |
| AVDictionary | dictionary | Optional. A AVDictionary containing additional options for the input. May be null. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media stream, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This method opens the input using the specified ioContext and dictionary with url and input set to null.
The ioContext is used to initialize the DemuxerContext with read and write capabilities.
After opening the input, the findStreamInfo flag determines if FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) will be called to find stream information.
Open(IOContext, AVMultiDictionary?, bool)
Opens an input media stream and initializes the DemuxerContext using the specified multi-dictionary of options and IOContext.
Declaration
public static DemuxerContext Open(IOContext ioContext, AVMultiDictionary? dictionary, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| IOContext | ioContext | The IOContext to handle I/O operations for the media stream. It is responsible for setting up reading and writing capabilities. |
| AVMultiDictionary | dictionary | Optional. A AVMultiDictionary containing additional options for the input. May be null. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media stream, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This method opens the input using the specified ioContext and dictionary with url and input set to null.
The ioContext is used to initialize the DemuxerContext with read and write capabilities.
After opening the input, the findStreamInfo flag determines if FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) will be called to find stream information.
Open(IOContext, IDictionary<string, string>?, bool)
Opens an input media stream and initializes the DemuxerContext using the specified dictionary of options and IOContext.
Declaration
public static DemuxerContext Open(IOContext ioContext, IDictionary<string, string>? dic, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| IOContext | ioContext | The IOContext to handle I/O operations for the media stream. It is responsible for setting up reading and writing capabilities. |
| IDictionary<string, string> | dic | Optional. A dictionary of additional options for the input. This can be a AVDictionary, AVMultiDictionary, or a simple IDictionary<TKey, TValue>. May be null. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media stream, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This method opens the input using the specified ioContext and dic.
If dic is an IDictionary<TKey, TValue> other than AVDictionary or AVMultiDictionary, it will be converted to a AVDictionary internally.
The ioContext is used to initialize the DemuxerContext with read and write capabilities.
After opening the input, the findStreamInfo flag determines if FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) will be called to find stream information.
Open(IOContext, InputFormat?, AVDictionary?, bool)
Opens an input media stream and initializes the DemuxerContext using the specified input format and IOContext.
Declaration
public static DemuxerContext Open(IOContext ioContext, InputFormat? input, AVDictionary? dictionary, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| IOContext | ioContext | The IOContext to handle I/O operations for the media stream. It is responsible for setting up reading and writing capabilities. |
| InputFormat? | input | Optional. The InputFormat to use for parsing the input. This format must have the NoFile flag set, indicating it does not require a file path. |
| AVDictionary | dictionary | Optional. A AVDictionary containing additional options for the input. May be null. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media stream, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Open(IOContext, InputFormat?, AVMultiDictionary?, bool)
Opens an input media stream and initializes the DemuxerContext using the specified multi-dictionary of options and IOContext.
Declaration
public static DemuxerContext Open(IOContext ioContext, InputFormat? input, AVMultiDictionary? dictionary, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| IOContext | ioContext | The IOContext to handle I/O operations for the media stream. It is responsible for setting up reading and writing capabilities. |
| InputFormat? | input | Optional. The InputFormat to use for parsing the input. This format must have the NoFile flag set, indicating it does not require a file path. |
| AVMultiDictionary | dictionary | Optional. A AVMultiDictionary containing additional options for the input. May be null. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media stream, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Open(IOContext, InputFormat?, bool)
Opens an input media stream and initializes the DemuxerContext using the specified input format and IOContext.
Declaration
public static DemuxerContext Open(IOContext ioContext, InputFormat? input, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| IOContext | ioContext | The IOContext to handle I/O operations for the media stream. It is responsible for setting up reading and writing capabilities. |
| InputFormat? | input | Optional. The InputFormat to use for parsing the input. This format must have the NoFile flag set, indicating it does not require a file path. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media stream, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This method opens the input using the specified ioContext and input format.
The ioContext is used to initialize the DemuxerContext with read and write capabilities.
After opening the input, the findStreamInfo flag determines if FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) will be called to find stream information.
Open(IOContext, InputFormat?, IDictionary<string, string>?, bool)
Opens an input media stream and initializes the DemuxerContext using the specified dictionary of options and IOContext.
Declaration
public static DemuxerContext Open(IOContext ioContext, InputFormat? input, IDictionary<string, string>? dic, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| IOContext | ioContext | The IOContext to handle I/O operations for the media stream. It is responsible for setting up reading and writing capabilities. |
| InputFormat? | input | Optional. The InputFormat to use for parsing the input. This format must have the NoFile flag set, indicating it does not require a file path. |
| IDictionary<string, string> | dic | Optional. A dictionary of additional options for the input. This can be a AVDictionary, AVMultiDictionary, or a simple IDictionary<TKey, TValue>. May be null. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media stream, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This method opens the input using the specified ioContext and dic.
If dic is an IDictionary<TKey, TValue> other than AVDictionary or AVMultiDictionary, it will be converted to a AVDictionary internally.
The ioContext is used to initialize the DemuxerContext with read and write capabilities.
After opening the input, the findStreamInfo flag determines if FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) will be called to find stream information.
Open(Stream, AVDictionary?, bool)
Opens an input media stream and initializes the DemuxerContext using the specified dictionary of options.
Declaration
public static DemuxerContext Open(Stream stream, AVDictionary? dictionary, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The Stream to read the input media data from. It must support reading and seeking. |
| AVDictionary | dictionary | Optional. A AVDictionary containing additional options for the input. May be null. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media stream, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This method opens the input using the specified stream and dictionary.
The dictionary is used to pass additional options to the input.
After opening the input, the findStreamInfo flag determines if FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) will be called to find stream information.
Open(Stream, AVMultiDictionary?, bool)
Opens an input media stream and initializes the DemuxerContext using the specified multi-dictionary of options.
Declaration
public static DemuxerContext Open(Stream stream, AVMultiDictionary? dictionary, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The Stream to read the input media data from. It must support reading and seeking. |
| AVMultiDictionary | dictionary | Optional. A AVMultiDictionary containing additional options for the input. May be null. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media stream, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This method opens the input using the specified stream and dictionary.
The dictionary is used to pass additional options to the input.
After opening the input, the findStreamInfo flag determines if FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) will be called to find stream information.
Open(Stream, bool)
Opens an input media stream and initializes the DemuxerContext with default settings (no input format, no dictionary of options).
Declaration
public static DemuxerContext Open(Stream stream, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The Stream to read the input media data from. It must support reading and seeking. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media stream, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This method opens the input using the specified stream.
After opening the input, the findStreamInfo flag determines if FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) will be called to find stream information.
Open(Stream, IDictionary<string, string>?, bool)
Opens an input media stream and initializes the DemuxerContext using the specified dictionary of options, which can be any IDictionary<TKey, TValue>.
Declaration
public static DemuxerContext Open(Stream stream, IDictionary<string, string>? dic, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The Stream to read the input media data from. It must support reading and seeking. |
| IDictionary<string, string> | dic | Optional. A dictionary of additional options for the input. This can be a AVDictionary, AVMultiDictionary, or a simple IDictionary<TKey, TValue>. May be null. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media stream, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This method opens the input using the specified stream and dic.
If dic is an IDictionary<TKey, TValue> other than AVDictionary or AVMultiDictionary, it will be converted to a AVDictionary internally.
After opening the input, the findStreamInfo flag determines if FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) will be called to find stream information.
Open(Stream, InputFormat?, AVDictionary?, bool)
Opens an input media stream and initializes the DemuxerContext using the specified input format and a dictionary of options.
Declaration
public static DemuxerContext Open(Stream stream, InputFormat? input, AVDictionary? dictionary, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The Stream to read the input media data from. It must support reading and seeking. |
| InputFormat? | input | Optional. The InputFormat to use for parsing the input. This format must have the NoFile flag set, indicating it does not require a file path. |
| AVDictionary | dictionary | Optional. A AVDictionary containing additional options for the input. May be null. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media stream, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This method opens the input using the specified stream and input format.
The input format must have the NoFile flag set, indicating that no file path is required.
The dictionary is used to pass additional options to the input.
After opening the input, the findStreamInfo flag determines if FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) will be called to find stream information.
Open(Stream, InputFormat?, AVMultiDictionary?, bool)
Opens an input media stream and initializes the DemuxerContext using the specified input format and a multi-dictionary of options.
Declaration
public static DemuxerContext Open(Stream stream, InputFormat? input, AVMultiDictionary? dictionary, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The Stream to read the input media data from. It must support reading and seeking. |
| InputFormat? | input | Optional. The InputFormat to use for parsing the input. This format must have the NoFile flag set, indicating it does not require a file path. |
| AVMultiDictionary | dictionary | Optional. A AVMultiDictionary containing additional options for the input. May be null. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media stream, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This method opens the input using the specified stream and input format.
The input format must have the NoFile flag set, indicating that no file path is required.
The dictionary is used to pass additional options to the input.
After opening the input, the findStreamInfo flag determines if FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) will be called to find stream information.
Open(Stream, InputFormat?, bool)
Opens an input media stream and initializes the DemuxerContext using the specified input format.
Declaration
public static DemuxerContext Open(Stream stream, InputFormat? input, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The Stream to read the input media data from. It must support reading and seeking. |
| InputFormat? | input | Optional. The InputFormat to use for parsing the input. This format must have the NoFile flag set, indicating it does not require a file path. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media stream, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This method opens the input using the specified stream and input format.
The input format must have the NoFile flag set, indicating that no file path is required.
After opening the input, the findStreamInfo flag determines if FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) will be called to find stream information.
Open(Stream, InputFormat?, IDictionary<string, string>?, bool)
Opens an input media stream and initializes the DemuxerContext using the specified input format and a dictionary of options.
Declaration
public static DemuxerContext Open(Stream stream, InputFormat? input, IDictionary<string, string>? dic, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The Stream to read the input media data from. It must support reading and seeking. |
| InputFormat? | input | Optional. The InputFormat to use for parsing the input. This format must have the NoFile flag set, indicating it does not require a file path. |
| IDictionary<string, string> | dic | Optional. A dictionary of additional options for the input. This can be a AVDictionary, AVMultiDictionary, or a simple IDictionary<TKey, TValue>. May be null. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media stream, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This method opens the input using the specified stream and input format.
The input format must have the NoFile flag set, indicating that no file path is required.
If a dictionary is provided as an IDictionary<TKey, TValue>, it will be converted to a AVDictionary internally.
After opening the input, the findStreamInfo flag determines if FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) will be called to find stream information.
Open(string?, AVDictionary?, bool)
Opens an input media file or device and initializes the DemuxerContext using the URL and a dictionary.
Declaration
public static DemuxerContext Open(string? url, AVDictionary? dictionary, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | url | The URL or path to the input media file or device. This can be null if the input format has the NoFile flag set. |
| AVDictionary | dictionary | Optional. A AVDictionary containing additional options for the input. May be null. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media or device, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This overload calls the main Open(string?, InputFormat?, AVDictionary?, bool) method with null for the input format.
Open(string?, AVMultiDictionary?, bool)
Opens an input media file or device and initializes the DemuxerContext using the URL and a multi-dictionary.
Declaration
public static DemuxerContext Open(string? url, AVMultiDictionary? dictionary, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | url | The URL or path to the input media file or device. This can be null if the input format has the NoFile flag set. |
| AVMultiDictionary | dictionary | Optional. A AVMultiDictionary containing additional options for the input. May be null. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media or device, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This overload calls the main Open(string?, InputFormat?, AVDictionary?, bool) method with null for the input format.
Open(string?, bool)
Opens an input media file or device and initializes the DemuxerContext using only the URL.
Declaration
public static DemuxerContext Open(string? url, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | url | The URL or path to the input media file or device. This can be null if the input format has the NoFile flag set. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media or device, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This overload calls the main Open(string?, InputFormat?, AVDictionary?, bool) method with null for both the input format and the dictionary.
Open(string?, IDictionary<string, string>?, bool)
Opens an input media file or device and initializes the DemuxerContext using the URL and a dictionary of options.
Declaration
public static DemuxerContext Open(string? url, IDictionary<string, string>? dic, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | url | The URL or path to the input media file or device. This can be null if the input format has the NoFile flag set. |
| IDictionary<string, string> | dic | Optional. A dictionary of additional options for the input. This can be a AVDictionary, AVMultiDictionary, or a simple IDictionary<TKey, TValue>. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media or device, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This overload calls the main Open(string?, InputFormat?, IDictionary<string, string>?, bool) method. If a dictionary is provided as an IDictionary<TKey, TValue>, it will be converted to a AVDictionary internally.
Open(string?, InputFormat?, AVDictionary?, bool)
Opens an input media file or device and initializes the DemuxerContext.
Declaration
public static DemuxerContext Open(string? url, InputFormat? input, AVDictionary? dictionary, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | url | The URL or path to the input media file or device. This can be null if the |
| InputFormat? | input | Optional. The InputFormat to use for parsing the input. If null, the format will be detected automatically. |
| AVDictionary | dictionary | Optional. A AVDictionary containing additional options for the input. May be null. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media or device, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This method opens the input specified by the url or device, using the provided input format if specified. If url is null and the input has the NoFile flag, it is treated as a special device or input format that does not require a file path.
Open(string?, InputFormat?, AVMultiDictionary?, bool)
Opens an input media file or device and initializes the DemuxerContext.
Declaration
public static DemuxerContext Open(string? url, InputFormat? input, AVMultiDictionary? dictionary, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | url | The URL or path to the input media file or device. This can be null if the |
| InputFormat? | input | Optional. The InputFormat to use for parsing the input. If null, the format will be detected automatically. |
| AVMultiDictionary | dictionary | Optional. A AVMultiDictionary containing additional options for the input. May be null. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media or device, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This method opens the input specified by the url or device, using the provided input format if specified. If url is null and the input has the NoFile flag, it is treated as a special device or input format that does not require a file path.
Open(string?, InputFormat?, bool)
Opens an input media file or device and initializes the DemuxerContext using the URL and input format.
Declaration
public static DemuxerContext Open(string? url, InputFormat? input, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | url | The URL or path to the input media file or device. This can be null if the input format has the NoFile flag set. |
| InputFormat? | input | Optional. The InputFormat to use for parsing the input. If null, the format will be detected automatically. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media or device, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This overload calls the main Open(string?, InputFormat?, AVDictionary?, bool) method with null for the dictionary.
Open(string?, InputFormat?, IDictionary<string, string>?, bool)
Opens an input media file or device and initializes the DemuxerContext.
Declaration
public static DemuxerContext Open(string? url, InputFormat? input, IDictionary<string, string>? dic, bool findStreamInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | url | The URL or path to the input media file or device. This can be null if the |
| InputFormat? | input | Optional. The InputFormat to use for parsing the input. If null, the format will be detected automatically. |
| IDictionary<string, string> | dic | Optional. A dictionary of additional options for the input. This can be a AVDictionary, AVMultiDictionary, or a simple IDictionary<TKey, TValue>. |
| bool | findStreamInfo | Optional. If true, will call FFmpeg.AutoGen.ffmpeg.avformat_find_stream_info(FFmpeg.AutoGen._AVFormatContext*, FFmpeg.AutoGen._AVDictionary**) after opening the input to find stream information. |
Returns
| Type | Description |
|---|---|
| DemuxerContext | An DemuxerContext initialized with the input media or device, or null if the operation fails. Throws an OutOfMemoryException if memory allocation fails. |
Remarks
This method opens the input specified by the url or device, using the provided input format if specified. If url is null and the input has the NoFile flag, it is treated as a special device or input format that does not require a file path. If a dictionary is provided as an IDictionary<TKey, TValue>, it will be converted to a AVDictionary internally.
ReadFrame(AVPacket)
Reads the next packet from the input.
Declaration
[Obsolete("Renamed to ReadPacket")]
public AVResult32 ReadFrame(AVPacket packet)
Parameters
| Type | Name | Description |
|---|---|---|
| AVPacket | packet | The packet that receives the demultiplexed data. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The result returned by |
Remarks
The packet is automatically unreferenced before reading. If the packet does not already have a time base assigned, it is initialized from the corresponding stream.
ReadPacket(AVPacket)
Reads the next packet from the input.
Declaration
public AVResult32 ReadPacket(AVPacket packet)
Parameters
| Type | Name | Description |
|---|---|---|
| AVPacket | packet | The packet that receives the demultiplexed data. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The result returned by |
Remarks
The packet is automatically unreferenced before reading. If the packet does not already have a time base assigned, it is initialized from the corresponding stream.
Seek(Rational)
Seeks to the specified presentation time.
Declaration
public AVResult32 Seek(Rational time)
Parameters
| Type | Name | Description |
|---|---|---|
| Rational | time | The target presentation time. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The result returned by |
Remarks
The seek is performed using FFmpeg's default stream selection and the
AVSEEK_FLAG_BACKWARD flag.
Seek(Rational, int)
Seeks to the specified presentation time within a stream.
Declaration
public AVResult32 Seek(Rational time, int streamIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| Rational | time | The target presentation time. |
| int | streamIndex | The zero-based stream index. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The result returned by |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown when |
Seek(long)
Seeks to the specified timestamp.
Declaration
public AVResult32 Seek(long timestamp)
Parameters
| Type | Name | Description |
|---|---|---|
| long | timestamp | The target timestamp. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The result returned by |
Seek(long, int)
Seeks to the specified timestamp within a stream.
Declaration
public AVResult32 Seek(long timestamp, int streamIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| long | timestamp | The target timestamp. |
| int | streamIndex | The zero-based stream index. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The result returned by |
SeekBytes(long, int)
Seeks to the specified byte position within a stream. This method uses the flag any, since the position might not be a key frame.
Declaration
public AVResult32 SeekBytes(long position, int streamIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| long | position | The target byte position in that stream. |
| int | streamIndex | The zero-based stream index. |
Returns
| Type | Description |
|---|---|
| AVResult32 | The result returned by |
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |