VideoTools/scripts/git_converter/modules/codec.sh
Jake P fa6ff5aba1 Turned GIT Converter Modular
📋 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)
2025-12-14 03:00:44 +00:00

83 lines
2.6 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
# ===================================================================
# Codec and Container Selection Module - GIT Converter v2.7
# User choice for codec and container type
# ===================================================================
get_codec_and_container_settings() {
local encoder="$1"
clear
cat << "EOF"
╔═════════════════════════════════════════════════════════════╗
║ Choose Codec & Container ║
╚═════════════════════════════════════════════════════════╝
1) AV1 Encoding
- MKV container (recommended)
- MP4 container
2) HEVC Encoding
- MKV container (recommended)
- MP4 container
EOF
echo
while true; do
read -p " Enter 12 → " codec_choice
if [[ -n "$codec_choice" && "$codec_choice" =~ ^[1-2]$ ]]; then
break
else
echo " Invalid input. Please enter 1 or 2."
fi
done
# Get container preference
if [[ "$codec_choice" =~ ^[1-2]$ ]]; then
echo
echo "Choose container for $( [[ "$codec_choice" == "1" ]] && echo "AV1" || echo "HEVC"):"
echo " 1) MKV (recommended)"
echo " 2) MP4"
echo
while true; do
read -p " Enter 12 → " container_choice
if [[ -n "$container_choice" && "$container_choice" =~ ^[1-2]$ ]]; then
break
else
echo " Invalid input. Please enter 1 or 2."
fi
done
case $container_choice in
1) ext="mkv" ;;
2) ext="mp4" ;;
esac
else
ext="mkv" # Default fallback
fi
# Set encoder based on choice
case $codec_choice in
1)
# AV1 encoding - use detected encoder if AV1-capable
if [[ "$encoder" == *"av1"* ]]; then
final_encoder="$encoder"
else
# Fallback to SVT-AV1 if detected encoder doesn't support AV1
final_encoder="libsvtav1"
fi
;;
2)
# HEVC encoding - use detected encoder
final_encoder="$encoder"
;;
*)
final_encoder="$encoder" # Fallback
;;
esac
# Export variables for main script
echo "$final_encoder"
echo "$ext"
}