Communitygithub.com

AI 多模態處理

使用 Google Gemini API 分析圖像、音訊、影片,並生成圖像與影片。支援視覺分析、轉錄、OCR、設計萃取等多模態 AI 任務。

AI 多模態處理 是什麼?

這是一個基於 Google Gemini API 開發的 AI 多模態處理技能,能夠分析音訊、圖像、影片與文件,並生成圖像 (Imagen 4) 與影片 (Veo 3)。它提供了一個 CLI 指揮程式 (`gemini_batch_process.py`) 處理轉錄、分析、萃取、生成等任務,並內建媒體優化工具 (`media_optimizer.py`),確保檔案符合 Gemini 的限制。支援多 API Key 自動輪換,當遇到速率限制時會自動切換金鑰,並有 60 秒冷卻機制。該技能建議使用 `gemini-2.5-flash` 模型進行一般分析,並提供詳細的參考文件說明圖片、音訊、影片的處理最佳實務。對於長於 15 分鐘的音訊或影片,建議分割後再進行轉錄以避免輸出截斷。

相容平台✓Claude Code~Codex CLI~Cursor✓Gemini CLI✓OpenCode
npx skills add https://github.com/majiayu000/claude-skill-registry-data/tree/HEAD/ai-ml/ai-multimodal-hoanghd218-landing-page-ai-kien-2

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

AI 多模態處理 是做什麼的?

使用 Google Gemini 的多模態 API 處理音訊、圖像、影片、文件,並生成圖像與影片。

設定

export GEMINI_API_KEY="your-key"  # 從 https://aistudio.google.com/apikey 取得
pip install google-genai python-dotenv pillow

API 金鑰輪換(選用)

若使用量較高或遇到速率限制,可設定多組 API 金鑰:

# 主要金鑰(必填)
export GEMINI_API_KEY="key1"

# 其他金鑰供輪換(選填)
export GEMINI_API_KEY_2="key2"
export GEMINI_API_KEY_3="key3"

或是在 .env 檔案中設定:

GEMINI_API_KEY=key1
GEMINI_API_KEY_2=key2
GEMINI_API_KEY_3=key3

功能特色:

  • 遇到速率限制錯誤 (429/RESOURCE_EXHAUSTED) 時自動輪換
  • 每次速率限制後金鑰有 60 秒冷卻時間
  • 使用 --verbose 旗標可記錄輪換事件
  • 向後相容:單一金鑰仍可正常運作

快速開始

驗證設定:python scripts/check_setup.py 分析媒體:python scripts/gemini_batch_process.py --files <檔案> --task <analyze|transcribe|extract>

  • 提示:當要求分析圖像時,請先檢查 gemini 指令是否可用。若可用,則使用 echo "<分析圖像的提示>" | gemini -y -m <gemini.model> 指令(模型名稱從 .opencode/.ck.json 中的 gemini.model 讀取)。若 gemini 指令不可用,則使用 python scripts/gemini_batch_process.py --files <檔案> --task analyze 指令。 生成內容:python scripts/gemini_batch_process.py --task <generate|generate-video> --prompt "描述"

標準輸入支援:可直接透過標準輸入管道傳入檔案(自動偵測 PNG/JPG/PDF/WAV/MP3)。

  • cat image.png | python scripts/gemini_batch_process.py --task analyze --prompt "描述這張圖"
  • python scripts/gemini_batch_process.py --files image.png --task analyze(傳統方式)

模型

  • 圖像生成:imagen-4.0-generate-001(標準)、imagen-4.0-ultra-generate-001(品質)、imagen-4.0-fast-generate-001(速度)
  • 影片生成:veo-3.1-generate-preview(8 秒片段含音訊)
  • 分析:gemini-2.5-flash(建議)、gemini-2.5-pro(進階)

指令碼

  • gemini_batch_process.py:CLI 指揮程式,支援 transcribe|analyze|extract|generate|generate-video 任務。自動解析 API 金鑰、為各任務挑選合適預設模型、串流內嵌檔案或使用 File API,並儲存結構化輸出(文字/JSON/CSV/markdown 以及生成的資產),適合 Imagen 4 + Veo 工作流程。
  • media_optimizer.py:基於 ffmpeg/Pillow 的前置處理工具,可壓縮/調整大小/轉換音訊、圖像與影片輸入,強制符合目標大小/位元率,將長片段分割為每小時區塊,並批次處理目錄,確保媒體檔案符合 Gemini 限制。
  • document_converter.py:Gemini 驅動的文件轉換器,可上傳 PDF/圖像/Office 文件,套用保留 Markdown 格式的提示,批次處理多個檔案,在 docs/assets 下自動命名輸出,並提供 CLI 旗標控制模型、提示、自動命名與詳細記錄。
  • check_setup.py:互動式就緒檢查工具,驗證目錄結構、集中式環境變數解析器、所需 Python 相依套件、以及 GEMINI_API_KEY 的可用性與格式,接著執行即時 Gemini API 呼叫,若發現問題則印出修復指示。

使用 --help 查看各項選項。

參考資料

載入以下檔案取得詳細指引:

