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:
- VideoFrame wraps native C++ memory
- JavaScript garbage collector doesn’t see this memory
- Must be manually freed with
.close()
Encoder/Decoder Errors
”Encoder is not configured”
configure()
Solution:
“Invalid codec string”
”Encoder closed”
encoder.close()
Solution:
Frame Format Issues
”Unsupported format”
Wrong Buffer Size
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”
Hardware Encoder Fails
Solution: Fallback to software encoder:Performance Issues
Slow Encoding
Symptoms:- Encoding takes too long
- High CPU usage
- Dropped frames
Use hardware acceleration
Use hardware acceleration
Reduce resolution
Reduce resolution
Lower framerate
Lower framerate
Use worker threads
Use worker threads
See Worker Threads Guide for parallel encoding.
High Memory Usage
Solutions:-
Close frames immediately
-
Limit queue size
-
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:- Install NVIDIA drivers
- 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:- Check GitHub Issues: https://github.com/caseymanos/node-webcodecs/issues
- Create a minimal reproduction
- Include:
- node-webcodecs version (
npm list node-webcodecs) - Node.js version (
node --version) - Operating system
- Error message and stack trace
- Minimal code to reproduce
- node-webcodecs version (