ai-medialens
AI-MediaLens - OpenRouter 経由の AI エージェント向けメディア解析
Cline が読めないもの(動画、音声、PDF ファイル)のギャップを埋めます。 ファイルを OpenRouter API に直接送信し、マルチモーダルモデルにルーティングします(PDF はあらゆるモデル向けに解析されます)。
Cline 用のMCP サーバー、スタンドアロンのCLI、インポート可能なPython モジュールとして動作します - すべて 1 つのファイルから。
クイックスタート
git clone https://github.com/Alihkhawaher/ai-medialens.git
cd ai-medialens
pip install mcp # only needed for MCP mode
python openrouter_media.py setup # configure API key + register in Clinesetup を対話的に実行:
OpenRouter キーを
.envに保存ai-medialensMCP サーバーを Cline のグローバル設定に登録
Related MCP server: mcp-multivision-server
対応入力(拡張子で自動検出)
タイプ | 拡張子 | OpenRouter コンテンツパート |
動画 |
|
|
音声 |
|
|
|
| |
画像 |
|
|
使用方法
CLI
# Full file
python openrouter_media.py video.mp4 -p "Transcribe all spoken Arabic word-for-word"
# Only seconds 5-20 (trimmed locally; ffmpeg auto-downloaded on first use)
python openrouter_media.py video.mp4 -p "What happens here?" --start 5 --end 20
# Different model / explicit key
python openrouter_media.py doc.pdf -p "Summarize" -m z-ai/glm-5.3-flash -k sk-or-v1-...
# Scanned PDF -> real OCR (billed per page by OpenRouter)
python openrouter_media.py scan.pdf -p "Extract all text" --pdf-engine mistral-ocr
# Speech-to-text (works on video files too - audio track extracted locally)
python openrouter_media.py lecture.mp4 --stt --language ar
# SRT subtitles with timestamps
python openrouter_media.py lecture.mp4 --stt --srt > lecture.srt
# Find models that accept video input, with prices
python openrouter_media.py --list-models video
# Preview request shape without sending (no API cost)
python openrouter_media.py video.mp4 -p "test" --dry-runMCP(Cline から)
Cline がツールをネイティブに呼び出します:
use_mcp_tool: server=ai-medialens, tool=analyze_media
arguments: { "path": "...", "prompt": "...", "start": "5", "end": "20" }
use_mcp_tool: server=ai-medialens, tool=transcribe_audio
arguments: { "path": "...", "language": "ar", "srt": false }Python モジュールとして
from openrouter_media import analyze
text = analyze("video.mp4", "Transcribe all speech.")
resp = analyze("doc.pdf", "Summarize.", raw=True)API キーの解決順序
-k/--keyフラグOR_KEY環境変数OPENROUTER_API_KEY環境変数スクリプトの隣にある
.envファイル(.env.example を参照)
ffmpeg と時間範囲のトリミング
--start/--end はアップロード前にメディアをローカルでトリミングします(OpenRouter にはネイティブの範囲パラメータがありません)。ffmpeg は次の順序で解決されます:
同梱の
bin\ffmpeg.exe(そこに配置した場合)%LOCALAPPDATA%\ai-medialens\bin\ffmpeg.exeにキャッシュされたコピーPATH 上の ffmpeg
自動ダウンロード(約 80 MB の静的ビルド、1 回限り、Windows)
注: トリミングは -c copy を使用します(高速ですが、キーフレームでカットされます。正確なカットには再エンコードが必要です)。
モデル
デフォルト: qwen/qwen3.7-flash(入力 $0.03/M、出力 $0.13/M)— 現在、完全な動画入力対応を備えた最も安価な OpenRouter モデルです。
その他の動画対応の優れたオプション(現在の価格は --list-models video で確認してください):
モデル | 入力 /M | 出力 /M |
| $0.03 | $0.13 |
| $0.075 | $0.25 |
| $0.425 | $2.55 |
-m / model= で任意の OpenRouter モデルスラッグが使用可能です — 新しいリリースも登場次第対応します。
PDF 解析エンジン
PDF はローカルまたは OpenRouter によるサーバーサイドで解析されます:
エンジン | 動作 | コスト |
(デフォルト) | 埋め込みテキストレイヤーからのサーバーサイドのテキスト抽出 | 無料 |
| PyMuPDF によるローカル解析( | 無料 |
| ページ画像に対するサーバーサイドの本格的な OCR — スキャン/画像のみの PDF を読み取ります | ページごとに課金 |
| ネイティブファイル入力対応モデルに生の PDF を転送 | 無料 |
local が推奨です: OpenRouter のパーサーレート制限に達することがなく、デジタル PDF とスキャン PDF の両方を追加コストゼロで処理できます。
音声認識(STT)
OpenRouter 専用の /audio/transcriptions エンドポイント(Whisper クラスのモデル)を使用します。デフォルトモデル: openai/whisper-large-v3-turbo。その他のオプション: openai/gpt-4o-transcribe、openai/gpt-4o-mini-transcribe、microsoft/mai-transcribe-1.5、openai/whisper-large-v3。
パイプラインの堅牢化(本番の YouTube→字幕システムからの教訓):
任意の音声/動画入力 → ffmpeg で Opus 32kbps/16kHz/モノラル に変換(WAV より 8 倍小さい、全プロバイダーが対応); 動画トラックは除去
長いメディアは自動的に 6 分チャンク に分割(OpenRouter にはリクエストごとに約 60 秒の上流タイムアウトがあります)
各チャンクを再マルチプレックスして欠落した Ogg EOS ページを追加(ffmpeg のセグメントマクサーはこれを省略します; OpenRouter のパーサーはこれがないストリームを拒否します)
--srtはverbose_jsonセグメント経由でタイムスタンプ付きの SRT 字幕を返し、チャンク間で正しくオフセットされます注:
whisper-large-v3は速度変更された音声で文字化けした出力を生成します;mai-transcribe-1.5はそれを許容します
注意事項
大きなファイルはメモリ内で base64 エンコードされます - 非常に大きな動画はプロバイダーのアップロード制限に達する可能性があります。
シークレットは安全です:
.envは gitignore されており、コミットされることはありません。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityAmaintenanceGive your AI assistant eyes and ears — analyze any video, audio, or image, entirely on your machine.2612Apache 2.0
- AlicenseAqualityBmaintenanceProvides image and video analysis capabilities for LLMs, with local preprocessing (ffmpeg/OpenCV) and any OpenAI-compatible vision model for understanding and Q&A.4MIT
- AlicenseNot gradedqualityBmaintenanceEnables text-only coding models to read images, PDFs, presentations, spreadsheets, and other non-text files through a single analyze_media tool, combining local document extraction, OCR, and optional vision models with clear evidence labeling.1MIT
- AlicenseNot gradedqualityAmaintenanceEnables text-only AI coding agents to analyze images and videos via vision-capable models (Gemini, Grok, OpenRouter), returning text descriptions for reasoning.36MIT
Related MCP Connectors
Multimodal video analysis MCP — transcription, vision, and OCR for any video URL.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Transform video, audio and images, and generate media from prompts. FFmpeg, captions, models.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Alihkhawaher/ai-medialens'
If you have feedback or need assistance with the MCP directory API, please join our Discord server