build: simplified the dockerfile to install ffmpeg via apt
This commit is contained in:
+7
-28
@@ -1,7 +1,6 @@
|
|||||||
# NodeCast TV Docker Image
|
# NodeCast TV Docker Image
|
||||||
#
|
#
|
||||||
# Multi-stage build for FFmpeg with full hardware acceleration support.
|
# Uses system FFmpeg with hardware acceleration drivers installed.
|
||||||
# Uses linuxserver/ffmpeg which includes NVENC, VAAPI, and QSV.
|
|
||||||
#
|
#
|
||||||
# Hardware acceleration:
|
# Hardware acceleration:
|
||||||
# - VAAPI (Intel/AMD): Mount /dev/dri and add video/render groups
|
# - 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 VAAPI: docker run --device /dev/dri:/dev/dri --group-add video ...
|
||||||
# Run with NVENC: docker run --gpus all ...
|
# 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
|
FROM node:20-slim
|
||||||
|
|
||||||
# Install runtime dependencies for FFmpeg and hardware acceleration
|
# Install FFmpeg, build dependencies, and hardware acceleration drivers
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
# FFmpeg with full codec support
|
||||||
|
ffmpeg \
|
||||||
# Build dependencies for better-sqlite3
|
# Build dependencies for better-sqlite3
|
||||||
python3 \
|
python3 \
|
||||||
make \
|
make \
|
||||||
@@ -35,28 +32,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
i965-va-driver \
|
i965-va-driver \
|
||||||
# VA-API utilities for debugging
|
# VA-API utilities for debugging
|
||||||
vainfo \
|
vainfo \
|
||||||
# FFmpeg shared library dependencies
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
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
|
|
||||||
|
|
||||||
# Copy FFmpeg binaries from linuxserver/ffmpeg
|
# Verify FFmpeg installed and show version
|
||||||
COPY --from=ffmpeg /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg
|
RUN ffmpeg -version && ffmpeg -encoders 2>/dev/null | grep -E "vaapi|nvenc|qsv|libx264" | head -10
|
||||||
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"
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
|||||||
@@ -415,10 +415,11 @@ class TranscodeSession extends EventEmitter {
|
|||||||
// Scale on VAAPI
|
// Scale on VAAPI
|
||||||
args.push('-vf', `scale_vaapi=w=-2:h=${height}`);
|
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(
|
args.push(
|
||||||
'-c:v', 'h264_vaapi',
|
'-c:v', 'h264_vaapi',
|
||||||
'-rc_mode', 'CQP',
|
'-global_quality', String(qp),
|
||||||
'-qp', String(qp),
|
|
||||||
'-bf', '3'
|
'-bf', '3'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user