📋 GIT Converter v2.7 - Feature Summary & Changes 🚀 Major New Features Added 🎬 Codec & Container Selection - AV1 vs HEVC encoding - Choose between next-gen AV1 or mature HEVC - MKV vs MP4 containers - Flexibility vs device compatibility - User-controlled output format - Full control over final file type ⚙️ Advanced Quality Control - Source Quality mode - Bypass quality changes unless required - CRF options - 16 (near-lossless), 18 (recommended), 20 (balanced) - Custom bitrate control - Exact bitrate specification for precise file sizes - Encoder-specific optimization - Different parameters for AV1 vs HEVC 🎮 GPU/Encoder Selection - Auto-detection - Intelligent hardware detection with benchmarking - Manual selection - Choose specific GPU/encoder: - NVIDIA NVENC (HEVC/AV1) - AMD AMF (HEVC/AV1) - Intel Quick Sync (HEVC/AV1) - CPU encoding (SVT-AV1/x265) - Custom encoder selection - Two-stage interface - Auto-detect first, then option to override 🎨 Enhanced Color Correction - 8 specialized presets: - 2000s DVD Restore - 90s Quality Restore - VHS Quality Restore - Anime Preservation - Pink skin tone restoration (Topaz AI fix) - Warm/Cool color boosts - Fixed filter parameters - Resolved unsharp filter matrix size issues 🔧 Technical Improvements 📦 Modular Architecture - Separated concerns into focused modules: - hardware.sh - GPU detection & encoder selection - codec.sh - Codec & container options - quality.sh - Quality modes & bitrate control - filters.sh - Resolution, FPS, color correction - encode.sh - FFmpeg execution & monitoring ⚡ Performance Optimizations - Hardware benchmarking - Tests encoder speed before selection - Timeout protection - Prevents hanging during encoder tests - Better error reporting - Shows SUCCESS/FAILED/NOT AVAILABLE status - Improved timing logic - Cross-platform compatible timing 🖥️ User Experience - Two-stage workflow - Auto-detect → confirm/override - Clear menu navigation - Numbered options with validation - Real-time feedback - Shows what's being tested/selected - Fixed input validation - Proper regex for multi-digit numbers 🐛 Bug Fixes - Fixed unsharp filter - Corrected matrix size requirements (odd numbers only) - Fixed hue parameter - Corrected eq filter syntax - Fixed encoder detection - Improved hardware detection logic - Fixed menu display - Resolved command substitution output capture issues 🎯 Key Benefits - Full user control over encoding parameters - Hardware optimization with automatic fallbacks - Professional quality restoration options - Modular design for easy maintenance - Cross-platform compatibility (Windows/Linux)
102 lines
3.4 KiB
Bash
102 lines
3.4 KiB
Bash
#!/bin/bash
|
|
# ===================================================================
|
|
# Optimized Encoding Module - GIT Converter v2.7
|
|
# Maximum speed, lossless quality encoding
|
|
# ===================================================================
|
|
|
|
encode_video() {
|
|
local input_file="$1"
|
|
local output_file="$2"
|
|
local encoder="$3"
|
|
local quality_params="$4"
|
|
local filter_chain="$5"
|
|
|
|
echo "Processing: $input_file → $(basename "$output_file")"
|
|
|
|
# Optimized ffmpeg command for maximum speed
|
|
if [[ -n "$filter_chain" ]]; then
|
|
# Only apply filters if scaling is needed (not Source resolution)
|
|
if [[ -n "$scale" ]]; then
|
|
ffmpeg -y -i "$input_file" -pix_fmt yuv420p -vf "$filter_chain" \
|
|
-c:v "$encoder" $quality_params -c:a aac -b:a 192k -ac 2 "$output_file"
|
|
else
|
|
ffmpeg -y -i "$input_file" -pix_fmt yuv420p \
|
|
-c:v "$encoder" $quality_params -c:a aac -b:a 192k -ac 2 "$output_file"
|
|
fi
|
|
else
|
|
ffmpeg -y -i "$input_file" -pix_fmt yuv420p \
|
|
-c:v "$encoder" $quality_params -c:a aac -b:a 192k -ac 2 "$output_file"
|
|
fi
|
|
else
|
|
ffmpeg -y -i "$input_file" -pix_fmt yuv420p \
|
|
-c:v "$encoder" $quality_params -c:a aac -b:a 192k -ac 2 "$output_file"
|
|
fi
|
|
else
|
|
ffmpeg -y -i "$input_file" -pix_fmt yuv420p \
|
|
-c:v "$encoder" $quality_params -c:a aac -b:a 192k -ac 2 "$output_file"
|
|
fi
|
|
else
|
|
ffmpeg -y -i "$input_file" -pix_fmt yuv420p \
|
|
-c:v "$encoder" $quality_params -c:a aac -b:a 192k -ac 2 "$output_file"
|
|
fi
|
|
else
|
|
ffmpeg -y -i "$input_file" -pix_fmt yuv420p \
|
|
-c:v "$encoder" $quality_params -c:a aac -b:a 192k -ac 2 "$output_file"
|
|
fi
|
|
else
|
|
ffmpeg -y -i "$input_file" -pix_fmt yuv420p \
|
|
-c:v "$encoder" $quality_params -c:a aac -b:a 192k -ac 2 "$output_file"
|
|
fi
|
|
else
|
|
ffmpeg -y -i "$input_file" -pix_fmt yuv420p \
|
|
-c:v "$encoder" $quality_params -c:a aac -b:a 192k -ac 2 "$output_file"
|
|
fi
|
|
|
|
if [[ $? -eq 0 ]]; then
|
|
echo "DONE → $(basename "$output_file")"
|
|
return 0
|
|
else
|
|
echo "ERROR → Failed to process $input_file"
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
# Performance monitoring with auto-optimization
|
|
encode_with_monitoring() {
|
|
local input_file="$1"
|
|
local output_file="$2"
|
|
local encoder="$3"
|
|
local quality_params="$4"
|
|
local filter_chain="$5"
|
|
local attempt_count="${6:-1}"
|
|
|
|
echo "Starting performance-monitored encoding for: $(basename "$input_file")"
|
|
|
|
# Source performance module
|
|
source "$(dirname "$0")/performance.sh"
|
|
|
|
# Run performance monitoring
|
|
monitor_encoding_performance "$input_file" "$output_file" "$encoder" "$quality_params" "$filter_chain" "$attempt_count"
|
|
}
|
|
|
|
process_files() {
|
|
local video_files=("$@")
|
|
local encoder="$1"
|
|
local quality_params="$2"
|
|
local filter_chain="$3"
|
|
local suf="$4"
|
|
local color_suf="$5"
|
|
local ext="$6"
|
|
|
|
for f in "${video_files[@]}"; do
|
|
[[ -f "$f" ]] || continue
|
|
|
|
# Extract basename for output filename
|
|
basename_f=$(basename "$f")
|
|
out="$OUT/${basename_f%.*}${suf}${color_suf}__cv.$ext"
|
|
[[ -f "$out" ]] && { echo "SKIP $f (already exists)"; continue; }
|
|
|
|
encode_video "$f" "$out" "$encoder" "$quality_params" "$filter_chain"
|
|
echo
|
|
done
|
|
} |