VideoTools/scripts/git_converter/modules/quality.sh
Jake P 02bf711098 Attempt to fix Linux compatibility
🔧 File Detection
- Replaced nullglob with explicit file scanning
- Added more video formats (flv, webm, m4v, 3gp, mpg, mpeg)
- Better error reporting showing supported formats
 Hardware Detection
- Added lshw support for Linux hardware detection
- Conditional Windows commands - only run wmic on Windows
- Improved GPU detection for Linux systems
⏱️ Timeout Handling
- Cross-platform timeout support:
  - Linux: timeout
  - macOS: gtimeout
  - Windows: Background process with manual kill
📁 Path Handling
- Robust script directory detection for different shells
- Absolute module sourcing using SCRIPT_DIR
🖥️ Drag & Drop
- Better argument handling for Wayland desktop environments
- Comprehensive file extension support
Now works on:
-  Windows x64 (Git Bash, WSL)
-  Linux (Wayland, X11)
-  macOS (Terminal)
2025-12-14 03:20:36 +00:00

80 lines
2.8 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# ===================================================================
# Quality Settings Module - GIT Converter v2.7
# Handles quality modes and encoding parameters
# ===================================================================
get_quality_settings() {
local encoder="$1"
clear
cat << "EOF"
╔═══════════════════════════════════════════════════════════╗
║ Choose Quality Mode ║
╚═════════════════════════════════════════════════════════════╝
1) Source quality (no changes unless required)
2) High Quality (CRF 18) - Recommended
3) Near-Lossless (CRF 16) - Maximum quality
4) Good Quality (CRF 20) - Balanced
5) Custom bitrate (exact bitrate control)
EOF
echo
while true; do
read -p " Enter 15 → " b
if [[ -n "$b" && "$b" =~ ^[1-5]$ ]]; then
break
else
echo " Invalid input. Please enter a number between 1 and 5."
fi
done
case $b in
1)
quality_params=""
quality_name="Source quality"
;;
2)
if [[ "$encoder" == *"av1"* ]]; then
quality_params="-crf 18 -preset 6"
quality_name="AV1 CRF 18"
else
quality_params="-crf 18 -quality 23"
quality_name="HEVC CRF 18"
fi
;;
3)
if [[ "$encoder" == *"av1"* ]]; then
quality_params="-crf 16 -preset 4"
quality_name="AV1 CRF 16"
else
quality_params="-crf 16 -quality 28"
quality_name="HEVC CRF 16"
fi
;;
4)
if [[ "$encoder" == *"av1"* ]]; then
quality_params="-crf 20 -preset 6"
quality_name="AV1 CRF 20"
else
quality_params="-crf 20 -quality 23"
quality_name="HEVC CRF 20"
fi
;;
5)
echo
echo "Enter bitrate (e.g., 5000k, 8000k):"
read -p "→ " custom_bitrate
# Clean input - remove control characters and spaces
custom_bitrate=$(echo "$custom_bitrate" | tr -cd '[:alnum:]k')
if [[ -n "$custom_bitrate" && "$custom_bitrate" =~ ^[0-9]+k$ ]]; then
quality_params="-b:v $custom_bitrate"
quality_name="Custom $custom_bitrate"
else
quality_params="-crf 18 -quality 23"
quality_name="HEVC CRF 18"
fi
;;
esac
}