Skip to main content

Module context

Module context 

Source
Expand description

The context module provides tools for assembling an entire FFmpeg pipeline, culminating in the FfmpegContext. This includes:

  • Inputs: Input objects representing files, URLs, or custom I/O callbacks.
  • Outputs: Output objects representing target files, streams, or custom sinks.
  • Filter Descriptions: Simple inline filters via filter_desc or more complex FilterComplex graphs.
  • Builders: e.g., FfmpegContextBuilder for constructing a complete context with multiple inputs, outputs, and filter settings.

Once you’ve built an FfmpegContext, you can execute it via the FfmpegScheduler.

§Example

// Build an FFmpeg context with one input, some filter settings, and one output.
let context = FfmpegContext::builder()
    .input("test.mp4")
    .filter_desc("hue=s=0")
    .output("output.mp4")
    .build()
    .unwrap();
// The context now holds all info needed for an FFmpeg job.

Modules§

ffmpeg_context
The ffmpeg_context module is responsible for assembling FFmpeg’s configuration: inputs, outputs, codecs, filters, and other parameters needed to construct a complete media processing pipeline.
ffmpeg_context_builder
The ffmpeg_context_builder module defines the builder pattern for creating FfmpegContext objects.
filter_complex
The filter_complex module defines the FilterComplex struct, which encapsulates one or more FFmpeg filter descriptions (e.g., "scale=1280:720", "hue=s=0", etc.). You can use FilterComplex to construct more advanced or multi-step filter graphs than simple inline strings allow.
input
The input module defines the Input struct, representing an FFmpeg input source. An input can be:
null_output
The null_output module provides a custom null output implementation for FFmpeg that discards all data while supporting seeking.
output
The output module defines the Output struct, representing an FFmpeg output destination. An output may be:

Functions§

frame_alloc
null_frame