From 8304e7abe1dea9b1c7047c3e7532d21783bbb5ea Mon Sep 17 00:00:00 2001 From: Trevor Mears Date: Sat, 17 Jan 2026 18:38:15 -0800 Subject: [PATCH] build: simplified the dockerfile to install ffmpeg via apt --- Dockerfile | 35 ++++++----------------------- server/services/transcodeSession.js | 5 +++-- 2 files changed, 10 insertions(+), 30 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0515722..27997b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ # NodeCast TV Docker Image # -# Multi-stage build for FFmpeg with full hardware acceleration support. -# Uses linuxserver/ffmpeg which includes NVENC, VAAPI, and QSV. +# Uses system FFmpeg with hardware acceleration drivers installed. # # Hardware acceleration: # - VAAPI (Intel/AMD): Mount /dev/dri and add video/render groups @@ -12,15 +11,13 @@ # Run with VAAPI: docker run --device /dev/dri:/dev/dri --group-add video ... # Run with NVENC: docker run --gpus all ... -# Stage 1: Get FFmpeg with all hardware encoders from linuxserver -FROM linuxserver/ffmpeg:latest AS ffmpeg - -# Stage 2: Node.js runtime with app FROM node:20-slim -# Install runtime dependencies for FFmpeg and hardware acceleration +# Install FFmpeg, build dependencies, and hardware acceleration drivers ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ + # FFmpeg with full codec support + ffmpeg \ # Build dependencies for better-sqlite3 python3 \ make \ @@ -35,28 +32,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ i965-va-driver \ # VA-API utilities for debugging vainfo \ - # FFmpeg shared library dependencies - libx264-164 \ - libx265-199 \ - libfdk-aac2 \ - libvpx7 \ - libmp3lame0 \ - libopus0 \ - libvorbis0a \ - libass9 \ - libfreetype6 \ - libfontconfig1 \ - libssl3 \ - # NVIDIA libraries (for NVENC when using --gpus) - libnvidia-encode1 \ - && rm -rf /var/lib/apt/lists/* || true + && rm -rf /var/lib/apt/lists/* -# Copy FFmpeg binaries from linuxserver/ffmpeg -COPY --from=ffmpeg /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg -COPY --from=ffmpeg /usr/local/bin/ffprobe /usr/local/bin/ffprobe - -# Verify FFmpeg works and show hardware encoders -RUN ffmpeg -version && ffmpeg -encoders 2>/dev/null | grep -E "vaapi|nvenc|qsv" || echo "Note: HW encoders depend on runtime GPU access" +# Verify FFmpeg installed and show version +RUN ffmpeg -version && ffmpeg -encoders 2>/dev/null | grep -E "vaapi|nvenc|qsv|libx264" | head -10 WORKDIR /app diff --git a/server/services/transcodeSession.js b/server/services/transcodeSession.js index 77ca99c..fe2f244 100644 --- a/server/services/transcodeSession.js +++ b/server/services/transcodeSession.js @@ -415,10 +415,11 @@ class TranscodeSession extends EventEmitter { // Scale on VAAPI args.push('-vf', `scale_vaapi=w=-2:h=${height}`); + // VAAPI encoder with quality setting + // Note: -global_quality is the portable way to set quality for VAAPI args.push( '-c:v', 'h264_vaapi', - '-rc_mode', 'CQP', - '-qp', String(qp), + '-global_quality', String(qp), '-bf', '3' ); }