How to Limit the Ryzen Processor Temperature and Power During HandBrake Conversions?
If your AMD Ryzen processor is running too hot (hitting up to 96ºC) during heavy video conversions in HandBrake, you can use a simple wrapper script combined with ryzenadj to safely cap its temperature and power draw.
This script automatically detects how HandBrake is installed on your openSUSE Tumbleweed system (whether native or Flatpak), applies your custom limits, launches the app, and restores your standard CPU profile once you close it.
Prerequisites
Make sure you have ryzenadj installed on your system (available via zypper or OBS):
sudo zypper in ryzenadj
The Script
Open your terminal, create a new script file (e.g., handbrake-safe.sh), and paste the following code:
#!/bin/bash
# --- CONFIG ---
TEMP_LIMIT=80 # Temperature limit in ºC
POWER_LIMIT=10000 # Power limit in mW (10000 = 10W)
# Function to detect the installed version of HandBrake
find_handbrake() {
if command -v handbrake &> /dev/null; then
echo "native"
elif command -v HandBrake &> /dev/null; then
echo "native_cap"
elif flatpak list 2>/dev/null | grep -q "fr.handbrake.ghb"; then
echo "flatpak"
else
echo "none"
fi
}
HB_TYPE=$(find_handbrake)
# --- 1. INSTALLATION CHECK ---
if [ "$HB_TYPE" = "none" ]; then
echo "--------------------------------------------------------"
echo " Error: HandBrake is not installed on your system!"
echo " You can install it on openSUSE Tumbleweed by running:"
echo " sudo zypper in HandBrake"
echo "--------------------------------------------------------"
exit 1
fi
# --- 2. PRE-EXECUTION (Apply limits) ---
echo "[+] Applying thermal limit of ${TEMP_LIMIT}ºC and power limit of $((POWER_LIMIT/1000))W..."
sudo ryzenadj --tctl-temp=$TEMP_LIMIT --stapm-limit=$POWER_LIMIT
powerprofilesctl set power-saver 2>/dev/null
# --- 3. EXECUTE HANDBRAKE ---
echo "[+] Starting HandBrake..."
if [ "$HB_TYPE" = "native" ]; then
handbrake
elif [ "$HB_TYPE" = "native_cap" ]; then
HandBrake
elif [ "$HB_TYPE" = "flatpak" ]; then
flatpak run fr.handbrake.ghb
fi
# --- 4. POST-EXECUTION (Restore defaults) ---
echo " "
echo "[+] HandBrake closed! Restoring default system settings..."
sudo ryzenadj --tctl-temp=95 --stapm-limit=25000
powerprofilesctl set balanced 2>/dev/null
echo "[✓] Done! Your Ryzen is back to normal mode."
Save the file as handbrake-safe.sh.
Give it execution permissions:
chmod +x handbrake-safe.sh
Run it whenever you want to convert videos safely:
./handbrake-safe.sh