Class CustomOutput
- Namespace
- VisioForge.Core.Types.Output
- Assembly
- VisioForge.Core.dll
Represents configuration settings for custom output formats using DirectShow filters.
public sealed class CustomOutput : IVideoEditBaseOutput, IVideoCaptureBaseOutputInheritance
Implements
Inherited Members
Remarks
This class provides a flexible way to create custom output formats by manually specifying the video codec, audio codec, and multiplexer (mux) filter. It's designed for advanced users who need to use specific DirectShow filters not covered by the standard output formats.
CustomOutput is useful for:
- Using third-party or proprietary codecs
- Creating specialized file formats
- Implementing custom encoding pipelines
- Working with industry-specific formats
The class allows direct control over the DirectShow filter graph construction, enabling combinations of filters that aren't available through standard output options.
Constructors
CustomOutput()
Initializes a new instance of the VisioForge.Core.Types.Output.CustomOutput class with default settings.
public CustomOutput()Remarks
Default configuration:
- Video codec: "MJPEG Compressor"
- Audio codec: "PCM" (uncompressed)
- Multiplexer: "AVI Mux"
- Audio: 16-bit stereo at 44100 Hz
- Codec categories: Standard (not DirectShow Filters)
These defaults create a basic AVI output with MJPEG video and uncompressed audio. Modify the properties to use different codecs, multiplexers, or formats as needed.
Properties
Audio_BPS
Gets or sets the bits per sample (bit depth) for the audio codec.
public int Audio_BPS { get; set; }Property Value
Remarks
The bits per sample determines the dynamic range and quality of the audio:
- 8-bit: Lower quality (48 dB dynamic range)
- 16-bit: CD quality (96 dB dynamic range)
- 24-bit: Professional quality (144 dB dynamic range)
- 32-bit: Highest quality for processing
Some codecs may ignore this parameter or force a specific bit depth based on their specifications. Compressed codecs often use their own internal representation.
Audio_Channels
Gets or sets the number of audio channels for the audio codec.
public int Audio_Channels { get; set; }Property Value
Remarks
This property specifies the channel configuration:
- 1: Mono (single channel)
- 2: Stereo (left and right channels)
- 6: 5.1 surround sound (if supported by codec)
- 8: 7.1 surround sound (if supported by codec)
Not all codecs support multi-channel audio. Ensure the selected audio codec is compatible with the channel configuration you specify.
Audio_Codec
Gets or sets the name of the audio codec filter to use.
public string Audio_Codec { get; set; }Property Value
Remarks
This should be the exact name of a DirectShow audio codec filter installed on the system. Common examples include:
- "PCM": Uncompressed audio
- "Microsoft ADPCM": Adaptive Differential PCM
- "MP3": If an MP3 encoder filter is installed
- "AAC Encoder": If an AAC encoder is available
Use GraphEdit or similar tools to discover available audio codecs on your system. The codec must be compatible with the selected multiplexer.
Audio_Codec_UseFiltersCategory
Gets or sets a value indicating whether to search for the audio codec in the DirectShow Filters category.
public bool Audio_Codec_UseFiltersCategory { get; set; }Property Value
Remarks
DirectShow filters can be registered in different categories. Audio codecs are typically found in:
- Audio Compressors category (default): Standard audio codecs
- DirectShow Filters category: General filters including some audio processors
Enable this if your audio codec is registered as a general DirectShow filter rather than specifically as an audio compressor. This is common for third-party or specialized filters.
Audio_SampleRate
Gets or sets the audio sample rate in Hz (samples per second).
public int Audio_SampleRate { get; set; }Property Value
Remarks
Common sample rates include:
- 8000 Hz: Telephone quality
- 11025 Hz: Low quality
- 22050 Hz: Radio quality
- 44100 Hz: CD quality (standard)
- 48000 Hz: Professional audio/video
- 96000 Hz: High-resolution audio
The selected codec must support the sample rate you specify. Higher sample rates provide better frequency response but increase file size.
MuxFilter_IsEncoder
Gets or sets a value indicating whether the multiplexer filter also acts as an encoder.
public bool MuxFilter_IsEncoder { get; set; }Property Value
Remarks
Some DirectShow filters combine multiplexing and encoding functionality. For example:
- Windows Media Writer filters encode and mux in one step
- Some MP4 muxers include H.264 encoding
When set to true, the filter will receive uncompressed data and handle both encoding and multiplexing. When false, the filter expects already-encoded streams and only combines them into the output container.
MuxFilter_Name
Gets or sets the name of the multiplexer filter to use for creating the output file.
public string MuxFilter_Name { get; set; }Property Value
Remarks
The multiplexer (mux) filter combines audio and video streams into a container format. Common multiplexers include:
- "AVI Mux": Creates AVI files
- "WM ASF Writer": Creates WMV/WMA files
- "GDCL MPEG-4 Multiplexor": Creates MP4 files
- "Matroska Muxer": Creates MKV files
The multiplexer must be compatible with the selected audio and video codecs. Some muxers have specific requirements for input formats and may not work with all codecs.
SpecialFileWriter_FilterName
Gets or sets the name of a special file writer filter to use instead of the default file writer.
public string SpecialFileWriter_FilterName { get; set; }Property Value
Remarks
Some multiplexers require specific file writers or have integrated file writing capabilities. Examples include:
- "WM ASF Writer": Has built-in file writing
- Custom filters for network streaming
- Filters that write to multiple files or special formats
Only set this if your multiplexer requires a specific file writer or if you need special file handling (like writing to multiple files or streaming to a network).
SpecialFileWriter_Needed
Gets or sets a value indicating whether a special file writer filter should be used.
public bool SpecialFileWriter_Needed { get; set; }Property Value
Remarks
Enable this when:
- The multiplexer has specific file writer requirements
- You need custom file handling (multiple files, network streaming, etc.)
- The standard file writer is incompatible with your multiplexer
When disabled, the standard DirectShow file writer filter will be used, which works for most common scenarios and provides good performance for local file writing.
Video_Codec
Gets or sets the name of the video codec filter to use.
public string Video_Codec { get; set; }Property Value
Remarks
This should be the exact name of a DirectShow video codec filter installed on the system. Common examples include:
- "MJPEG Compressor": Motion JPEG compression
- "DV Video Encoder": Digital Video format
- "xvid": Xvid MPEG-4 codec (if installed)
- "x264vfw": H.264 codec (if installed)
- "Microsoft Video 1": Legacy but highly compatible
The codec must be compatible with the selected multiplexer. Some codecs may require specific configuration through their property pages.
Video_Codec_UseFiltersCategory
Gets or sets a value indicating whether to search for the video codec in the DirectShow Filters category.
public bool Video_Codec_UseFiltersCategory { get; set; }Property Value
Remarks
DirectShow filters can be registered in different categories. Video codecs are typically found in:
- Video Compressors category (default): Standard video codecs
- DirectShow Filters category: General filters including some video processors
Enable this if your video codec is registered as a general DirectShow filter rather than specifically as a video compressor. This is common for:
- DMO (DirectX Media Object) wrappers
- Third-party codec packs
- Specialized encoding filters
Methods
GetInternalTypeVC()
Gets the internal output format identifier for video capture operations.
public VideoCaptureOutputFormat GetInternalTypeVC()Returns
- VideoCaptureOutputFormat
-
Returns VisioForge.Core.Types.VideoCapture.VideoCaptureOutputFormat.Custom to indicate this is a custom output format.
Remarks
This method is used internally by the video capture system to identify the output format type. It implements the VisioForge.Core.Types.Output.IVideoCaptureBaseOutput.GetInternalTypeVC interface method.
GetInternalTypeVE()
Gets the internal output format identifier for video editing operations.
public VideoEditOutputFormat GetInternalTypeVE()Returns
- VideoEditOutputFormat
-
Returns VisioForge.Core.Types.VideoEdit.VideoEditOutputFormat.Custom to indicate this is a custom output format.
Remarks
This method is used internally by the video editing system to identify the output format type. It implements the VisioForge.Core.Types.Output.IVideoEditBaseOutput.GetInternalTypeVE interface method.
Load(string)
Deserializes custom output settings from a JSON string.
public static CustomOutput Load(string json)Parameters
jsonstring-
The JSON string containing the serialized custom output settings.
Returns
- CustomOutput
-
A new VisioForge.Core.Types.Output.CustomOutput instance with settings restored from the JSON string.
Remarks
This method uses the default JSON deserialization options from VisioForge.Core.Helpers.JsonSerializerOptionsHelper. The JSON string should have been created using the VisioForge.Core.Types.Output.CustomOutput.Save method or follow the same format. All properties will be restored to their serialized values.
Exceptions
- JsonException
-
Thrown when the JSON string is invalid or cannot be deserialized to a CustomOutput object.
Save()
Serializes the current custom output settings to a JSON string.
public string Save()Returns
- string
-
A JSON string representation of the current settings that can be persisted or transmitted.
Remarks
This method uses the default JSON serialization options from VisioForge.Core.Helpers.JsonSerializerOptionsHelper. The resulting JSON includes all codec, multiplexer, and audio configuration properties. The serialized settings can be restored later using the VisioForge.Core.Types.Output.CustomOutput.Load(System.String) method.