Table of Contents

Class FFMPEGEXEOutput

Namespace
VisioForge.Core.Types.Output
Assembly
VisioForge.Core.dll

Comprehensive configuration class for FFMPEG executable-based output operations. This class provides detailed control over video encoding, audio encoding, and streaming parameters when using the external FFMPEG executable for media processing.

public sealed class FFMPEGEXEOutput : IVideoCaptureBaseOutput, IVideoEditBaseOutput, INetworkStreamingOutput

Inheritance

Implements

Inherited Members

Remarks

The FFMPEGEXEOutput class serves as a bridge between the VisioForge SDK and the external FFMPEG executable, providing a structured way to configure complex encoding scenarios.

Key capabilities:

  • Support for multiple output formats (MP4, WebM, FLV, Icecast)
  • Hardware acceleration integration (NVENC, QSV, AMF)
  • Flexible audio and video codec selection
  • Custom FFMPEG parameter injection
  • Network streaming optimization
  • Profile-based configuration templates

Usage patterns:

  1. Quick setup with predefined profiles using the constructor with DefaultsProfile
  2. Manual configuration by setting individual properties
  3. Advanced customization using Custom_* properties for direct FFMPEG control

Performance considerations:

  • Hardware acceleration provides significant performance improvements
  • Pipe-based data transfer (UsePipe=true) generally offers better performance
  • Buffer sizes should be adjusted based on system capabilities and content type

Thread safety: This class is not thread-safe and should be configured before use in multi-threaded scenarios.

Constructors

FFMPEGEXEOutput()

Initializes a new instance of the VisioForge.Core.Types.Output.FFMPEGEXEOutput class.

public FFMPEGEXEOutput()

FFMPEGEXEOutput(DefaultsProfile, bool)

Initializes a new instance of the VisioForge.Core.Types.Output.FFMPEGEXEOutput class.

public FFMPEGEXEOutput(DefaultsProfile profile, bool networkStreaming)

Parameters

profile DefaultsProfile

The profile.

networkStreaming bool

if set to true fill for a network streaming.

Properties

AddFakeAudioSource

Gets or sets a value indicating whether fake audio source will be added. It can be used to stream video without real audio, that can be useful for Facebook/YouTube.

public bool AddFakeAudioSource { get; set; }

Property Value

bool

Audio

Gets or sets audio settings.

public IBasicAudioSettings Audio { get; set; }

Property Value

IBasicAudioSettings

Custom_AdditionalAudioArgs

Gets or sets additional command-line arguments for the FFMPEG audio encoder. These arguments are appended to the automatically generated audio encoding parameters, allowing access to FFMPEG features not directly exposed by the SDK.

public string Custom_AdditionalAudioArgs { get; set; }

Property Value

string

Remarks

This property enables advanced audio encoding configurations by providing direct access to FFMPEG's command-line interface. The arguments are inserted into the FFMPEG command line specifically for audio encoding operations.

Usage examples:

  • "-af volume=0.5" (apply volume filter to reduce audio level)
  • "-ac 1" (force mono output)
  • "-ar 22050" (set specific sample rate)
  • "-acodec_tag 0x55" (set specific codec tag)

Important considerations:

  • Arguments must be valid FFMPEG audio parameters
  • Invalid arguments may cause encoding failures
  • Test thoroughly as these parameters bypass SDK validation
  • Some parameters may conflict with SDK-generated settings
  • Consult FFMPEG documentation for parameter syntax and compatibility

Custom_AdditionalCommonArgs

Gets or sets additional global command-line arguments for the FFMPEG executable. These arguments are added to the FFMPEG command line as general parameters, affecting the overall encoding process rather than specific audio or video streams.

public string Custom_AdditionalCommonArgs { get; set; }

Property Value

string

Remarks

This property provides access to FFMPEG's global parameters that affect the entire encoding operation, including input processing, general behavior, and output container settings.

Common use cases:

  • Input format specifications: "-f rawvideo"
  • Threading control: "-threads 4"
  • Logging control: "-loglevel error"
  • Performance tuning: "-fflags +igndts"
  • Container-specific options: "-movflags +faststart"

