Table of Contents

Class VideoStreamInfo

Namespace
VisioForge.Core.Types.MediaInfo
Assembly
VisioForge.Core.dll

Represents detailed information about a video stream within a media file. This class provides properties such as bitrate, frame rate, codec, dimensions, and duration.

public class VideoStreamInfo

Inheritance

Inherited Members

Examples

// Assume mediaInfo is an instance of MediaFileInfo containing stream information.
foreach (var videoStream in mediaInfo.VideoStreams)
{
    Console.WriteLine($"Video Stream Found:");
    Console.WriteLine($"  Codec: {videoStream.Codec}");
    Console.WriteLine($"  Resolution: {videoStream.Width}x{videoStream.Height}");
    Console.WriteLine($"  Frame Rate: {videoStream.FrameRate.Value:F2} FPS");
    Console.WriteLine($"  Bitrate: {videoStream.Bitrate} bps");
    Console.WriteLine($"  Duration: {videoStream.Duration}");
    Console.WriteLine($"  Rotation: {videoStream.Rotation} degrees");

    if (videoStream.IsInterlaced.HasValue)
    {
        Console.WriteLine($"  Interlaced: {videoStream.IsInterlaced.Value}");
    }

    if (videoStream.Tags != null && videoStream.Tags.Any())
    {
        Console.WriteLine("  Tags:");
        foreach (var tag in videoStream.Tags)
        {
            Console.WriteLine($"    {tag.Name}: {tag.Value}");
        }
    }
}

Remarks

This information is typically retrieved by a media information parser and is useful for displaying stream properties to the user, or for making decisions about video processing, playback, and transcoding. The class provides comprehensive video characteristics including resolution (Width/Height), codec information, frame rate, and interlacing status. Bitrate is provided in bits per second and helps estimate quality and bandwidth requirements. FrameRate is expressed using the VideoFrameRate type and may include fractional values for NTSC formats (e.g., 29.97, 23.976). The IsInterlaced property indicates whether the video uses interlaced scanning (common in broadcast formats) versus progressive scanning. Rotation property indicates if the video requires display rotation (common in mobile recordings): 0, 90, 180, or 270 degrees. AspectRatio provides the display aspect ratio which may differ from the pixel aspect ratio (Width/Height). BitsPerPixel indicates color depth and can affect quality and file size. The Tags collection contains stream-specific metadata useful for stream identification in multi-track files. This information is essential for compatibility checks, playback optimization, and determining appropriate transcoding parameters.

Constructors

VideoStreamInfo()

Initializes a new instance of the VisioForge.Core.Types.MediaInfo.VideoStreamInfo class. All string properties are initialized to Empty, VisioForge.Core.Types.MediaInfo.VideoStreamInfo.Duration to Zero, VisioForge.Core.Types.MediaInfo.VideoStreamInfo.Tags as an empty list, and VisioForge.Core.Types.MediaInfo.VideoStreamInfo.FrameRate to an empty VisioForge.Core.Types.VideoFrameRate.

public VideoStreamInfo()

Properties

AspectRatio

Gets or sets the aspect ratio of the video, represented as a tuple of width-to-height ratio. For example, (16, 9) for widescreen video.

public Tuple<float, float> AspectRatio { get; set; }

Property Value

Tuple<float, float>

Bitrate

Gets or sets the average bitrate of the video stream in bits per second (bps).

public double Bitrate { get; set; }

Property Value

double

Codec

Gets or sets the name of the video codec (e.g., "H.264", "MPEG-4", "VP9").

public string Codec { get; set; }

Property Value

string

Duration

Gets or sets the duration of the video stream.

public TimeSpan Duration { get; set; }

Property Value

TimeSpan

FourCC

Gets or sets the FourCC code of the video format (e.g., "H264", "XVID").

public string FourCC { get; set; }

Property Value

string

FrameRate

Gets or sets the frame rate of the video stream.

public VideoFrameRate FrameRate { get; set; }

Property Value

VideoFrameRate

FramesCount

Gets or sets the total number of frames in the video stream. This property may not always be available or accurate for all formats.

public int FramesCount { get; set; }

Property Value

int

Height

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

public int Height { get; set; }

Property Value

int

ID

Gets or sets a unique identifier for the video stream within the media file.

public string ID { get; set; }

Property Value

string

IsInterlaced

Gets or sets a value indicating whether the video stream is interlaced. true if interlaced, false if progressive, and null if the information is not available.

public bool? IsInterlaced { get; set; }

Property Value

bool?

MPEGAudioTag

Gets or sets the MPEG audio tag, if applicable (e.g., for MPEG program streams).

public string MPEGAudioTag { get; set; }

Property Value

string

Name

Gets or sets the name of the video track, if available (e.g., "Main Video", "Chapter 1").

public string Name { get; set; }

Property Value

string

Rotation

Gets or sets the rotation of the video stream in degrees (e.g., 0, 90, 180, 270).

public int Rotation { get; set; }

Property Value

int

Tags

Gets a list of VisioForge.Core.Types.MediaInfo.MediaInfoTag objects associated with this video stream. These tags can include metadata specific to the video track.

public List<MediaInfoTag> Tags { get; }

Property Value

List<MediaInfoTag>

Width

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

public int Width { get; set; }

Property Value

int

Methods

ToString()

Returns a string that represents the current VisioForge.Core.Types.MediaInfo.VideoStreamInfo instance. The string includes the codec, resolution (widthxheight), and frame rate.

public override string ToString()

Returns

string

A String that represents this instance.