fix: resolve 'auto' encoder to detected hardware and add VAAPI drivers to Dockerfile
This commit is contained in:
+8
-1
@@ -2,7 +2,14 @@ FROM node:20-alpine
|
|||||||
|
|
||||||
# Install build dependencies for better-sqlite3 and FFmpeg for streaming
|
# Install build dependencies for better-sqlite3 and FFmpeg for streaming
|
||||||
# Using system FFmpeg instead of ffmpeg-static for better Docker DNS compatibility
|
# Using system FFmpeg instead of ffmpeg-static for better Docker DNS compatibility
|
||||||
RUN apk add --no-cache python3 make g++ ffmpeg
|
# Hardware acceleration packages:
|
||||||
|
# - mesa-va-gallium: AMD VAAPI (Radeon/Vega)
|
||||||
|
# - intel-media-driver: Intel VAAPI/QSV (newer Intel GPUs)
|
||||||
|
# - libva-intel-driver: Intel VAAPI (older Intel GPUs, Haswell-Skylake)
|
||||||
|
# - libva-utils: vainfo tool for debugging
|
||||||
|
# Note: NVIDIA requires nvidia-container-toolkit on host + --gpus flag
|
||||||
|
RUN apk add --no-cache python3 make g++ ffmpeg \
|
||||||
|
mesa-va-gallium intel-media-driver libva-intel-driver libva-utils
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ const path = require('path');
|
|||||||
const fs = require('fs').promises;
|
const fs = require('fs').promises;
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const EventEmitter = require('events');
|
const EventEmitter = require('events');
|
||||||
|
const hwDetect = require('./hwDetect');
|
||||||
|
|
||||||
// Session storage
|
// Session storage
|
||||||
const sessions = new Map();
|
const sessions = new Map();
|
||||||
@@ -166,9 +167,16 @@ class TranscodeSession extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
buildFFmpegArgs() {
|
buildFFmpegArgs() {
|
||||||
const segmentPattern = path.join(this.dir, 'seg%04d.m4s');
|
const segmentPattern = path.join(this.dir, 'seg%04d.m4s');
|
||||||
const encoder = this.options.hwEncoder || 'software';
|
|
||||||
const videoMode = this.options.videoMode || 'encode';
|
const videoMode = this.options.videoMode || 'encode';
|
||||||
|
|
||||||
|
// Resolve 'auto' encoder to detected hardware, fallback to software
|
||||||
|
let encoder = this.options.hwEncoder || 'software';
|
||||||
|
if (encoder === 'auto') {
|
||||||
|
const hwCaps = hwDetect.getCapabilities();
|
||||||
|
encoder = hwCaps?.recommended || 'software';
|
||||||
|
console.log(`[TranscodeSession ${this.id}] Auto encoder resolved to: ${encoder}`);
|
||||||
|
}
|
||||||
|
|
||||||
const args = [
|
const args = [
|
||||||
'-hide_banner',
|
'-hide_banner',
|
||||||
'-loglevel', 'warning',
|
'-loglevel', 'warning',
|
||||||
|
|||||||
Reference in New Issue
Block a user