Global parameters that can be set:

  • Input/output format specifications
  • Threading and performance options
  • Logging and debugging parameters
  • Container and muxer options
  • General FFMPEG behavioral flags

Best practices:

  • Use specific Custom_AdditionalAudioArgs or Custom_AdditionalVideoArgs when possible
  • Avoid parameters that conflict with SDK-managed settings
  • Test extensively with representative content
  • Reference FFMPEG documentation for parameter compatibility

Custom_AdditionalVideoArgs

Gets or sets additional command-line arguments for the FFMPEG video encoder. These arguments are appended to the automatically generated video encoding parameters, providing access to advanced FFMPEG video encoding features.

public string Custom_AdditionalVideoArgs { get; set; }

Property Value

string

Remarks

This property allows fine-tuning of video encoding by directly accessing FFMPEG's extensive parameter set. The arguments are integrated into the video encoding portion of the FFMPEG command line.

Usage examples:

  • "-vf scale=1280:720" (resize video to specific dimensions)
  • "-pix_fmt yuv420p" (set specific pixel format)
  • "-g 60" (set GOP size)
  • "-bf 3" (set number of B frames)
  • "-tune zerolatency" (optimize for low-latency streaming)

Advanced configurations:

  • Hardware encoder specific parameters
  • Custom video filters and effects
  • Encoding optimization flags
  • Container-specific video settings

Caution:

  • Ensure parameters are compatible with selected video codec
  • Invalid parameters will cause encoding failures
  • Some parameters may override SDK-configured settings
  • Thoroughly test with your specific content and target devices

Custom_AllFFMPEGArgs

Gets or sets a complete custom FFMPEG command line that overrides all SDK-generated parameters. When this property is set, all other FFMPEG configuration properties are ignored, and the encoding process uses only the parameters specified in this string.

public string Custom_AllFFMPEGArgs { get; set; }

Property Value

string

Remarks

This property provides complete control over the FFMPEG command line, effectively bypassing the SDK's parameter generation. Use this when you need:

  • Complete control over the encoding process
  • Access to FFMPEG features not supported by the SDK
  • Implementation of complex encoding workflows
  • Integration with existing FFMPEG-based systems

Important considerations:

  • ALL other FFMPEG settings in this class are ignored when this property is set
  • You must manually specify all required parameters (input, output, codecs, etc.)
  • The command line must be compatible with the SDK's input/output mechanisms
  • No validation is performed on the custom arguments

Example usage: "-i input.mp4 -c:v libx264 -preset fast -crf 23 -c:a aac -b:a 128k output.mp4"

Responsibilities when using this property:

  • Ensure input sources are correctly specified
  • Verify output format compatibility
  • Handle error conditions in your application
  • Maintain compatibility with target platforms

Warning: This is an advanced feature that requires deep knowledge of FFMPEG command-line syntax and the SDK's integration points.

Custom_InputString

Gets or sets custom input string, replaces string provided to FFMPEG by SDK. Be sure that correct audio and video virtual sources specified correctly.

public string Custom_InputString { get; set; }

Property Value

string

ExecutableFilename

Gets or sets custom FFMPEG file name (including path).

public string ExecutableFilename { get; set; }

Property Value

string

KLVEnabled

Gets or sets a value indicating whether SMPTE KLV metadata stream is enabled. When enabled and the output muxer is MPEGTS, KLV data from the source will be muxed into the output stream via a third named pipe.

public bool KLVEnabled { get; set; }

Property Value

bool

OutputMuxer

Gets or sets FFMPEG EXE output format.

public OutputMuxer OutputMuxer { get; set; }

Property Value

OutputMuxer

RtBufferSize

Gets or sets rtbufsize parameter for FFMPEG source. 50M by default.

public string RtBufferSize { get; set; }

Property Value

string

ThreadsCount

Gets or sets FFMPEG EXE threads count.

public int ThreadsCount { get; set; }

Property Value

int

UsePipe

Gets or sets a value indicating whether pipe will be used instead virtual devices.

public bool UsePipe { get; set; }

Property Value

