---
title: 'FMPlug: FFmpeg AI Video Analytics Plugin'
url: https://www.emergentmind.com/topics/fmplug
type: topic
---

# FMPlug: FFmpeg AI Video Analytics Plugin

Searching arXiv for the specified FMPlug/FFmpeg paper and closely related FFmpeg/OpenVINO context.
FMPlug denotes a new set of FFmpeg AI analytics plugins introduced as extensions to the FFmpeg framework for inline video-content analysis. In the paper’s case studies, the reference implementation is called FFVA. The system adds AI filters implemented as `libavfilter` plugins, a pluggable inference-backend abstraction with the Intel OpenVINO Inference Engine as the reference backend, metadata propagation through `AVFrameSideData`, and thread-oriented optimizations intended to address the fact that `AVFilter` instances are single-threaded and that the filter graph executes serially in upstream FFmpeg. Its purpose is to keep media ingest, decode, pre-processing, inference, and metadata export inside the FFmpeg ecosystem rather than splitting them across separate media and AI stacks [2103.03539].

## 1. Scope, rationale, and nomenclature

In this usage, FMPlug refers to the paper’s FFmpeg analytics extension rather than to unrelated later uses of the same name. The implementation targets multimedia applications that already rely on FFmpeg for encoding, decoding, muxing, demuxing, and post-processing, and extends those pipelines with AI-powered video analysis. The immediate design objective is not to replace FFmpeg’s media functions, but to insert analytics stages inline so that decoded frames can be analyzed before subsequent sinks such as encoders, files, null outputs, or metadata publishers [2103.03539].

The rationale rests on a division between conventional media processing and analytics workloads. FFmpeg natively provides demux, decode, scale, color-space conversion, encode, and related media plumbing, whereas analytics workloads are more computationally intensive, often memory-bound, operate on RGB tensors rather than YUV frames, and produce metadata such as labels, confidences, and bounding boxes rather than only audiovisual streams. FMPlug therefore treats AI inference as an extension of the media graph while preserving FFmpeg’s existing composition model.

A common misconception is that the extension is primarily a visualization facility. The described implementation is instead metadata-centric: analytics results are attached to frames as side data and may be exported as JSON, text, or Kafka messages. Visual overlays are not described, and the paper’s emphasis is on metadata emission and downstream consumption rather than on rendering annotations into video frames [2103.03539].

## 2. Integration into FFmpeg and end-to-end architecture

FMPlug is integrated into FFmpeg at the `libavfilter` layer. The principal filters are `detect` and `classify`, both expressed as `AVFilter` components and composed inside the ordinary FFmpeg filter graph. Analytics metadata is carried between filters by attaching `AVFrameSideData` to `AVFrame`, which allows propagation without altering the underlying frame payload [2103.03539].

The end-to-end data flow is:

Demux $\rightarrow$ Decode $\rightarrow$ Post-processing (scale, color-space conversion YUV$\rightarrow$RGB/BGRP) $\rightarrow$ AI filters (`detect \rightarrow classify \rightarrow \dots`) $\rightarrow$ Metadata publisher and/or downstream sinks.

For ROI-based flows, `detect` produces bounding boxes in side data; `classify` then crops each ROI, resizes it, converts it to BGRP, and runs classification on each object.

| Component | Function | FFmpeg integration point |
|---|---|---|
| `detect` | Object detection on decoded frames; emits boxes, label IDs, confidences | `libavfilter` / `AVFilter` |
| `classify` | Consumes detections, crops ROIs, rescales, converts to BGRP, runs classification | `libavfilter` / `AVFilter` |
| Inference Backend + metadata publisher | Manages inference requests and emits JSON, text, or Kafka metadata | Backend abstraction plus side-data export |

The backend abstraction bridges the AI filters to an inference engine. In the reference implementation, that engine is Intel OpenVINO. The abstraction is designed to be pluggable, so that other engines, such as TensorFlow, can be added by implementing a standard interface. Backend responsibilities include model loading, resource management, creation and dispatch of inference requests, asynchronous submission and completion handling, and selected pre/post-processing steps for efficiency [2103.03539].

