Natural language to FFmpeg, instantly and privately
Project description
███╗ ███╗███████╗██████╗ ██╗ █████╗ ██╗ ██╗ ███╗ ███╗
████╗ ████║██╔════╝██╔══██╗██║██╔══██╗██║ ██║ ████╗ ████║
██╔████╔██║█████╗ ██║ ██║██║███████║██║ ██║ ██╔████╔██║
██║╚██╔╝██║██╔══╝ ██║ ██║██║██╔══██║██║ ██║ ██║╚██╔╝██║
██║ ╚═╝ ██║███████╗██████╔╝██║██║ ██║███████╗███████╗██║ ╚═╝ ██║
╚═╝ ╚═╝╚══════╝╚═════╝ ╚═╝╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝
Quick Start
Install MediaLLM:
pip install mediallm
Setup prerequisites:
# Install Ollama (local LLM)
curl -fsSL https://ollama.com/install.sh | sh
ollama serve
ollama pull llama3.1:latest
# Install FFmpeg
brew install ffmpeg # macOS
# sudo apt install ffmpeg # Linux
CLI Usage
# Convert video to audio
mediallm "convert video.mp4 to MP3 audio"
# Resize and compress
mediallm "compress large_video.mp4 to 720p"
# Create GIF from video
mediallm "create 10-second GIF from video.mp4 starting at 1 minute"
# Preview command (dry-run)
mediallm --dry-run "extract audio from movie.avi"
Python API Usage
Basic Usage
import mediallm
# Initialize MediaLLM
ml = mediallm.MediaLLM()
# Generate FFmpeg commands from natural language
commands = ml.generate_command("convert video.mp4 to high-quality MP3")
print("Generated commands:", commands)
# Scan workspace for media files
workspace = ml.scan_workspace()
print(f"Found {len(workspace.get('videos', []))} videos")
Advanced Usage
import mediallm
# Scan directory for media files
workspace = mediallm.discover_media()
print(f"Found {len(workspace.get('videos', []))} videos")
# Initialize with custom settings
ml = mediallm.MediaLLM(
workspace=workspace,
model_name="llama3.1:latest",
ollama_host="http://localhost:11434",
timeout=120
)
# Generate commands from natural language
commands = ml.generate_command("compress large_video.mp4 to 720p")
print("Commands:", commands)
Using Data Models
import mediallm
from pathlib import Path
# Create MediaIntent objects directly
intent = mediallm.MediaIntent(
action=mediallm.Action.convert,
inputs=[Path("input.mp4")],
video_codec="libx264",
audio_codec="aac"
)
# Available actions
for action in mediallm.Action:
print(f"- {action.value}")
Configuration
Create a .env file or set environment variables:
MEDIALLM_MODEL=llama3.1:latest
MEDIALLM_OLLAMA_HOST=http://localhost:11434
MEDIALLM_OUTPUT_DIR=./outputs
MEDIALLM_DRY_RUN=false
Contributing
We welcome contributions! See our contributing guide for:
- Development setup
- Testing guidelines
- Code style requirements
- How to submit pull requests
Project details
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 mediallm-0.0.1.tar.gz.
File metadata
- Download URL: mediallm-0.0.1.tar.gz
- Upload date:
- Size: 162.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
877df186a5d5ba9c069f1e0d5539b641b59977a8999e1269438756dbd9b72724
|
|
| MD5 |
cd79a7805b97f3a6003b7183586f9097
|
|
| BLAKE2b-256 |
bc6c0b9888ea3d5bf6aacd70141f81284fb3ee2d1e3623353c036a281387a9b5
|
Provenance
The following attestation bundles were made for mediallm-0.0.1.tar.gz:
Publisher:
publish.yml on iamarunbrahma/mediallm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mediallm-0.0.1.tar.gz -
Subject digest:
877df186a5d5ba9c069f1e0d5539b641b59977a8999e1269438756dbd9b72724 - Sigstore transparency entry: 453269249
- Sigstore integration time:
-
Permalink:
iamarunbrahma/mediallm@71f1b8cf24229b93fad3fed65dd53afdae674457 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/iamarunbrahma
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@71f1b8cf24229b93fad3fed65dd53afdae674457 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file mediallm-0.0.1-py3-none-any.whl.
File metadata
- Download URL: mediallm-0.0.1-py3-none-any.whl
- Upload date:
- Size: 110.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c44ffa4cecddc09e4e3b799e61c5ad25dfcb877ddc6d6614ef8415b3a97205e1
|
|
| MD5 |
d28f168dd7dc41ae66baa218a66a5df9
|
|
| BLAKE2b-256 |
0ff4b19eb6580a05e292e5322d7cc707e6e02da111c061781cfa5919e52d3294
|
Provenance
The following attestation bundles were made for mediallm-0.0.1-py3-none-any.whl:
Publisher:
publish.yml on iamarunbrahma/mediallm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mediallm-0.0.1-py3-none-any.whl -
Subject digest:
c44ffa4cecddc09e4e3b799e61c5ad25dfcb877ddc6d6614ef8415b3a97205e1 - Sigstore transparency entry: 453269260
- Sigstore integration time:
-
Permalink:
iamarunbrahma/mediallm@71f1b8cf24229b93fad3fed65dd53afdae674457 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/iamarunbrahma
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@71f1b8cf24229b93fad3fed65dd53afdae674457 -
Trigger Event:
workflow_dispatch
-
Statement type: