Class FFMPEGStream
- Namespace
- VisioForge.Core.Types.VideoEdit
- Assembly
- VisioForge.Core.dll
Represents a stream specification for FFMPEG operations in video editing.
public class FFMPEGStreamInheritance
Inherited Members
Examples
// Example 1: Select the first video stream
var videoStream = new FFMPEGStream
{
Filename = "movie.mkv",
ID = "v" // or "v:0" for explicit first video stream
};
// Example 2: Select the second audio stream
var audioStream = new FFMPEGStream
{
Filename = "movie.mkv",
ID = "a:1" // Second audio stream (0-indexed)
};
// Example 3: Select a specific stream by absolute index
var specificStream = new FFMPEGStream
{
Filename = "media.mp4",
ID = "2" // Third stream in the file, regardless of type
};
// Example 4: Select subtitle stream
var subtitleStream = new FFMPEGStream
{
Filename = "movie.mkv",
ID = "s:0" // First subtitle stream
};
Remarks
The VisioForge.Core.Types.VideoEdit.FFMPEGStream class provides a way to identify and select specific streams from multimedia files when using FFMPEG-based operations. It supports various stream types including video, audio, and subtitle streams.
Stream identification can be done using:
- Stream type identifiers: "v" for video, "a" for audio, "s" for subtitles
- Numeric indices: "0", "1", "2", etc. for specific stream positions
- Combined selectors: "v:0" for first video stream, "a:1" for second audio stream
This class is typically used when:
- Extracting specific streams from multi-stream files
- Mapping streams during transcoding operations
- Selecting streams for processing or muxing
- Working with files containing multiple audio tracks or subtitle streams
Properties
Filename
Gets or sets the path to the media file containing the stream.
public string Filename { get; set; }Property Value
Examples
// Absolute path
stream.Filename = @"C:\Videos\movie.mkv";
// Relative path
stream.Filename = "../media/audio.mp3";
// Network path
stream.Filename = @"\\server\share\video.mp4";
Remarks
The file should be accessible and readable by the FFMPEG process. Both absolute and relative paths are supported, though absolute paths are recommended for reliability.
FFMPEG supports a vast array of multimedia formats and containers. The specific streams available will depend on the file's content and encoding.
ID
Gets or sets the stream identifier used to select a specific stream from the file.
public string ID { get; set; }Property Value
Examples
// Common usage patterns
// Select default streams
stream.ID = "v"; // First video stream
stream.ID = "a"; // First audio stream
// Select specific typed streams
stream.ID = "v:0"; // First video stream (explicit)
stream.ID = "a:1"; // Second audio stream
stream.ID = "s:0"; // First subtitle stream
// Select by absolute position
stream.ID = "0"; // First stream in file
stream.ID = "3"; // Fourth stream in file
// Multi-language selection example
var englishAudio = new FFMPEGStream { ID = "a:0" }; // Usually primary language
var spanishAudio = new FFMPEGStream { ID = "a:1" }; // Secondary language
var frenchAudio = new FFMPEGStream { ID = "a:2" }; // Third language
Remarks
Stream indices are zero-based. The first stream of each type has index 0. When using type-specific selectors (v:, a:, s:), the index refers only to streams of that type, not the absolute stream position in the file.
Examples of stream selection:
- "v" selects the first video stream found
- "a:2" selects the third audio stream (if it exists)
- "3" selects the fourth stream in the file, regardless of type
To determine available streams in a file, use FFMPEG's stream analysis capabilities or media information tools before specifying the stream ID.