ELLMPEG: An Edge-based Agentic LLM Video Processing Tool

Zoha Azimi, Reza Farahani, Radu Prodan, Christian TimmererarXiv 2026

TL;DR

ELLMPEG is an edge-deployable, agentic LLM framework designed to automatically generate complex video-processing commands (FFmpeg and VVenC) directly on local devices. By combining tool-aware Retrieval-Augmented Generation (RAG) with a self-reflection loop, it enables small open-source models (2–8B parameters) to achieve up to 78% average command accuracy with zero recurring cloud API costs and total data privacy.

What Problem Does This Paper Address?

Video processing is foundational to modern internet traffic, and tools like FFmpeg are the industry standard for encoding, transcoding, and editing. However, FFmpeg's command-line interface is notoriously complex and difficult for non-experts to navigate. Newer specialized tools, like the Versatile Video Codec (VVC) encoder (VVenC), add even more syntactic complexity.

While cloud-based LLMs like GPT-4o can generate these commands accurately, they introduce significant drawbacks: high recurring API costs, strict network dependencies, and privacy risks associated with uploading data. Deploying smaller, open-source LLMs on edge devices solves the privacy and cost issues, but these models suffer from an "accuracy-efficiency gap." Because specialized multimedia tools are underrepresented in general training data, small models frequently hallucinate incorrect codec names or non-existent parameters.

Figure 1: Comparison of responses to two queries: green borders indicate valid commands, red borders denote invalid ones.

Methods

To bridge this gap, the authors introduce ELLMPEG, a multi-stage agentic framework tailored for resource-constrained edge environments.

Figure 2: ELLMPEG architecture.

The framework operates in three main phases:

  1. Tool-Aware RAG Setup: Raw documentation for FFmpeg and VVenC is chunked and embedded using the compact bge-small-en-v1.5 model. Crucially, ELLMPEG maintains dual vector stores (via FAISS flat indexing)—one for FFmpeg and one for VVenC. This isolates the search spaces and prevents cross-tool context contamination.
  2. LLM Reasoning & Self-Reflection: When a user inputs a natural language query, the LLM first acts as a router to select the correct tool database. It retrieves the top-$k$ relevant documentation chunks to generate an initial command. Then, the model enters an autonomous self-reflection loop, critiquing its own syntax and parameters against the retrieved documentation to iteratively refine the command.
  3. Command Execution: A lightweight regex-based extraction module isolates the pure shell command from the LLM's conversational text and dispatches it to the local FFmpeg/VVenC backend for execution and verification.

Datasets

Because no benchmark existed for this specific task, the authors created and open-sourced a dedicated dataset comprising 480 diverse multimedia queries:

  • 380 FFmpeg queries covering video manipulation, compression management, format operations, streaming, audio engineering, and advanced filtergraphs.
  • 100 VVenC queries focusing on specialized encoding configurations, output management, and troubleshooting.

The dataset was built using a hybrid approach, combining 200 GPT-4o generated intent-driven scenarios with 280 real-world examples harvested from GitHub repositories, community forums, and official code snippets.

Figure 3: Query distribution across various categories in the (a) FFmpeg and (b) VVenC command pools.

Key Insights and Ideas

  • RAG is a Massive Equalizer for Small Models: The addition of domain-specific documentation yielded massive accuracy gains for specialized tools. For VVenC queries, adding RAG improved the accuracy of the base models by up to 280%, proving that local context can compensate for a lack of massive pre-training data.
  • The Self-Reflection Sweet Spot: More reasoning isn't always better. The authors discovered that while iterative self-reflection improves command validity, performance peaks at 3 iterations. Beyond this point, smaller models tend to "over-correct" valid syntax, hallucinating errors that actually degrade final accuracy.
Figure 6: Accuracy of Qwen2.5 on FFmpeg queries under different self-reflection iteration depths
  • Context Windows Matter on the Edge: Models with larger context windows (like Qwen2.5's 128k tokens) performed significantly better because they could ingest and synthesize multiple retrieved documentation chunks without truncating critical syntax details.

Key Results

The authors evaluated four open-source models (Gemma2-2B, Mistral-7B, Qwen2.5-7B, and Llama3.1-8B) on an Intel i7-8700 CPU edge system:

  • Top Performer: Qwen2.5-7B augmented with ELLMPEG achieved the highest accuracy, reaching 88% accuracy on FFmpeg and 71% on VVenC (when evaluated by a GPT-4o judge), outperforming all other open-source configurations.
  • The Agentic Tax: This accuracy comes at a computational cost. The RAG and self-reflection loops increased local inference energy consumption by a factor of 1.5x to 2.6x compared to the base models, alongside lower tokens-per-second (TPS) metrics. However, this trade-off completely eliminates cloud API dependencies and recurring costs.

Limitations and Future Work

The primary bottleneck of ELLMPEG is its computational overhead when deployed on purely CPU-based edge devices, leading to higher latency (inference times) and lower token generation speeds.

To address this, the authors point to three future directions:

  1. Transitioning the framework to GPU-accelerated edge devices to reduce latency.
  2. Implementing query-level energy budgeting to dynamically bypass the self-reflection loop for simple queries, saving power.
  3. Utilizing pre-trained domain-specific embeddings to further sharpen the accuracy of the initial RAG retrieval step.

Summary updated

Abstract

Large language models (LLMs), the foundation of generative AI systems like ChatGPT, are transforming many fields and applications, including multimedia, enabling more advanced content generation, analysis, and interaction. However, cloud-based LLM deployments face three key limitations: high computational and energy demands, privacy and reliability risks from remote processing, and recurring API costs. Recent advances in agentic AI, especially in structured reasoning and tool use, offer a better way to exploit open and locally deployed tools and LLMs. This paper presents ELLMPEG, an edge-enabled agentic LLM framework for the automated generation of video-processing commands. ELLMPEG integrates tool-aware Retrieval-Augmented Generation (RAG) with iterative self-reflection to produce and locally verify executable FFmpeg and VVenC commands directly at the edge, eliminating reliance on external cloud APIs. To evaluate ELLMPEG, we collect a dedicated prompt dataset comprising 480 diverse queries covering different categories of FFmpeg and the Versatile Video Codec (VVC) encoder (VVenC) commands. We validate command generation accuracy and evaluate four open-source LLMs based on command validity, tokens generated per second, inference time, and energy efficiency. We also execute the generated commands to assess their runtime correctness and practical applicability. Experimental results show that Qwen2.5, when augmented with the ELLMPEG framework, achieves an average command-generation accuracy of 78 % with zero recurring API cost, outperforming all other open-source models across both the FFmpeg and VVenC datasets.
BibTeX
@misc{azimi2026ellmpeg,
  author = {Zoha Azimi and Reza Farahani and Radu Prodan and Christian Timmerer},
  title = {{ELLMPEG: An Edge-based Agentic LLM Video Processing Tool}},
  year = {2026},
  eprint = {2602.00028},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2602.00028},
}
Figure