> ## Documentation Index
> Fetch the complete documentation index at: https://trigger.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Media processing workflows

> Learn how to use Trigger.dev for media processing including video transcoding, image optimization, audio transformation, and document conversion.

## Overview

Build media processing pipelines that handle large files and long-running operations. Process videos, images, audio, and documents with automatic retries, progress tracking, and no timeout limits.

## Featured examples

> [card] [FFmpeg video processing](https://trigger.dev/docs/guides/examples/ffmpeg-video-processing.md)
>
> Process videos and upload results to R2 storage using FFmpeg.

> [card] [Product image generator](https://trigger.dev/docs/guides/example-projects/product-image-generator.md)
>
> Transform product photos into professional marketing images using Replicate.

> [card] [LibreOffice PDF conversion](https://trigger.dev/docs/guides/examples/libreoffice-pdf-conversion.md)
>
> Convert documents to PDF using LibreOffice.

## Benefits of using Trigger.dev for media processing workflows

**Process multi-hour videos without timeouts:** Transcode videos, extract frames, or run CPU-intensive operations for hours. No execution time limits.

**Stream progress to users in real-time:** Show processing status updating live in your UI. Users see exactly where encoding is and how long remains.

**Parallel processing with resource control:** Process hundreds of files simultaneously with configurable concurrency limits. Control resource usage without overwhelming infrastructure.

## Example workflow patterns

> [tab] Video transcode
>
> Simple video transcoding pipeline. Downloads video from storage, batch triggers parallel transcoding to multiple formats and thumbnail extraction, uploads all results.
>
> ```mermaid theme={"theme":"css-variables"}
> graph TB
>     A[processVideo] --> B[downloadFromStorage]
>     B --> C[batchTriggerAndWait]
>
>     C --> D[transcodeToHD]
>     C --> E[transcodeToSD]
>     C --> F[extractThumbnail]
>
>     D --> G[uploadToStorage]
>     E --> G
>     F --> G
> ```

> [tab] Adaptive video processing
>
> **Router + Coordinator pattern**. Analyzes video metadata to determine source resolution, routes to appropriate transcoding preset, batch triggers parallel post-processing for thumbnails, preview clips, and chapter detection.
>
> ```mermaid theme={"theme":"css-variables"}
> graph TB
>     A[processVideoUpload] --> B[analyzeMetadata]
>     B --> C{Source<br/>Resolution?}
>
>     C -->|4K Source| D[transcode4K]
>     C -->|HD Source| E[transcodeHD]
>     C -->|SD Source| F[transcodeSD]
>
>     D --> G[coordinatePostProcessing]
>     E --> G
>     F --> G
>
>     G --> H[batchTriggerAndWait]
>     H --> I[extractThumbnails]
>     H --> J[generatePreview]
>     H --> K[detectChapters]
>
>     I --> L[uploadToStorage]
>     J --> L
>     K --> L
>
>     L --> M[notifyComplete]
> ```

> [tab] Smart image optimization
>
> **Router + Coordinator pattern**. Analyzes image content to detect type, routes to specialized processing (background removal for products, face detection for portraits, scene analysis for landscapes), upscales with AI, batch triggers parallel variant generation.
>
> ```mermaid theme={"theme":"css-variables"}
> graph TB
>     A[processImageUpload] --> B[analyzeContent]
>     B --> C{Content<br/>Type?}
>
>     C -->|Product| D[removeBackground]
>     C -->|Portrait| E[detectFaces]
>     C -->|Landscape| F[analyzeScene]
>
>     D --> G[upscaleWithAI]
>     E --> G
>     F --> G
>
>     G --> H[batchTriggerAndWait]
>     H --> I[generateWebP]
>     H --> J[generateThumbnails]
>     H --> K[generateSocialCrops]
>
>     I --> L[uploadToStorage]
>     J --> L
>     K --> L
> ```

> [tab] Podcast production
>
> **Coordinator pattern**. Pre-processes raw audio with noise reduction and speaker diarization, batch triggers parallel tasks for transcription (Deepgram), audio enhancement, and chapter detection, aggregates results to generate show notes and publish.
>
> ```mermaid theme={"theme":"css-variables"}
> graph TB
>     A[processAudioUpload] --> B[cleanAudio]
>     B --> C[coordinateProcessing]
>
>     C --> D[batchTriggerAndWait]
>     D --> E[transcribeWithDeepgram]
>     D --> F[enhanceAudio]
>     D --> G[detectChapters]
>
>     E --> H[generateShowNotes]
>     F --> H
>     G --> H
>
>     H --> I[publishToPlatforms]
> ```

> [tab] Document extraction with approval
>
> **Router pattern with human-in-the-loop**. Detects file type and routes to appropriate processor, classifies document with AI to determine type (invoice/contract/receipt), extracts structured data fields, optionally pauses with wait.forToken for human approval.
>
> ```mermaid theme={"theme":"css-variables"}
> graph TB
>     A[processDocumentUpload] --> B[detectFileType]
>
>     B -->|PDF| C[extractText]
>     B -->|Word/Excel| D[convertToPDF]
>     B -->|Image| E[runOCR]
>
>     C --> F[classifyDocument]
>     D --> F
>     E --> F
>
>     F -->|Invoice| G[extractLineItems]
>     F -->|Contract| H[extractClauses]
>     F -->|Receipt| I[extractExpenses]
>
>     G --> J{Needs<br/>Review?}
>     H --> J
>     I --> J
>
>     J -->|Yes| K[wait.forToken approval]
>     J -->|No| L[processAndIntegrate]
>     K --> L
> ```

## Featured use cases

> [card] [Data processing & ETL workflows](https://trigger.dev/docs/guides/use-cases/data-processing-etl.md)
>
> Build complex data pipelines that process large datasets without timeouts.

> [card] [Media processing workflows](https://trigger.dev/docs/guides/use-cases/media-processing.md)
>
> Batch process videos, images, audio, and documents with no execution time limits.

> [card] [AI media generation workflows](https://trigger.dev/docs/guides/use-cases/media-generation.md)
>
> Generate images, videos, audio, documents and other media using AI models.

> [card] [Marketing workflows](https://trigger.dev/docs/guides/use-cases/marketing.md)
>
> Build drip campaigns, create marketing content, and orchestrate multi-channel campaigns.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.