From 1fcfbedc9dea13131dbe9fef7592f241a3b45b91 Mon Sep 17 00:00:00 2001 From: ediblerope Date: Mon, 20 Apr 2026 12:04:13 +0100 Subject: [PATCH] Cap transcode-hevc to 8 ffmpeg threads by default Concurrent transcodes on the 56-core mediaserver were running hot. Limits each ffmpeg invocation to 8 threads via -threads and x265's pools= param (libx265 ignores -threads alone). Overridable with TRANSCODE_THREADS env var. Co-Authored-By: Claude Opus 4.7 --- scripts/transcode-hevc.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/transcode-hevc.sh b/scripts/transcode-hevc.sh index 5aa53de..0211278 100644 --- a/scripts/transcode-hevc.sh +++ b/scripts/transcode-hevc.sh @@ -20,6 +20,7 @@ DONE_LOG="/var/lib/transcode-hevc/completed.log" LOG_FILE="/var/log/transcode-hevc.log" CRF="${TRANSCODE_CRF:-24}" PRESET="${TRANSCODE_PRESET:-medium}" +THREADS="${TRANSCODE_THREADS:-8}" DRY_RUN="${DRY_RUN:-0}" QB_URL="${QB_URL:-http://localhost:8080}" @@ -243,9 +244,11 @@ while IFS= read -r -d '' file; do rm -f "$tmp_file" if "$FFMPEG" -nostdin -y \ + -threads "$THREADS" \ -i "$file" \ -map 0:v:0 -map 0:a -map 0:s? \ -c:v libx265 -crf "$CRF" -preset "$PRESET" \ + -x265-params "pools=$THREADS" \ -c:a copy \ -c:s copy \ "$tmp_file" \