Table of Contents

Class VideoSource

Namespace
VisioForge.Core.Types.VideoEdit
Assembly
VisioForge.Core.dll

Represents a video source used in video editing operations.

public class VideoSource

Inheritance

Inherited Members

Remarks

The VisioForge.Core.Types.VideoEdit.VideoSource class defines a video file or stream that can be included in a video editing project. It supports various configurations including multi-segment playback, stream selection, variable playback rate, and aspect ratio handling.

Key features:

  • Support for multiple file segments with custom start/stop times
  • Video stream selection from multi-stream files
  • Variable playback rate (slow motion or fast forward)
  • Configurable stretch modes (Letterbox, Stretch, Crop)

Constructors

VideoSource(string, TimeSpan?, TimeSpan?, VideoEditStretchMode, int, double)

Initializes a new instance of the VisioForge.Core.Types.VideoEdit.VideoSource class.

public VideoSource(string filename, TimeSpan? startTime = null, TimeSpan? stopTime = null, VideoEditStretchMode stretchMode = VideoEditStretchMode.Letterbox, int streamNumber = 0, double rate = 1)

Parameters

filename string

File name.

startTime TimeSpan?

Start time (in milliseconds). Set to -1 start and stop time to add full file.

stopTime TimeSpan?

Stop time (in milliseconds). Set to -1 start and stop time to add full file.

stretchMode VideoEditStretchMode

Stretch mode.

streamNumber int

Stream number.

rate double

Playback rate. 1.0 - 100%, 2.0 - 200%, 0.5 = 50%. .

VideoSource(string, FileSegment[], VideoEditStretchMode, int, double)

Initializes a new instance of the VisioForge.Core.Types.VideoEdit.VideoSource class.

public VideoSource(string filename, FileSegment[] segments, VideoEditStretchMode stretchMode = VideoEditStretchMode.Letterbox, int streamNumber = 0, double rate = 1)

Parameters

filename string

File name.

segments FileSegment[]

Segments list.

stretchMode VideoEditStretchMode

Stretch mode.

streamNumber int

Stream number.

rate double

Playback rate. 1.0 - 100%, 2.0 - 200%, 0.5 = 50%. .

Properties

Filename

Gets or sets the path to the video file.

public string Filename { get; set; }

Property Value

string

Remarks

The file path can be absolute or relative. Ensure the file exists and is accessible.

IgnorePlaybackCheck

Gets or sets a value indicating whether to bypass file validation and playback compatibility checks.

public bool IgnorePlaybackCheck { get; set; }

Property Value

bool

Remarks

Use this cautiously. Skipping checks might allow opening partially corrupted files or unsupported formats, but could lead to instability during processing.

Rate

Gets or sets the playback rate (speed) of the video.

public double Rate { get; set; }

Property Value

double

Remarks

Changing the rate allows for slow-motion or fast-forward effects. Audio pitch may also change unless handled separately.

ResizeFileToAspectRatio

Gets or sets a value indicating whether the file references should be resized to match a specific aspect ratio.

public bool ResizeFileToAspectRatio { get; set; }

Property Value

bool

Remarks

When enabled, the engine attempts to adjust the video dimensions to respect the pixel aspect ratio embedded in the file metadata, which is important for anamorphic content.

Segments

Gets or sets the list of segments to be played from the video file.

public FileSegment[] Segments { get; set; }

Property Value

FileSegment[]

Remarks

Segments allow you to use specific portions of a video file without cutting the original file. If multiple segments are defined, they will be played sequentially.

StreamNumber

Gets or sets the video stream number to use from multi-stream files.

public int StreamNumber { get; set; }

Property Value

int

Remarks

Useful for files that contain multiple video angles or streams. Use 0 for the first video stream, 1 for the second, etc.

StretchMode

Gets or sets the stretch mode used to fit the video into the output frame.

public VideoEditStretchMode StretchMode { get; set; }

Property Value

VideoEditStretchMode

Remarks

This property determines how the video is resized if its aspect ratio differs from the output aspect ratio.

  • Letterbox: Adds black bars to maintain aspect ratio.
  • Stretch: Stretches the image to fill the screen, potentially causing distortion.
  • Crop: Zooms in to fill the screen, cropping edges.