AI-powered FFmpeg command generator
Project description
FFmpeg AI Assistant
A command-line utility that acts as an intelligent FFmpeg assistant for developers. This tool runs entirely offline and uses a local LLM via Ollama to provide context-aware FFmpeg commands, code snippets, and explanations.
Features
- Generate FFmpeg commands from natural language queries
- Get Python, Bash, or Node.js code wrappers for FFmpeg commands
- Detailed explanations of command parameters
- 100% offline operation with local LLM and vector database
- Smart caching for repeated queries
- Easy customization and model switching
Installation
Recommended: PyPI Installation
Install the tool from PyPI using:
pip install ffmpeg-ai
Documentation Setup After Installation
After installing, you must initialize the documentation database:
ffmpeg-ai setup
Command-Line Interface
Once installed, you can interact with the tool via the command line. Use the following command to get help:
ffmpeg-ai --help
This will display the available options and commands:
Usage: ffmpeg-ai --help
AI-powered FFmpeg command generator
Options:
--help Show this message and exit.
Commands:
query Ask a natural language question about FFmpeg.
setup Set up the FFmpeg documentation database.
clear-cache Clear the query cache.
Documentation Setup
Running ffmpeg-ai setup will:
- Download and parse FFmpeg's official documentation
- Create vector embeddings for faster and more accurate querying
- Store the embeddings locally for offline use
Real Usage Example
Here's an example of using the tool in your project:
# In your project directory, run:
ffmpeg-ai query "convert .mov to .mp4 using H.264 codec" --code
Result:
FFmpeg Command:
ffmpeg -i input.mov -vcodec libx264 output.mp4
Generated Python Script:
import os
import subprocess
def convert_mov_to_mp4(input_file, output_file):
command = f'ffmpeg -i {input_file} -vcodec libx264 {output_file}'
subprocess.run(command, shell=True, check=True)
# Usage example:
input_file = 'input.mov'
output_file = 'output.mp4'
convert_mov_to_mp4(input_file, output_file)
How It Works
- Document Retrieval: Fetches the most relevant chunks from embedded FFmpeg documentation using sentence-transformers and ChromaDB.
- Query Augmentation: Combines your query with retrieved context before sending it to the local LLM.
- LLM Generation: The local model (e.g., Mistral) generates the command, code, and explanations.
- Result Formatting: Outputs are formatted cleanly and cached for faster future retrieval.
Requirements
- Python 3.10+
- FFmpeg installed system-wide
- Ollama installed and running
- Local machine with ~8GB RAM or more recommended
Limitations
- Responses depend on the quality of the local LLM model.
- Currently limited to embedded and user-added FFmpeg documentation.
- Hardware-intensive for optimal performance.
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ffmpeg_ai-0.1.8.tar.gz.
File metadata
- Download URL: ffmpeg_ai-0.1.8.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21079c8ba4aac427ca175f67a92d9f4a144d1660f20d252d61e4383ba2b581c2
|
|
| MD5 |
e1d9217c2041f36842fb14207e422999
|
|
| BLAKE2b-256 |
a8a4bd966b4b8285049acc15175d99f953335da350a503df0c73f8849902e4a1
|
File details
Details for the file ffmpeg_ai-0.1.8-py3-none-any.whl.
File metadata
- Download URL: ffmpeg_ai-0.1.8-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
446d79c3b6335712e6ab4e1221d1c7245d0507a70d4146429539a2f3b36a0209
|
|
| MD5 |
126eebfb4edf0c0660a7f0082f624077
|
|
| BLAKE2b-256 |
63bc91d36819b56ce2688e6f849fffa35f11e89ca662b52b64e8d6ebb3bd32ce
|