bool

Video

Gets or sets video settings.

public IBasicVideoSettings Video { get; set; }

Property Value

IBasicVideoSettings

VideoBufferSize

Gets or sets the video buffer size for FFMPEG executable operations, in milliseconds. A value of 0 indicates that the default buffer size should be used.

public int VideoBufferSize { get; set; }

Property Value

int

Remarks

The video buffer size affects:

  • Memory usage during encoding operations
  • Latency in real-time streaming scenarios
  • Stability of the encoding process under varying system loads

Typical values:

  • 0: Use FFMPEG default (recommended for most scenarios)
  • 1000-5000: Suitable for real-time streaming
  • 5000-15000: Good for high-quality offline encoding
  • 15000+: For systems with abundant memory and complex encoding

Considerations:

  • Larger buffers provide better stability but increase memory usage
  • Smaller buffers reduce latency but may cause encoding instability
  • Optimal size depends on system resources and content characteristics

Methods

FillDefaults(DefaultsProfile, bool)

Configures FFMPEG executable output settings using predefined profiles optimized for common use cases. This method provides quick setup for standard encoding scenarios.

public void FillDefaults(DefaultsProfile profile, bool networkStreaming)

Parameters

profile DefaultsProfile

The encoding profile that determines codec selection, quality settings, and optimization targets. Each profile is optimized for specific use cases and output requirements.

networkStreaming bool

Set to true when the output is intended for real-time network streaming. This enables optimizations for low latency, faster encoding, and streaming-friendly settings.

Remarks

This method automatically configures all relevant properties based on the selected profile:

Profile-based configuration includes:

  • Optimal video codec selection (with hardware acceleration when available)
  • Appropriate audio codec and quality settings
  • Container format selection
  • Encoding parameters optimized for the target use case

Hardware acceleration priority:

  1. Intel Quick Sync Video (QSV) - if available
  2. AMD AMF - if available
  3. NVIDIA NVENC - if available
  4. Software encoding - fallback option

Network streaming optimizations (when networkStreaming=true):

  • Enables zero-latency encoding modes
  • Optimizes for real-time performance
  • Disables features that increase encoding delay
  • Configures appropriate buffering strategies

After calling this method, you can still customize individual properties to fine-tune the configuration for your specific requirements.

GetInternalTypeVC()

Gets the internal output format identifier for video capture operations. This method is used internally by the SDK to identify the output format type.

public VideoCaptureOutputFormat GetInternalTypeVC()

Returns

VideoCaptureOutputFormat

Returns VisioForge.Core.Types.VideoCapture.VideoCaptureOutputFormat.FFMPEG_EXE indicating that this output configuration uses the external FFMPEG executable for encoding.

Remarks

This method is part of the internal SDK architecture and is typically not called directly by application code. It enables the SDK to:

  • Route encoding operations to the appropriate backend
  • Apply format-specific optimizations
  • Validate configuration compatibility
  • Manage resource allocation

The returned value distinguishes this output type from other encoding backends such as DirectShow filters, Media Foundation transforms, or GStreamer pipelines.

GetInternalTypeVE()

Gets the internal output format identifier for video editing operations. This method is used internally by the SDK to identify the output format type.

public VideoEditOutputFormat GetInternalTypeVE()

Returns

VideoEditOutputFormat

Returns VisioForge.Core.Types.VideoEdit.VideoEditOutputFormat.FFMPEG_EXE indicating that this output configuration uses the external FFMPEG executable for encoding.

Remarks

This method is part of the internal SDK architecture for video editing workflows and is typically not called directly by application code. It enables the SDK to:

  • Route video editing output to the appropriate encoding backend
  • Apply editing-specific optimizations
  • Validate timeline and output format compatibility
  • Manage rendering pipeline resources

The returned value distinguishes this output type from other editing backends and ensures proper integration with the video editing engine.

Load(string)

Loads from JSON.

public static FFMPEGEXEOutput Load(string json)

Parameters

json string

JSON string.

Returns

FFMPEGEXEOutput

The String.

Save()

Saves to JSON.

public string Save()

Returns

string

The String.