Skip to main content

Common Issues

This guide covers the most frequently encountered issues when using node-webcodecs.

Memory Leaks

Symptom

Application memory usage continuously increases, eventually crashing with:

Cause

VideoFrame objects not being closed after use.

Solution

Always call .close() on frames immediately after encoding/decoding:
Why this happens:
  • VideoFrame wraps native C++ memory
  • JavaScript garbage collector doesn’t see this memory
  • Must be manually freed with .close()
Memory Leak DetectionMonitor memory usage during development:
Or use:

Encoder/Decoder Errors

”Encoder is not configured”

Cause: Encoding before calling configure() Solution:

“Invalid codec string”

Cause: Incorrect codec identifier Solution: Use proper codec strings:
See Codec Reference for full list.

”Encoder closed”

Cause: Encoding after calling encoder.close() Solution:

Frame Format Issues

”Unsupported format”

Cause: Using unsupported pixel format Solution: Use supported formats:

Wrong Buffer Size

Cause: Buffer doesn’t match frame dimensions Solution:

Timestamp Issues

Video Plays Too Fast/Slow

Cause: Wrong timestamp units Solution: Use microseconds, not milliseconds:

Frames Out of Order

Cause: Incorrect timestamp ordering Solution: Ensure monotonically increasing timestamps:

Hardware Acceleration Issues

”Hardware encoder not found”

Cause: FFmpeg not compiled with hardware support Solution: Check available encoders:
If missing, reinstall FFmpeg with hardware support:

Hardware Encoder Fails

Solution: Fallback to software encoder:

Performance Issues

Slow Encoding

Symptoms:
  • Encoding takes too long
  • High CPU usage
  • Dropped frames
Solutions:
See Worker Threads Guide for parallel encoding.

High Memory Usage

Solutions:
  1. Close frames immediately
  2. Limit queue size
  3. Process in batches

Platform-Specific Issues

macOS

Issue: “Operation not permitted” errors Solution: Grant permissions for video acceleration:

Linux

Issue: NVIDIA encoder not working Solution:
  1. Install NVIDIA drivers
  2. Compile FFmpeg with NVENC support:

Windows

Issue: DirectX errors Solution: Update graphics drivers:
  • NVIDIA: GeForce Experience
  • AMD: AMD Software
  • Intel: Intel Driver & Support Assistant

Debugging Tips

Enable Detailed Logging

Test With Simple Example

If having issues, test with the most basic example:

Check FFmpeg Installation

Getting Help

If you’re still stuck:
  1. Check GitHub Issues: https://github.com/caseymanos/node-webcodecs/issues
  2. Create a minimal reproduction
  3. Include:
    • node-webcodecs version (npm list node-webcodecs)
    • Node.js version (node --version)
    • Operating system
    • Error message and stack trace
    • Minimal code to reproduce

Next Steps

API Reference

Complete API documentation

Examples

Working code examples

GitHub Issues

Report bugs and get help

Quick Start

Back to basics