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

# Remove Video Background Export Guide

> Choose the right export format for video background removal. Learn about H.264 MP4, VP9 WebM, ProRes MOV, and PNG sequences for optimal results.

## Export Formats Overview

Choose the export format that best fits your target platform and quality requirements:

> [card] 🎬 Standard Formats
>
> **H.264 MP4, VP9 WebM** - Universal compatibility

> [card] 🎯 Professional Formats
>
> **ProRes MOV, PNG Sequence** - Maximum quality

## Standard Formats

### H.264 MP4 (Recommended)

Universal compatibility with excellent compression:

```typescript Node.js theme={"dark"}
import { EncoderProfile } from '@videobgremover/sdk'

// High quality (default)
await comp.toFile('output.mp4', EncoderProfile.h264())

// Custom quality settings
await comp.toFile('hq.mp4', EncoderProfile.h264({ 
  crf: 18,        // Higher quality (lower CRF = better quality)
  preset: 'slow'  // Slower encoding, better compression
}))

// Fast encoding for testing
await comp.toFile('test.mp4', EncoderProfile.h264({ 
  crf: 28,           // Lower quality for speed
  preset: 'ultrafast' // Fastest encoding
}))
```

```python Python theme={"dark"}
from videobgremover import EncoderProfile

# High quality (default)
comp.to_file('output.mp4', EncoderProfile.h264())

# Custom quality settings
comp.to_file('hq.mp4', EncoderProfile.h264(
    crf=18,        # Higher quality (lower CRF = better quality)
    preset='slow'  # Slower encoding, better compression
))

# Fast encoding for testing
comp.to_file('test.mp4', EncoderProfile.h264(
    crf=28,           # Lower quality for speed
    preset='ultrafast' # Fastest encoding
))
```

### VP9 WebM

Excellent compression for web delivery:

```typescript Node.js theme={"dark"}
// VP9 WebM (excellent compression)
await comp.toFile('output.webm', EncoderProfile.vp9())

// Custom VP9 settings
await comp.toFile('web.webm', EncoderProfile.vp9({ 
  crf: 32,      // Good quality for web
  preset: 'fast' // Reasonable encoding speed
}))
```

```python Python theme={"dark"}
# VP9 WebM (excellent compression)
comp.to_file('output.webm', EncoderProfile.vp9())

# Custom VP9 settings
comp.to_file('web.webm', EncoderProfile.vp9(
    crf=32,      # Good quality for web
    preset='fast' # Reasonable encoding speed
))
```

## Professional Formats

### ProRes 4444 MOV

Highest quality for professional editing:

```typescript Node.js theme={"dark"}
// ProRes 4444 (highest quality, large files)
await comp.toFile('professional.mov', EncoderProfile.prores4444())

// Best for: Final Cut Pro, Premiere Pro, DaVinci Resolve
```

```python Python theme={"dark"}
# ProRes 4444 (highest quality, large files)
comp.to_file('professional.mov', EncoderProfile.prores_4444())

# Best for: Final Cut Pro, Premiere Pro, DaVinci Resolve
```

### PNG Sequence

Frame-by-frame output for maximum quality:

```typescript Node.js theme={"dark"}
// PNG sequence (one file per frame)
await comp.toFile('frames/frame_%04d.png', EncoderProfile.pngSequence())

// Custom frame rate
await comp.toFile('frames/frame_%04d.png', EncoderProfile.pngSequence({ 
  fps: 24  // 24 FPS output
}))

// Creates: frame_0001.png, frame_0002.png, frame_0003.png, ...
```

```python Python theme={"dark"}
# PNG sequence (one file per frame)
comp.to_file('frames/frame_%04d.png', EncoderProfile.png_sequence())

# Custom frame rate
comp.to_file('frames/frame_%04d.png', EncoderProfile.png_sequence(fps=24))

# Creates: frame_0001.png, frame_0002.png, frame_0003.png, ...
```

