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 <noreply@anthropic.com>
This commit is contained in:
ediblerope 2026-04-20 12:04:13 +01:00
parent 9f0b220427
commit 1fcfbedc9d

View file

@ -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" \