The paper does not claim a zero-copy or DMA-based path. Pre-processing stages such as scale and color-space conversion may copy or transform frames as needed, FIFO buffers decouple stages, and asynchronous inference is used to reduce stalls. No explicit DMA or zero-copy mechanism is described [2103.03539].

## 3. Filters, metadata semantics, and model control

The `detect` filter runs object detection on decoded frames and produces a list of bounding boxes given as `x/y/width/height`, label IDs, and confidences. These results are attached to frames as side data. The `classify` filter consumes those detections, crops objects, rescales them, converts them to BGRP, and then runs classification. Multiple `classify` filters can be chained, which allows different classification models to be applied over the same detected ROIs [2103.03539].

This chaining behavior is central to the framework’s compositional design. Detection produces a structured intermediate representation, and classification stages consume that representation rather than re-reading the source media. The metadata carrier is `AVFrameSideData`, which functions as a tensor-like transport mechanism inside the graph. This choice avoids changes to core frame payloads and keeps analytics outputs synchronized with frame flow.

Each AI filter supports `model_proc`, which declaratively specifies output post-processing such as label mapping or bounding-box decoding. The declared purpose is to avoid bespoke post-processing code in individual pipelines. The same metadata can be converted into human-readable outputs through a metadata publisher component that emits JSON or text and can publish to Kafka for downstream services [2103.03539].

The implementation is therefore not limited to a single monolithic inference pass. It supports a sequence in which decode, color conversion, detection, multiple classifications, and metadata publication all remain within an FFmpeg invocation. This suggests a pipeline style in which FFmpeg acts simultaneously as media runtime and analytics orchestrator, but the paper restricts its concrete examples to detection and classification workloads [2103.03539].

## 4. Threading model, scheduling, and reported performance

The performance discussion begins from two limitations identified by the authors: `AVFilter` instances are single-threaded, and the filter graph executes serially in upstream FFmpeg. Heavy analytics pipelines therefore become bottlenecked unless additional concurrency is introduced outside the default execution model [2103.03539].

FMPlug addresses this with several strategies. First, it introduces intra-filter parallelism at the frame and object level, allowing multiple inference requests to run concurrently within a filter; the relevant concurrency knob is `nireq`. Second, it introduces inter-filter pipeline parallelism so that major components such as decoder, scale/color-space conversion, `detect`, and `classify` run in separate threads, with FIFO buffers between stages and asynchronous inference to keep devices busy. Third, for multi-output pipelines, an FFVA-specific `-abr_pipeline` option enables experimental filter-graph threading so that multiple branches fed from a common input can execute in parallel [2103.03539].

The paper describes the scheduling model textually rather than formally diagramming all states. Stages are decoupled by FIFOs, the backend schedules asynchronous inference, and inference requests transition between idle and busy states. The stated goal is to maximize the fraction of time `nireq` are busy while balancing upstream decode and downstream post-processing or emission so as to avoid backpressure stalls.

The reported throughput values were obtained on an Intel Xeon (Cascade Lake) 6252 CPU with 40 GB RAM and Ubuntu 18.04.2 LTS, using FFmpeg 4.2 with experimental threading features and FFVA 0.4.2. Two case studies are reported [2103.03539].

| Pipeline | Throughput | Speedup |
|---|---|---|
| Car detection + license plate recognition | 653 fps non-parallel; 777 fps parallel | $S = 777 / 653 \approx 1.19$ |
| Two-branch 1:N pipeline (plate and face branches) | 245 fps non-parallel; 307 fps parallel | $S = 307 / 245 \approx 1.25$ |

For context, the paper gives the standard formulas
$$
T = \frac{N}{\Delta t}
$$
for throughput in frames per second, and
$$
S = \frac{T_{\mathrm{opt}}}{T_{\mathrm{base}}}
$$
for speedup. It also cites Amdahl’s law,
$$
S = \frac{1}{(1-p) + p/N},
$$
to frame the dependence of attainable speedup on the parallelizable fraction of the pipeline. Latency is not directly reported. The paper states that pipeline parallelism typically increases throughput, while per-frame latency depends on queueing across FIFO stages and asynchronous inference completion [2103.03539].

