- Replaced the previous imageFormats set with a new containerFormats set to optimize ffprobe usage.
- Updated the isCudaSupportedCodec function to only probe container formats that can contain video streams, improving performance and clarity in codec detection.
These changes enhance the efficiency of the codec detection process for CUDA hardware acceleration.
- Check both preferHardware AND gpuAvailable before using NVENC codecs (h264_nvenc, hevc_nvenc)
- Check gpuAvailable before adding CUDA hwaccel flag for input decoding
- Fix test assertion to check correct call index for CUDA hwaccel verification
This prevents hardware acceleration attempts when GPU is unavailable, addressing code review feedback.
- Add `checkNvidiaGpuAvailable()` function using nvidia-smi to detect GPU presence
- Add comprehensive logging for hardware acceleration decisions:
- GPU detection status
- Hardware vs software encoding/decoding choices
- CUDA codec support detection
- Encoder selection decisions
- Cache GPU availability results to avoid repeated checks
- Add `resetNvidiaGpuCache()` for testing
- Update tests to handle GPU availability mocking
This provides visibility into hardware acceleration decisions and ensures CUDA is only attempted when NVIDIA GPU hardware is actually available.
- Detect video codec using ffprobe instead of file extensions
- Auto-enable CUDA hwaccel for supported codecs when FFMPEG_PREFER_HARDWARE=true
- Skip probing for image formats to optimize performance
- Add comprehensive tests for hardware acceleration logic
Add FFMPEG_PREFER_HARDWARE env var to enable hardware acceleration
Use h264_nvenc and hevc_nvenc encoders when hardware preferred
Fall back to software encoders (libx264/libx265) when disabled
Add comprehensive tests for hardware/software encoding modes
Update README with new environment variable documentation
This enables GPU-accelerated video encoding for better performance on systems with NVIDIA GPUs.
* fix: ensure data dir exists before loading db
* Update src/db/db.ts
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>