## Quality Settings

### Classic FFmpeg Parameters

The SDK uses standard FFmpeg encoder parameters for professional control:

#### CRF (Constant Rate Factor)

Controls quality vs file size trade-off (lower = higher quality):

| CRF | Quality | Use Case | Code Implementation |
| - | - | - | - |
| **12-18** | Excellent | Professional work, archival | `EncoderProfile.h264({ crf: 18 })` |
| **19-23** | High | General purpose, good balance | `EncoderProfile.h264({ crf: 23 })` |
| **24-28** | Good | Web delivery, smaller files | `EncoderProfile.h264({ crf: 28 })` |
| **29-35** | Acceptable | Very small files, previews | `EncoderProfile.h264({ crf: 32 })` |

#### Encoding Presets

Balance encoding speed vs compression efficiency:

| Preset | Speed | File Size | Use Case | FFmpeg Args |
| - | - | - | - | - |
| **ultrafast** | Fastest | Largest | Testing, previews | `-preset ultrafast` |
| **fast** | Fast | Large | Development | `-preset fast` |
| **medium** | Moderate | Moderate | General purpose | `-preset medium` |
| **slow** | Slow | Small | Final delivery | `-preset slow` |
| **veryslow** | Slowest | Smallest | Archival, maximum compression | `-preset veryslow` |

#### Codec Selection

Different codecs for different use cases:

* **H.264**: Universal compatibility (`-c:v libx264`)
* **VP9**: Web optimization (`-c:v libvpx-vp9`)
* **ProRes**: Professional editing (`-c:v prores_ks`)
* **PNG**: Frame sequences (`-c:v png`)

#### Pixel Formats

Control color space and transparency:

* **yuv420p**: Standard video (no alpha)
* **yuva420p**: Video with alpha channel
* **rgba**: PNG sequences with transparency

## Format Recommendations

### Choose by Use Case

> [accordion] 🌐 Web Delivery
>
> **Use H.264 MP4** - Universal browser support
>
> ```typescript theme={"dark"}
> EncoderProfile.h264({ crf: 28, preset: 'fast' })
> ```
>
> **Alternative**: VP9 WebM for better compression

> [accordion] 📱 Social Media
>
> **Use H.264 MP4** - Platform compatibility
>
> ```typescript theme={"dark"}
> EncoderProfile.h264({ crf: 25, preset: 'medium' })
> ```
>
> Consider platform-specific requirements (Instagram, TikTok, etc.)

> [accordion] 🎬 Professional Editing
>
> **Use ProRes 4444 MOV** - Highest quality
>
> ```typescript theme={"dark"}
> EncoderProfile.prores4444()
> ```
>
> Perfect for Final Cut Pro, Premiere Pro, DaVinci Resolve

> [accordion] 🎯 Frame Analysis
>
> **Use PNG Sequence** - Individual frames
>
> ```typescript theme={"dark"}
> EncoderProfile.pngSequence({ fps: 30 })
> ```
>
> Perfect for GIF creation, frame-by-frame work

## Multiple Export Example

Export the same composition in different formats:

```typescript Node.js theme={"dark"}
// Create composition once
const comp = new Composition(background)
comp.add(video1, 'main').at(Anchor.CENTER)
comp.add(video2, 'pip').at(Anchor.TOP_RIGHT).size(SizeMode.CANVAS_PERCENT, { percent: 25 })

// Export in multiple formats
await comp.toFile('web_delivery.mp4', EncoderProfile.h264({ crf: 28 }))
await comp.toFile('high_quality.mp4', EncoderProfile.h264({ crf: 18, preset: 'slow' }))
await comp.toFile('web_optimized.webm', EncoderProfile.vp9({ crf: 32 }))
await comp.toFile('professional.mov', EncoderProfile.prores4444())
await comp.toFile('frames/frame_%04d.png', EncoderProfile.pngSequence())
```

