Skip to main content

Overview

Worker threads enable parallel video encoding by distributing work across multiple CPU cores. This is useful for:
  • Batch processing multiple videos simultaneously
  • Multi-quality encoding (ABR ladder)
  • Keeping main thread responsive during encoding
  • Maximizing CPU utilization on multi-core systems
node-webcodecs encoders already use async mode by default, which offloads encoding to background threads. Worker threads are useful for processing multiple videos in parallel, not individual frames.

Basic Worker Thread Setup

Parallel Multi-Video Encoding

Encode multiple videos in parallel:

Worker Pool Pattern

Create a pool of workers for efficient batch processing:

Best Practices

Always terminate workers when done:

Next Steps

Backpressure

Manage encoding queue

Hardware Acceleration

GPU-accelerated encoding

API Reference

VideoEncoder docs

Examples

Real-world examples