Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ dist/
input/
output/
temp/
vapoursynth-user/
*.log
.git/
.gitignore
README.md
ffmpeg-dist/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dist/
input/
output/
temp/
vapoursynth-user/
*.log
bun.lock
ffmpeg-dist/
60 changes: 44 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ USER root

ENV DEBIAN_FRONTEND=noninteractive
ENV RUSTICL_ENABLE=radeonsi,iris,nouveau
ENV OCL_ICD_VENDORS=/etc/OpenCL/vendors

# Base packages
RUN apt-get update && apt-get install -y --no-install-recommends \
Expand Down Expand Up @@ -45,15 +46,15 @@ EOF
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-pip \
vapoursynth \
python3-vapoursynth-jetpack \
vapoursynth-akarin \
vapoursynth-ffms2 \
python3-venv \
python3-dev \
libpython3-dev \
ffmpeg \
mediainfo \
opus-tools \
mkvtoolnix \
zstd \
p7zip-full \
\
# OpenCL
ocl-icd-libopencl1 \
Expand Down Expand Up @@ -152,10 +153,48 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libegl1 \
libgles2 \
libglu1-mesa \
&& pip3 install --no-cache-dir --break-system-packages --no-deps vstools \
&& rm -f /etc/OpenCL/vendors/mesa.icd \
&& rm -rf /var/lib/apt/lists/*

# Create venv, install vsrepo, and symlink it for convenience
RUN python3 -m venv /opt/vs-venv \
&& /opt/vs-venv/bin/pip install --no-cache-dir --upgrade pip setuptools wheel \
&& /opt/vs-venv/bin/pip install --no-cache-dir \
VapourSynth \
vsrepo \
vsjetpack \
vstools \
vsutil \
vapoursynth-adaptivegrain \
vapoursynth-akarin \
vapoursynth-awarp \
vapoursynth-resize2 \
vapoursynth-vszip \
vapoursynth-zsmooth \
vapoursynth-mvtools \
vapoursynth-eedi3 \
vapoursynth-znedi3 \
vapoursynth-descale \
vapoursynth-deblock \
vapoursynth-hysteresis \
ffms2 \
&& /opt/vs-venv/bin/vapoursynth config \
&& ln -sf /opt/vs-venv/bin/python /usr/local/bin/python \
&& ln -sf /opt/vs-venv/bin/python3 /usr/local/bin/python3 \
&& ln -sf /opt/vs-venv/bin/vapoursynth /usr/local/bin/vapoursynth \
&& ln -sf /opt/vs-venv/bin/vspipe /usr/local/bin/vspipe \
&& ln -sf /opt/vs-venv/bin/vsrepo /usr/local/bin/vsrepo

# Use the venv's vsrepo to install required scripts
RUN mkdir -p /root/.config/vsrepo \
&& vsrepo update \
&& vsrepo install ffms2 fmtc nnedi3 knlm

# Make the venv's Python the default for any 'python3' call
ENV PATH="/opt/vs-venv/bin:${PATH}"

COPY vapoursynth/ /app/vapoursynth/

# Copy bundled binaries and custom FFmpeg archives
COPY binaries/ /app/binaries/

Expand All @@ -167,16 +206,6 @@ RUN chmod +x \
&& if [ -f /app/binaries/x86_64_v4/SvtAv1EncApp ]; then chmod +x /app/binaries/x86_64_v4/SvtAv1EncApp; fi

# Extract custom FFmpeg builds.
#
# Expected archive contents:
# ffmpeg-x86-64-v2/
# ffmpeg-x86-64-v3/
# ffmpeg-x86-64-v4/
#
# Final locations:
# /opt/ffmpeg-x86-64-v2
# /opt/ffmpeg-x86-64-v3
# /opt/ffmpeg-x86-64-v4
RUN mkdir -p /opt \
&& tar --zstd -xpf /app/binaries/x86_64_v2/ffmpeg.tar.zst -C /opt \
&& tar --zstd -xpf /app/binaries/x86_64_v3/ffmpeg.tar.zst -C /opt \
Expand All @@ -190,7 +219,6 @@ RUN mkdir -p /opt \
/opt/ffmpeg-x86-64-v4/bin/ffprobe

# Verify all custom FFmpeg builds can resolve shared libraries.
# This catches missing runtime packages during docker build.
RUN set -eux; \
for level in x86-64-v2 x86-64-v3 x86-64-v4; do \
echo "Checking /opt/ffmpeg-$level/bin/ffmpeg"; \
Expand Down
241 changes: 116 additions & 125 deletions README.md

Large diffs are not rendered by default.

Binary file removed binaries/x86_64_v2/libvszip.so
Binary file not shown.
Binary file removed binaries/x86_64_v3/libvszip.so
Binary file not shown.
Binary file removed binaries/x86_64_v4/libvszip.so
Binary file not shown.
1 change: 1 addition & 0 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
- ./input:/data/input
- ./output:/data/output
- ./temp:/data/temp
- ./vapoursynth-user:/config/vapoursynth
# Mount your media library folders for in-place encoding
# - /mnt/HDD/media/Animes:/Animes
# - /mnt/HDD/media/Shows:/Shows
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
- ./input:/data/input
- ./output:/data/output
- ./temp:/data/temp
- ./vapoursynth-user:/config/vapoursynth
# Mount your media library folders for in-place encoding
# - /mnt/HDD/media/Animes:/Animes
# - /mnt/HDD/media/Shows:/Shows
Expand Down
27 changes: 22 additions & 5 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/bin/sh
set -e

export PATH="/opt/vs-venv/bin:${PATH}"

BIN_DIR="/app/binaries"

TARGET_SVT="/usr/local/bin/SvtAv1EncApp"
TARGET_FFMPEG="/usr/local/bin/ffmpeg"
TARGET_FFPROBE="/usr/local/bin/ffprobe"

TARGET_LIB="/usr/lib/x86_64-linux-gnu/vapoursynth/libvszip.so"

# Always expose the arch-independent language-detector
if ! command -v language-detector >/dev/null 2>&1; then
Expand Down Expand Up @@ -75,9 +76,8 @@ if [ -x "$ARCH_DIR/SvtAv1EncApp" ]; then
ln -sf "$ARCH_DIR/SvtAv1EncApp" "$TARGET_SVT"
fi

# Expose VapourSynth zip plugin
if [ -f "$ARCH_DIR/libvszip.so" ]; then
ln -sf "$ARCH_DIR/libvszip.so" "$TARGET_LIB"
if [ -x /opt/vs-venv/bin/vapoursynth ]; then
export VSSCRIPT_PATH="$("/opt/vs-venv/bin/vapoursynth" get-vsscript)"
fi

# Expose custom FFmpeg
Expand All @@ -98,10 +98,27 @@ fi
# Make matching FFmpeg shared libs visible
export LD_LIBRARY_PATH="$FFMPEG_DIR/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"

# Refresh the dynamic linker cache so libvszip.so is findable
# Refresh linker cache where possible
ldconfig 2>/dev/null || true

echo "[entrypoint] Using FFmpeg: $("$TARGET_FFMPEG" -hide_banner -version | head -n1)"
echo "[entrypoint] Using FFprobe: $("$TARGET_FFPROBE" -hide_banner -version | head -n1)"

USER_VS_DIR="/config/vapoursynth/presets"
if [ ! -d "$USER_VS_DIR" ]; then
mkdir -p "$USER_VS_DIR"
cat > "$USER_VS_DIR/README.md" <<'EOF'
Drop your custom VapourSynth presets in this directory.

Each preset needs two files with the same stem:
myfilter.vpy - the script
myfilter.json - the manifest (id, levels, params, defaults)

See https://github.com/Rabbit-Company/RabbitEncoder/tree/main/vapoursynth/presets for working examples.

After adding a preset, hit "Reload presets" in the dashboard's Advanced
Settings panel (or POST /api/vs-presets/reload).
EOF
fi

exec "$@"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rabbit-encoder",
"version": "4.0.0",
"version": "5.0.0",
"type": "module",
"scripts": {
"dev": "bun run --watch src/index.ts",
Expand Down
Loading
Loading