```python Python theme={"dark"}
# Create composition once
comp = Composition(background)
comp.add(video1, 'main').at(Anchor.CENTER)
comp.add(video2, 'pip').at(Anchor.TOP_RIGHT).size(SizeMode.CANVAS_PERCENT, percent=25)

# Export in multiple formats
comp.to_file('web_delivery.mp4', EncoderProfile.h264(crf=28))
comp.to_file('high_quality.mp4', EncoderProfile.h264(crf=18, preset='slow'))
comp.to_file('web_optimized.webm', EncoderProfile.vp9(crf=32))
comp.to_file('professional.mov', EncoderProfile.prores_4444())
comp.to_file('frames/frame_%04d.png', EncoderProfile.png_sequence())
```

## Progress Tracking

Monitor export progress:

```typescript Node.js theme={"dark"}
const progressCallback = (status: string) => {
  console.log(`Export status: ${status}`)
}

await comp.toFile('output.mp4', EncoderProfile.h264(), progressCallback)
```

```python Python theme={"dark"}
def progress_callback(status):
    print(f'Export status: {status}')

comp.to_file('output.mp4', EncoderProfile.h264(), on_progress=progress_callback)
```

## Debugging

### Dry Run

See the FFmpeg command without executing:

```typescript Node.js theme={"dark"}
// See the FFmpeg command that would be executed
const command = comp.dryRun()
console.log('FFmpeg command:', command)
```

```python Python theme={"dark"}
# See the FFmpeg command that would be executed
command = comp.dry_run()
print(f'FFmpeg command: {command}')
```

### Verbose Output

See FFmpeg output in real-time:

```typescript Node.js theme={"dark"}
// Show FFmpeg output for debugging
await comp.toFile('output.mp4', EncoderProfile.h264(), undefined, true) // verbose=true
```

```python Python theme={"dark"}
# Show FFmpeg output for debugging
comp.to_file('output.mp4', EncoderProfile.h264(), verbose=True)
```

## File Size Comparison

Approximate file sizes for a 30-second 1080p composition:

| Format | Quality | File Size | Use Case |
| - | - | - | - |
| **H.264 CRF 18** | Excellent | \~50MB | Professional delivery |
| **H.264 CRF 23** | High | \~25MB | General purpose |
| **H.264 CRF 28** | Good | \~15MB | Web delivery |
| **VP9 CRF 32** | Good | \~10MB | Web optimized |
| **ProRes 4444** | Perfect | \~500MB | Professional editing |
| **PNG Sequence** | Perfect | \~200MB | Frame-by-frame work |

## Platform-Specific Recommendations

### Social Media Platforms

```typescript Node.js theme={"dark"}
// Instagram feed/reels
await comp.toFile('instagram.mp4', EncoderProfile.h264({ 
  crf: 25, 
  preset: 'medium' 
}))
```

```python Python theme={"dark"}
# Instagram feed/reels
comp.to_file('instagram.mp4', EncoderProfile.h264(
    crf=25,
    preset='medium'
))
```

```typescript Node.js theme={"dark"}
// TikTok (vertical format)
await comp.toFile('tiktok.mp4', EncoderProfile.h264({ 
  crf: 26, 
  preset: 'fast' 
}))
```

```python Python theme={"dark"}
# TikTok (vertical format)
comp.to_file('tiktok.mp4', EncoderProfile.h264(
    crf=26,
    preset='fast'
))
```

```typescript Node.js theme={"dark"}
// YouTube (high quality)
await comp.toFile('youtube.mp4', EncoderProfile.h264({ 
  crf: 20, 
  preset: 'slow' 
}))
```

```python Python theme={"dark"}
# YouTube (high quality)
comp.to_file('youtube.mp4', EncoderProfile.h264(
    crf=20,
    preset='slow'
))
```

```typescript Node.js theme={"dark"}
// Twitter (size limits)
await comp.toFile('twitter.mp4', EncoderProfile.h264({ 
  crf: 28, 
  preset: 'fast' 
}))
```

