Class GIFEncoderBlock
- Assembly
- VisioForge.Core.dll
GIF (Graphics Interchange Format) encoder block for creating animated GIF images from video streams. This block provides GIF encoding capabilities for generating animated images suitable for web content, social media, documentation, and visual demonstrations. Features advanced color quantization, dithering options, and frame optimization for efficient file sizes while maintaining visual quality.
Key features:
- 256-color palette per frame with advanced quantization
- Temporal dithering for smoother color transitions
- Frame optimization and delta encoding
- Variable frame rates and loop control
- Transparency support for overlay effects
- LZW compression for efficient file sizes
- Interlaced GIF support for progressive loading
Common use cases:
- Social media content and memes
- Product demonstrations and tutorials
- Email marketing animations
- Documentation and help files
- Web banner advertisements
- UI/UX prototypes and mockups
- Screen recordings and demos
Note: GIF format limitations include 256 colors per frame and larger file sizes compared to modern video formats. Consider frame rate reduction and resolution optimization for web use. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.
public class GIFEncoderBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
GIFEncoderBlock(GIFEncoderSettings)
Initializes a new instance of the VisioForge.Core.MediaBlocks.VideoEncoders.GIFEncoderBlock class for stream output. Creates a GIF encoder that outputs to a stream for further processing.
public GIFEncoderBlock(GIFEncoderSettings settings)Parameters
settingsGIFEncoderSettings-
The GIF encoder settings defining quality, dithering, and optimization parameters.
GIFEncoderBlock(GIFEncoderSettings, string)
Initializes a new instance of the VisioForge.Core.MediaBlocks.VideoEncoders.GIFEncoderBlock class for file output. Creates a GIF encoder that writes directly to a file.
public GIFEncoderBlock(GIFEncoderSettings settings, string filename)Parameters
settingsGIFEncoderSettings-
The GIF encoder settings defining quality, dithering, and optimization parameters.
filenamestring-
The output file path where the animated GIF will be written.
GIFEncoderBlock(GIFOutput)
Initializes a new instance of the VisioForge.Core.MediaBlocks.VideoEncoders.GIFEncoderBlock class from output configuration. Creates a GIF encoder with integrated file output settings.
public GIFEncoderBlock(GIFOutput output)Parameters
outputGIFOutput-
The GIF output configuration containing both encoder settings and file path.
Properties
Input
Gets the primary input pad for receiving raw video frames.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets all input pads available on this block.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the primary output pad for GIF data stream.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads available on this block.
public override MediaBlockPad[] Outputs { get; }Property Value
Settings
Gets or sets the GIF encoder settings controlling animation quality and optimization.
public GIFEncoderSettings Settings { get; set; }Property Value
Type
Gets the block type identifier for the GIF encoder.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds and initializes the GIF encoder pipeline. Creates the GIF encoder with color quantization and optional file output, configuring it for animated image generation with specified quality settings.
public override bool Build()Returns
- bool
-
trueif the encoder was successfully built;falseif initialization failed.
CleanUp()
Performs cleanup of all resources associated with the GIF encoder. Disposes the encoder element and file sink if present.
public void CleanUp()Dispose(bool)
Releases unmanaged and - optionally - managed resources.
protected override void Dispose(bool disposing)Parameters
disposingbool-
trueto release both managed and unmanaged resources;falseto release only unmanaged resources.
GetCore()
Gets the core GStreamer element wrapper for advanced configuration.
public BaseElement GetCore()Returns
- BaseElement
-
The BaseElement wrapper for the GIF encoder.
GetElement()
Gets the underlying GStreamer GIF encoder element.
public Element GetElement()Returns
- Element
-
The native GStreamer element performing GIF encoding.
GetFilenameOrURL()
Gets the current output filename where the GIF is being written.
public string GetFilenameOrURL()Returns
- string
-
The file path for the GIF output, or null if using stream output.
IsAvailable()
Determines whether GIF encoding functionality is available on the current system. Requires the GStreamer GIF encoder plugin to be installed.
public static bool IsAvailable()Returns
- bool
-
trueif GIF encoding is supported; otherwise,false.
SetFilenameOrURL(string)
Sets a new output filename for the GIF file. Only applicable when using file output mode.
public void SetFilenameOrURL(string value)Parameters
valuestring-
The new file path for GIF output.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the media pipeline context for this GIF encoder block.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The parent media pipeline containing this block.