A second misconception concerns upstream status. The largest throughput gains depend on experimental threading and parallel filter-graph changes that required “non-trivial changes” to FFmpeg and were maintained privately for experiments; these changes were not in the public FFVA repository or upstream FFmpeg at the time of writing [2103.03539].

## 5. Inference backend, hardware targets, and supported workloads

The reference backend is the Intel OpenVINO Inference Engine. Model loading is driven by filter parameters such as `model=` and `device=`, with examples using Intel Open Model Zoo models in OpenVINO IR format. Device selection is explicit, and OpenVINO support is described for CPU, GPU, VPU, FPGA, and other Intel analytics accelerators. Device-specific performance knobs can be passed via `configs=`, with CPU examples using `CPU_THROUGHPUT_STREAMS` and `CPU_THREADS_NUM`; request-level concurrency is controlled by `nireq` [2103.03539].

The workloads explicitly supported in the paper are object detection and classification or recognition. The examples include:

- `vehicle-license-plate-detection-barrier-0106`
- `license-plate-recognition-barrier-0001`
- `face-detection-adas-0001`
- `face-reidentification-retail-0095`

These examples illustrate both single-branch and 1:N multi-branch graphs. A representative single-branch CPU invocation chains `detect` and `classify` with `nireq=8` and `configs=CPU_THROUGHPUT_STREAMS=24,CPU_THREADS_NUM=96`. A representative two-branch invocation duplicates the `-vf` chain for license-plate and face pipelines and enables `-abr_pipeline` for parallel multi-output execution [2103.03539].

Dynamic shapes and batching are not explicitly discussed. The paper states that concurrency is achieved through `nireq` and graph/thread parallelism rather than through explicit batching semantics. Likewise, the discussion of hardware acceleration remains focused on CPU examples. Although OpenVINO support extends to GPU, VPU, FPGA, and other accelerators, no GPU/VPU/FPGA measurements or device-specific constraints beyond OpenVINO support are reported [2103.03539].

## 6. Upstream status, limitations, and position within the media-AI ecosystem

The upstream status is mixed. The authors state that OpenVINO as a backend for FFmpeg’s DNN module has been pushed into the FFmpeg mainstream repository, and that additional OpenVINO features for the DNN module are being added with ideas originating from the presented implementation. By contrast, the experimental FFmpeg threading and parallel-graph enhancements used in the paper remained outside both the public FFVA repository and upstream FFmpeg at the time of publication [2103.03539].

The paper positions FMPlug partly against limitations of FFmpeg’s pre-existing DNN module, described at the time as TensorFlow-only, lacking tensor I/O exposure, and having limited pre-processing filter customization. FMPlug addresses those gaps through a backend-pluggable design, side-data-based metadata propagation, and customizable `model_proc`. Within a broader ecosystem comparison, the paper notes that DL Streamer provides similar OpenVINO-oriented capabilities for GStreamer, whereas FMPlug brings comparable functionality to FFmpeg. MediaPipe and OpenCV G-API are described as graph frameworks that can rely on FFmpeg for I/O, while FFmpeg is stronger at native streaming and time-series media handling. NVIDIA DeepStream is identified as a closed-source GStreamer-based framework, but broader quantitative comparison is explicitly out of scope [2103.03539].

Several limitations are stated or left explicit by omission. The paper does not discuss interaction with FFmpeg hardware-acceleration APIs such as VAAPI or QSV, does not describe zero-copy paths, does not report memory-footprint metrics, and does not provide detailed thread-safety analysis. It also emphasizes that increasing `nireq` and throughput streams improves throughput at the cost of higher CPU and memory utilization, so optimal settings depend on hardware capacity and decode rate [2103.03539].

The extensibility claim is more concrete. Because the backend abstraction is standardized, other inference engines can be added by implementing the interface. Additional AI filters and richer `model_proc` definitions can extend workloads beyond detection and classification, including tracking and segmentation in future patches. In that sense, FMPlug is best understood not as a finished analytics product but as an FFmpeg-native architecture for AI inference, metadata transport, and device-aware scheduling inside conventional media pipelines [2103.03539].

Source: https://www.emergentmind.com/topics/fmplug