```python Python theme={"dark"}
# Twitter (size limits)
comp.to_file('twitter.mp4', EncoderProfile.h264(
    crf=28,
    preset='fast'
))
```

### Web Applications

```typescript Node.js theme={"dark"}
// Web player (balance of quality and size)
await comp.toFile('web_player.mp4', EncoderProfile.h264({ 
  crf: 26, 
  preset: 'medium' 
}))

// Background video (lower quality acceptable)
await comp.toFile('bg_video.mp4', EncoderProfile.h264({ 
  crf: 30, 
  preset: 'fast' 
}))

// Hero video (high quality)
await comp.toFile('hero.mp4', EncoderProfile.h264({ 
  crf: 22, 
  preset: 'slow' 
}))
```

```python Python theme={"dark"}
# Web player (balance of quality and size)
comp.to_file('web_player.mp4', EncoderProfile.h264(
    crf=26,
    preset='medium'
))

# Background video (lower quality acceptable)
comp.to_file('bg_video.mp4', EncoderProfile.h264(
    crf=30,
    preset='fast'
))

# Hero video (high quality)
comp.to_file('hero.mp4', EncoderProfile.h264(
    crf=22,
    preset='slow'
))
```

## Advanced Export Options

### Implementation Details

The SDK implements classic FFmpeg parameters through the `EncoderProfile` class:

```typescript Node.js theme={"dark"}
// See what arguments the encoder generates
const encoder = EncoderProfile.h264({ crf: 20 })
const args = encoder.args('output.mp4')
console.log('FFmpeg args:', args)

// Modify if needed (advanced)
// Note: Direct FFmpeg argument modification not exposed in current SDK
```

```python Python theme={"dark"}
# See what arguments the encoder generates
encoder = EncoderProfile.h264(crf=20)
args = encoder.args('output.mp4')
print(f'FFmpeg args: {args}')

# Modify if needed (advanced)
# Note: Direct FFmpeg argument modification not exposed in current SDK
```

### Batch Export

Export multiple versions efficiently:

```typescript Node.js theme={"dark"}
const exports = [
  { name: 'preview.mp4', encoder: EncoderProfile.h264({ crf: 30, preset: 'ultrafast' }) },
  { name: 'final.mp4', encoder: EncoderProfile.h264({ crf: 20, preset: 'slow' }) },
  { name: 'web.webm', encoder: EncoderProfile.vp9({ crf: 28 }) }
]

for (const exp of exports) {
  console.log(`Exporting ${exp.name}...`)
  await comp.toFile(exp.name, exp.encoder)
}
```

```python Python theme={"dark"}
exports = [
    {'name': 'preview.mp4', 'encoder': EncoderProfile.h264(crf=30, preset='ultrafast')},
    {'name': 'final.mp4', 'encoder': EncoderProfile.h264(crf=20, preset='slow')},
    {'name': 'web.webm', 'encoder': EncoderProfile.vp9(crf=28)}
]

for exp in exports:
    print(f'Exporting {exp["name"]}...')
    comp.to_file(exp['name'], exp['encoder'])
```

## Performance Tips

### Optimize Export Speed

* Use `ultrafast` preset for testing
* Use lower resolution for previews
* Export final quality only when composition is finalized

### Optimize File Size

* Use VP9 WebM for smallest files
* Increase CRF value (lower quality) for smaller files
* Use `slow` or `veryslow` preset for better compression

### Memory Management

* Export long compositions in segments
* Use appropriate quality settings for your target
* Clean up intermediate files

## What's Next?

> [card] [🍳 Complete Examples](https://docs.videobgremover.com/examples.md)
>
> See complete workflow examples with different export formats

> [card] [📖 SDK Reference](https://docs.videobgremover.com/sdk-reference/encoders.md)
>
> Detailed documentation for all encoder options


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