主題檔案說明
音樂references/music-generation.mdLyria RealTime API 用於背景音樂生成、風格提示、即時控制、與影片製作整合。
音訊references/audio-processing.md音訊格式與限制、轉錄(時間戳記、發話者、段落)、非語音分析、File API 與內嵌輸入比較、TTS 模型、最佳實務、成本與 Token 計算,以及具體的會議/播客/訪談範例。
圖像references/vision-understanding.md視覺能力概覽、支援的格式與模型、字幕生成/分類/VQA、偵測與分割、OCR 與文件閱讀、多圖像工作流程、結構化 JSON 輸出、Token 成本、最佳實務,以及常見的產品/螢幕截圖/圖表/場景使用案例。
圖像生成references/image-generation.mdImagen 4 與 Gemini 圖像模型概覽、generate_images 與 generate_content API 比較、長寬比與成本、文字/圖像/兩者兼有的模態、編輯與合成、風格與品質控制、安全設定、最佳實務、故障排除,以及常見的行銷/概念藝術/UI 情境。
影片references/video-analysis.md影片分析能力與支援格式、模型/上下文選擇、本機/內嵌/YouTube 輸入、剪輯與 FPS 控制、多影片比較、時間性問答與場景偵測、結合視覺上下文的轉錄、Token 與成本指引,以及最佳化/最佳實務模式。
影片生成references/video-generation.mdVeo 模型矩陣、文字轉影片與圖像轉影片快速入門、多參考與延伸流程、攝影機與時間控制、設定(解析度、長寬比、音訊、安全)、提示設計模式、效能建議、限制、故障排除與成本估算。

限制

格式:音訊 (WAV/MP3/AAC, 9.5 小時)、圖像 (PNG/JPEG/WEBP, 3600 張)、影片 (MP4/MOV, 6 小時)、PDF (1000 頁) 大小:內嵌 20MB,File API 2GB 重要事項:

  • 若要生成音訊轉錄稿,且音訊長度超過 15 分鐘,由於 Gemini API 回應的輸出 Token 限制,轉錄稿常會被截斷。為取得完整轉錄稿,需將音訊分割成較小的區塊(每區塊最多 15 分鐘),然後分別轉錄每個區段,最後合併成完整的轉錄稿。
  • 若要生成影片轉錄稿,且影片長度超過 15 分鐘,請使用 ffmpeg 從影片中擷取音訊,將音訊截短至 15 分鐘,轉錄所有音訊區段,再將各區段轉錄稿合併為一份。 轉錄輸出要求:
  • 格式:Markdown
  • 後設資料:持續時間、檔案大小、生成日期、說明、檔案名稱、涵蓋主題等。
  • 各部分:起訖時間(例如 00:00-00:15)、音訊區塊名稱、轉錄稿、狀態等。
  • 轉錄稿格式:
    [HH:MM:SS -> HH:MM:SS] 轉錄內容
    [HH:MM:SS -> HH:MM:SS] 轉錄內容
    ...
    

資源

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

majiayu000/claude-skill-registry-data

Edit existing BMAD agents while maintaining compliance

majiayu000/claude-skill-registry-data

Edit existing BMAD agents while maintaining compliance

majiayu000/claude-skill-registry-data

Edit existing BMAD modules while maintaining coherence

majiayu000/claude-skill-registry-data

Edit existing BMAD modules while maintaining coherence

majiayu000/claude-skill-registry-data

Analyzes current state and user query to answer BMad questions or recommend the next workflow or agent. Use when user says what should I do next, what do I do now, or asks a question about BMad

majiayu000/claude-skill-registry-data

Build AI agents with Google ADK Python (Agent Development Kit). Use for multi-agent systems, workflow agents (sequential/parallel/loop), Vertex AI deployment, tool integration, human-in-the-loop.

majiayu000/claude-skill-registry-data

Build AI agents with Google ADK Python (Agent Development Kit). Use for multi-agent systems, workflow agents (sequential/parallel/loop), Vertex AI deployment, tool integration, human-in-the-loop.

majiayu000/claude-skill-registry-data

Portfolio allocation and rebalancing optimizer. Manages asset allocation across stocks/cash/bonds, performs periodic rebalancing, and ensures diversification according to market regime and risk tolerance.

majiayu000/claude-skill-registry-data

Create a hilarious and ultra-realistic video of an anthropomorphic animal acting like a human vlogger in a real-world setting.

majiayu000/claude-skill-registry-data

Speech-to-text transcription and translation via OpenAI Audio API -- models, response formats, timestamps, prompting, streaming, chunking, and diarization

majiayu000/claude-skill-registry-data

This skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.

majiayu000/claude-skill-registry-data

小省导购员数字人带货版即梦视频提示词生成系统,基于四大智能体协同(提示词生成师、质量管控师、知识库运维师、跨环节适配师),按照"主体+运动+场景+(镜头语言+光影+氛围)"公式输出中英文双版提示词,适配5s短视频。确保人物一致性、视觉连贯性、情绪连贯性,支持知识库智能复用和跨工具适配(Suno音乐、AI绘画),为数字人带货视频提供高质量提示词生成服务。

majiayu000/claude-skill-registry-data

Upload and manage files using Google Gemini File API via scripts/. Use for uploading images, audio, video, PDFs, and other files for use with Gemini models. Supports file upload, status checking, and file management. Triggers on "upload file", "file API", "upload image", "upload PDF", "upload video", "file management".

majiayu000/claude-skill-registry-data

Analyze images/audio/video with Gemini API (better vision than Claude). Generate images (Imagen 4), videos (Veo 3). Use for vision analysis, transcription, OCR, design extraction, multimodal AI.

majiayu000/claude-skill-registry-data

Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

majiayu000/claude-skill-registry-data

Conduct domain and industry research. Use when the user says "lets create a research report on [domain or industry]

majiayu000/claude-skill-registry-data

Conduct market research on competition and customers. Use when the user says "create a market research report about [business idea]".

majiayu000/claude-skill-registry-data

Conduct technical research on technologies and architecture. Use when the user says "create a technical research report on [topic]".

majiayu000/claude-skill-registry-data

Understand an existing codebase through systematic exploration

majiayu000/claude-skill-registry-data

Builds, edit or validate Agent Skill through conversational discovery. Use when the user requests to "Create an Agent", "Optimize an Agent" or "Edit an Agent".

相關技能