AI Multimodal Processing Skill
Process audio, images, videos, documents, and generate images using Google Gemini's multimodal API. Unified interface for all multimedia content understanding and generation.
Core Capabilities
Audio Processing
- Transcription with timestamps (up to 9.5 hours)
- Audio summarization and analysis
- Speech understanding and speaker identification
- Music and environmental sound analysis
- Text-to-speech generation with controllable voice
Image Understanding
- Image captioning and description
- Object detection with bounding boxes (2.0+)
- Pixel-level segmentation (2.5+)
- Visual question answering
- Multi-image comparison (up to 3,600 images)
- OCR and text extraction
Video Analysis
- Scene detection and summarization
- Video Q&A with temporal understanding
- Transcription with visual descriptions
- YouTube URL support
- Long video processing (up to 6 hours)
- Frame-level analysis
Document Extraction
- Native PDF vision processing (up to 1,000 pages)
- Table and form extraction
- Chart and diagram analysis
- Multi-page document understanding
- Structured data output (JSON schema)
- Format conversion (PDF to HTML/JSON)
Image Generation
- Text-to-image generation
- Image editing and modification
- Multi-image composition (up to 3 images)
- Iterative refinement
- Multiple aspect ratios (1:1, 16:9, 9:16, 4:3, 3:4)
- Controllable style and quality
Capability Matrix
| Task |
Audio |
Image |
Video |
Document |
Generation |
| Transcription |
✓ |
- |
✓ |
- |
- |
| Summarization |
✓ |
✓ |
✓ |
✓ |
- |
| Q&A |
✓ |
✓ |
✓ |
✓ |
- |
| Object Detection |
- |
✓ |
✓ |
- |
- |
| Text Extraction |
- |
✓ |
- |
✓ |
- |
| Structured Output |
✓ |
✓ |
✓ |
✓ |
- |
| Creation |
TTS |
- |
- |
- |
✓ |
| Timestamps |
✓ |
- |
✓ |
- |
- |
| Segmentation |
- |
✓ |
- |
- |
- |
Model Selection Guide
Gemini 2.5 Series (Recommended)
- gemini-2.5-pro: Highest quality, all features, 1M-2M context
- gemini-2.5-flash: Best balance, all features, 1M-2M context
- gemini-2.5-flash-lite: Lightweight, segmentation support
- gemini-2.5-flash-image: Image generation only
Gemini 2.0 Series
- gemini-2.0-flash: Fast processing, object detection
- gemini-2.0-flash-lite: Lightweight option
Feature Requirements
- Segmentation: Requires 2.5+ models
- Object Detection: Requires 2.0+ models
- Multi-video: Requires 2.5+ models
- Image Generation: Requires flash-image model
Context Windows
- 2M tokens: ~6 hours video (low-res) or ~2 hours (default)
- 1M tokens: ~3 hours video (low-res) or ~1 hour (default)
- Audio: 32 tokens/second (1 min = 1,920 tokens)
- PDF: 258 tokens/page (fixed)
- Image: 258-1,548 tokens based on size
Quick Start
Prerequisites
API Key Setup: Supports both Google AI Studio and Vertex AI.
The skill checks for GEMINI_API_KEY in this order:
- Process environment:
export GEMINI_API_KEY="your-key"
- Project root:
.env
.claude/.env
.claude/skills/.env
.claude/skills/ai-multimodal/.env
Get API key: https://aistudio.google.com/apikey
For Vertex AI:
export GEMINI_USE_VERTEX=true
export VERTEX_PROJECT_ID=your-gcp-project-id
export VERTEX_LOCATION=us-central1 # Optional
Install SDK:
pip install google-genai python-dotenv pillow
Common Patterns
Transcribe Audio:
python scripts/gemini_batch_process.py \
--files audio.mp3 \
--task transcribe \
--model gemini-2.5-flash
Analyze Image:
python scripts/gemini_batch_process.py \
--files image.jpg \
--task analyze \
--prompt "Describe this image" \
--model gemini-2.5-flash
Process Video:
python scripts/gemini_batch_process.py \
--files video.mp4 \
--task analyze \
--prompt "Summarize key points with timestamps" \
--model gemini-2.5-flash
Extract from PDF:
python scripts/gemini_batch_process.py \
--files document.pdf \
--task extract \
--prompt "Extract table data as JSON" \
--format json
Generate Image:
python scripts/gemini_batch_process.py \
--task generate \
--prompt "A futuristic city at sunset" \
--model gemini-2.5-flash-image \
--aspect-ratio 16:9
Optimize Media:
# Prepare large video for processing
python scripts/media_optimizer.py \
--input large-video.mp4 \
--output optimized-video.mp4 \
--target-size 100MB
# Batch optimize multiple files
python scripts/media_optimizer.py \
--input-dir ./videos \
--output-dir ./optimized \
--quality 85
Convert Documents:
# Convert to PDF
python scripts/document_converter.py \
--input document.docx \
--output document.pdf
# Extract pages
python scripts/document_converter.py \
--input large.pdf \
--output chapter1.pdf \
--pages 1-20
Supported Formats
Audio
- WAV, MP3, AAC, FLAC, OGG Vorbis, AIFF
- Max 9.5 hours per request
- Auto-downsampled to 16 Kbps mono
Images
- PNG, JPEG, WEBP, HEIC, HEIF
- Max 3,600 images per request
- Resolution: ≤384px = 258 tokens, larger = tiled
Video
- MP4, MPEG, MOV, AVI, FLV, MPG, WebM, WMV, 3GPP
- Max 6 hours (low-res) or 2 hours (default)
- YouTube URLs supported (public only)
Documents
- PDF only for vision processing
- Max 1,000 pages
- TXT, HTML, Markdown supported (text-only)
Size Limits
- Inline: <20MB total request
- File API: 2GB per file, 20GB project quota
- Retention: 48 hours auto-delete
Reference Navigation
For detailed implementation guidance, see:
Audio Processing
references/audio-processing.md - Transcription, analysis, TTS
- Timestamp handling and segment analysis
- Multi-speaker identification
- Non-speech audio analysis
- Text-to-speech generation
Image Understanding
references/vision-understanding.md - Captioning, detection, OCR
- Object detection and localization
- Pixel-level segmentation
- Visual question answering
- Multi-image comparison
Video Analysis
references/video-analysis.md - Scene detection, temporal understanding
- YouTube URL processing
- Timestamp-based queries
- Video clipping and FPS control
- Long video optimization
Document Extraction
references/document-extraction.md - PDF processing, structured output
- Table and form extraction
- Chart and diagram analysis
- JSON schema validation
- Multi-page handling
Image Generation
references/image-generation.md - Text-to-image, editing
- Prompt engineering strategies
- Image editing and composition
- Aspect ratio selection
- Safety settings
Cost Optimization
Token Costs
Input Pricing:
- Gemini 2.5 Flash: $1.00/1M input, $0.10/1M output
- Gemini 2.5 Pro: $3.00/1M input, $12.00/1M output
- Gemini 1.5 Flash: $0.70/1M input, $0.175/1M output
Token Rates:
- Audio: 32 tokens/second (1 min = 1,920 tokens)
- Video: ~300 tokens/second (default) or ~100 (low-res)
- PDF: 258 tokens/page (fixed)
- Image: 258-1,548 tokens based on size
TTS Pricing:
- Flash TTS: $10/1M tokens
- Pro TTS: $20/1M tokens
Best Practices
- Use
gemini-2.5-flash for most tasks (best price/performance)
- Use File API for files >20MB or repeated queries
- Optimize media before upload (see
media_optimizer.py)
- Process specific segments instead of full videos
- Use lower FPS for static content
- Implement context caching for repeated queries
- Batch process multiple files in parallel
Rate Limits
Free Tier:
- 10-15 RPM (requests per minute)
- 1M-4M TPM (tokens per minute)
- 1,500 RPD (requests per day)
YouTube Limits:
- Free tier: 8 hours/day
- Paid tier: No length limits
- Public videos only
Storage Limits:
- 20GB per project
- 2GB per file
- 48-hour retention
Error Handling
Common errors and solutions:
- 400: Invalid format/size - validate before upload
- 401: Invalid API key - check configuration
- 403: Permission denied - verify API key restrictions
- 404: File not found - ensure file uploaded and active
- 429: Rate limit exceeded - implement exponential backoff
- 500: Server error - retry with backoff
Scripts Overview
All scripts support unified API key detection and error handling:
gemini_batch_process.py: Batch process multiple media files
- Supports all modalities (audio, image, video, PDF)
- Progress tracking and error recovery
- Output formats: JSON, Markdown, CSV
- Rate limiting and retry logic
- Dry-run mode
media_optimizer.py: Prepare media for Gemini API
- Compress videos/audio for size limits
- Resize images appropriately
- Split long videos into chunks
- Format conversion
- Quality vs size optimization
document_converter.py: Convert documents to PDF
- Convert DOCX, XLSX, PPTX to PDF
- Extract page ranges
- Optimize PDFs for Gemini
- Extract images from PDFs
- Batch conversion support
Run any script with --help for detailed usage.
Resources
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: ai-multimodal-43description: Process and generate multimedia content using Google Gemini API. Capabilities include analyze audio files (transcription with timestamps, summarization, speech understanding, music/sound analysis up to 9.5 hours), understand images (captioning, object detection, OCR, visual Q&A, segmentation), process videos (scene detection, Q&A, temporal analysis, YouTube URLs, up to 6 hours), extract from documents (PDF tables, forms, charts, diagrams, multi-page), generate images (text-to-image, editing, composition, refinement). Use when working with audio/video files, analyzing images or screenshots, processing PDF documents, extracting structured data from media, creating images from text prompts, or implementing multimodal AI features. Supports multiple models (Gemini 2.5/2.0) with context windows up to 2M tokens. Use when this capability is needed.4---56# AI Multimodal Processing Skill78Process audio, images, videos, documents, and generate images using Google Gemini's multimodal API. Unified interface for all multimedia content understanding and generation.910## Core Capabilities1112### Audio Processing13- Transcription with timestamps (up to 9.5 hours)14- Audio summarization and analysis15- Speech understanding and speaker identification16- Music and environmental sound analysis17- Text-to-speech generation with controllable voice1819### Image Understanding20- Image captioning and description21- Object detection with bounding boxes (2.0+)22- Pixel-level segmentation (2.5+)23- Visual question answering24- Multi-image comparison (up to 3,600 images)25- OCR and text extraction2627### Video Analysis28- Scene detection and summarization29- Video Q&A with temporal understanding30- Transcription with visual descriptions31- YouTube URL support32- Long video processing (up to 6 hours)33- Frame-level analysis3435### Document Extraction36- Native PDF vision processing (up to 1,000 pages)37- Table and form extraction38- Chart and diagram analysis39- Multi-page document understanding40- Structured data output (JSON schema)41- Format conversion (PDF to HTML/JSON)4243### Image Generation44- Text-to-image generation45- Image editing and modification46- Multi-image composition (up to 3 images)47- Iterative refinement48- Multiple aspect ratios (1:1, 16:9, 9:16, 4:3, 3:4)49- Controllable style and quality5051## Capability Matrix5253| Task | Audio | Image | Video | Document | Generation |54|------|:-----:|:-----:|:-----:|:--------:|:----------:|55| Transcription | ✓ | - | ✓ | - | - |56| Summarization | ✓ | ✓ | ✓ | ✓ | - |57| Q&A | ✓ | ✓ | ✓ | ✓ | - |58| Object Detection | - | ✓ | ✓ | - | - |59| Text Extraction | - | ✓ | - | ✓ | - |60| Structured Output | ✓ | ✓ | ✓ | ✓ | - |61| Creation | TTS | - | - | - | ✓ |62| Timestamps | ✓ | - | ✓ | - | - |63| Segmentation | - | ✓ | - | - | - |6465## Model Selection Guide6667### Gemini 2.5 Series (Recommended)68- **gemini-2.5-pro**: Highest quality, all features, 1M-2M context69- **gemini-2.5-flash**: Best balance, all features, 1M-2M context70- **gemini-2.5-flash-lite**: Lightweight, segmentation support71- **gemini-2.5-flash-image**: Image generation only7273### Gemini 2.0 Series74- **gemini-2.0-flash**: Fast processing, object detection75- **gemini-2.0-flash-lite**: Lightweight option7677### Feature Requirements78- **Segmentation**: Requires 2.5+ models79- **Object Detection**: Requires 2.0+ models80- **Multi-video**: Requires 2.5+ models81- **Image Generation**: Requires flash-image model8283### Context Windows84- **2M tokens**: ~6 hours video (low-res) or ~2 hours (default)85- **1M tokens**: ~3 hours video (low-res) or ~1 hour (default)86- **Audio**: 32 tokens/second (1 min = 1,920 tokens)87- **PDF**: 258 tokens/page (fixed)88- **Image**: 258-1,548 tokens based on size8990## Quick Start9192### Prerequisites9394**API Key Setup**: Supports both Google AI Studio and Vertex AI.9596The skill checks for `GEMINI_API_KEY` in this order:971. Process environment: `export GEMINI_API_KEY="your-key"`982. Project root: `.env`993. `.claude/.env`1004. `.claude/skills/.env`1015. `.claude/skills/ai-multimodal/.env`102103**Get API key**: https://aistudio.google.com/apikey104105**For Vertex AI**:106```bash107export GEMINI_USE_VERTEX=true108export VERTEX_PROJECT_ID=your-gcp-project-id109export VERTEX_LOCATION=us-central1 # Optional110```111112**Install SDK**:113```bash114pip install google-genai python-dotenv pillow115```116117### Common Patterns118119**Transcribe Audio**:120```bash121python scripts/gemini_batch_process.py \122 --files audio.mp3 \123 --task transcribe \124 --model gemini-2.5-flash125```126127**Analyze Image**:128```bash129python scripts/gemini_batch_process.py \130 --files image.jpg \131 --task analyze \132 --prompt "Describe this image" \133 --model gemini-2.5-flash134```135136**Process Video**:137```bash138python scripts/gemini_batch_process.py \139 --files video.mp4 \140 --task analyze \141 --prompt "Summarize key points with timestamps" \142 --model gemini-2.5-flash143```144145**Extract from PDF**:146```bash147python scripts/gemini_batch_process.py \148 --files document.pdf \149 --task extract \150 --prompt "Extract table data as JSON" \151 --format json152```153154**Generate Image**:155```bash156python scripts/gemini_batch_process.py \157 --task generate \158 --prompt "A futuristic city at sunset" \159 --model gemini-2.5-flash-image \160 --aspect-ratio 16:9161```162163**Optimize Media**:164```bash165# Prepare large video for processing166python scripts/media_optimizer.py \167 --input large-video.mp4 \168 --output optimized-video.mp4 \169 --target-size 100MB170171# Batch optimize multiple files172python scripts/media_optimizer.py \173 --input-dir ./videos \174 --output-dir ./optimized \175 --quality 85176```177178**Convert Documents**:179```bash180# Convert to PDF181python scripts/document_converter.py \182 --input document.docx \183 --output document.pdf184185# Extract pages186python scripts/document_converter.py \187 --input large.pdf \188 --output chapter1.pdf \189 --pages 1-20190```191192## Supported Formats193194### Audio195- WAV, MP3, AAC, FLAC, OGG Vorbis, AIFF196- Max 9.5 hours per request197- Auto-downsampled to 16 Kbps mono198199### Images200- PNG, JPEG, WEBP, HEIC, HEIF201- Max 3,600 images per request202- Resolution: ≤384px = 258 tokens, larger = tiled203204### Video205- MP4, MPEG, MOV, AVI, FLV, MPG, WebM, WMV, 3GPP206- Max 6 hours (low-res) or 2 hours (default)207- YouTube URLs supported (public only)208209### Documents210- PDF only for vision processing211- Max 1,000 pages212- TXT, HTML, Markdown supported (text-only)213214### Size Limits215- **Inline**: <20MB total request216- **File API**: 2GB per file, 20GB project quota217- **Retention**: 48 hours auto-delete218219## Reference Navigation220221For detailed implementation guidance, see:222223### Audio Processing224- `references/audio-processing.md` - Transcription, analysis, TTS225 - Timestamp handling and segment analysis226 - Multi-speaker identification227 - Non-speech audio analysis228 - Text-to-speech generation229230### Image Understanding231- `references/vision-understanding.md` - Captioning, detection, OCR232 - Object detection and localization233 - Pixel-level segmentation234 - Visual question answering235 - Multi-image comparison236237### Video Analysis238- `references/video-analysis.md` - Scene detection, temporal understanding239 - YouTube URL processing240 - Timestamp-based queries241 - Video clipping and FPS control242 - Long video optimization243244### Document Extraction245- `references/document-extraction.md` - PDF processing, structured output246 - Table and form extraction247 - Chart and diagram analysis248 - JSON schema validation249 - Multi-page handling250251### Image Generation252- `references/image-generation.md` - Text-to-image, editing253 - Prompt engineering strategies254 - Image editing and composition255 - Aspect ratio selection256 - Safety settings257258## Cost Optimization259260### Token Costs261**Input Pricing**:262- Gemini 2.5 Flash: $1.00/1M input, $0.10/1M output263- Gemini 2.5 Pro: $3.00/1M input, $12.00/1M output264- Gemini 1.5 Flash: $0.70/1M input, $0.175/1M output265266**Token Rates**:267- Audio: 32 tokens/second (1 min = 1,920 tokens)268- Video: ~300 tokens/second (default) or ~100 (low-res)269- PDF: 258 tokens/page (fixed)270- Image: 258-1,548 tokens based on size271272**TTS Pricing**:273- Flash TTS: $10/1M tokens274- Pro TTS: $20/1M tokens275276### Best Practices2771. Use `gemini-2.5-flash` for most tasks (best price/performance)2782. Use File API for files >20MB or repeated queries2793. Optimize media before upload (see `media_optimizer.py`)2804. Process specific segments instead of full videos2815. Use lower FPS for static content2826. Implement context caching for repeated queries2837. Batch process multiple files in parallel284285## Rate Limits286287**Free Tier**:288- 10-15 RPM (requests per minute)289- 1M-4M TPM (tokens per minute)290- 1,500 RPD (requests per day)291292**YouTube Limits**:293- Free tier: 8 hours/day294- Paid tier: No length limits295- Public videos only296297**Storage Limits**:298- 20GB per project299- 2GB per file300- 48-hour retention301302## Error Handling303304Common errors and solutions:305- **400**: Invalid format/size - validate before upload306- **401**: Invalid API key - check configuration307- **403**: Permission denied - verify API key restrictions308- **404**: File not found - ensure file uploaded and active309- **429**: Rate limit exceeded - implement exponential backoff310- **500**: Server error - retry with backoff311312## Scripts Overview313314All scripts support unified API key detection and error handling:315316**gemini_batch_process.py**: Batch process multiple media files317- Supports all modalities (audio, image, video, PDF)318- Progress tracking and error recovery319- Output formats: JSON, Markdown, CSV320- Rate limiting and retry logic321- Dry-run mode322323**media_optimizer.py**: Prepare media for Gemini API324- Compress videos/audio for size limits325- Resize images appropriately326- Split long videos into chunks327- Format conversion328- Quality vs size optimization329330**document_converter.py**: Convert documents to PDF331- Convert DOCX, XLSX, PPTX to PDF332- Extract page ranges333- Optimize PDFs for Gemini334- Extract images from PDFs335- Batch conversion support336337Run any script with `--help` for detailed usage.338339## Resources340341- [Audio API Docs](https://ai.google.dev/gemini-api/docs/audio)342- [Image API Docs](https://ai.google.dev/gemini-api/docs/image-understanding)343- [Video API Docs](https://ai.google.dev/gemini-api/docs/video-understanding)344- [Document API Docs](https://ai.google.dev/gemini-api/docs/document-processing)345- [Image Gen Docs](https://ai.google.dev/gemini-api/docs/image-generation)346- [Get API Key](https://aistudio.google.com/apikey)347- [Pricing](https://ai.google.dev/pricing)348349---350> Converted and distributed by [TomeVault](https://tomevault.io/claim/jackspace) — claim your Tome and manage your conversions.351<!-- tomevault:4.0:skill_md:2026-04-11 -->