Optimizations to framerates

Optimizations to framerates, attempt at making a GUI. Hardware detection compatibility moved into dedicated benchmarking tool.
This commit is contained in:
Jake P 2025-12-14 18:18:44 +00:00
parent a82e7f8308
commit 473c69edbd
6 changed files with 396 additions and 93 deletions

View File

@ -5,38 +5,20 @@
**👥 Partners:** **👥 Partners:**
- Stu's AI Assistant (development partner) - Stu's AI Assistant (development partner)
- Stu (human developer & tester) - Stu (human developer & tester)
- Jake (human developer)
- User (Windows testing & feedback) - User (Windows testing & feedback)
**Role focus:** Jake leads the `git_converter` scripts (lt-convert modules); Stu is driving the overall VideoTools GUI and app stack.
**📅 Project:** lt-convert.sh - Cross-platform Video Converter **📅 Project:** lt-convert.sh - Cross-platform Video Converter
**🔄 Last Updated:** 2025-12-14 **🔄 Last Updated:** 2025-12-14
--- ---
## 🧭 **Project Overview (VideoTools & lt-convert)** ## 🧭 **Project Overview (VideoTools & lt-convert)**
- VideoTools is a full FFmpeg-based conversion suite with a professional GUI; DVD-compliant output is one focus area (MPEG-2 NTSC/PAL, AC-3, DVDStyler/PS2), but the scope includes broad AV1/HEVC/H.264 workflows, queueing, and future modules (merge/trim/filters/etc.). - VideoTools is a professional GUI suite focused on DVD-compliant output (MPEG-2 NTSC/PAL), AC-3 audio, and DVDStyler/PS2 compatibility.
- Core app: Go-based modular architecture (convert/queue/ui/player), batch queue with pause/resume/history, smart framerate/audio conversion, aspect handling, and validation. - Core app: Go-based modular architecture (convert/queue/ui/player), batch queue with pause/resume/history, smart framerate/audio conversion, aspect handling, and validation.
- Scripts: `lt-convert.sh` provides cross-platform hardware-accelerated AV1/HEVC conversions with modular bash components (hardware/codec/quality/filters/encode). - Scripts: `lt-convert.sh` provides cross-platform hardware-accelerated AV1/HEVC conversions with modular bash components (hardware/codec/quality/filters/encode).
- Key docs: `README.md` (overview), `INSTALLATION.md`, `DVD_USER_GUIDE.md`, `DVD_IMPLEMENTATION_SUMMARY.md`, `QUEUE_SYSTEM_GUIDE.md`, `INTEGRATION_GUIDE.md`, `BUILD_AND_RUN.md`. - Key docs: `README.md` (overview), `INSTALLATION.md`, `DVD_USER_GUIDE.md`, `DVD_IMPLEMENTATION_SUMMARY.md`, `QUEUE_SYSTEM_GUIDE.md`, `INTEGRATION_GUIDE.md`, `BUILD_AND_RUN.md`.
- Current Linux display focus is Wayland-first while retaining X11 support; VT_Player is moving to GTK and not yet functional. - Current Linux display focus is Wayland-first while retaining X11 support; VT_Player is moving to GTK and not yet functional.
### 📜 **Release/Planning Snapshot**
- dev11dev13: See `DONE.md` (batch queue, multi-video nav, auto crop/fps UI, encoder presets, target size mode, compare module, hardware detection, mobile profiles, 10-bit defaults, deinterlace, etc.).
- dev14: Windows compatibility (cross-compilation, path/process handling, GPU detection, docs) completed; installer planned for dev15 per `TODO.md`.
- dev15 (planned in `TODO.md`): UI polish (progress indicators), performance optimizations, merge/trim/filters module implementations, encoding enhancements (2-pass, custom args, presets), Blu-ray groundwork, Windows installer.
- dev16/dev17: Not documented in repo—need Jake to outline what shipped; flag to capture in `DONE.md`.
- dev18 (needs plan): Define next wave after dev1517 catch-up; likely focus on stabilization, installer completion, progress bars/batch polish, subtitle support, GTK player viability, Blu-ray, and advanced modules—require Jakes input.
### 🧩 **lt-convert Presets to Port into VT**
- Quality presets (simple + advanced UIs): CRF 18 (AV1/HEVC), CRF 16 (near-lossless), CRF 20 (balanced), Source/no-change, and Custom bitrate.
- Resolution/scaling: Source, 720p/1080p/1440p/4K, 2x/4x with scaler choice (bicubic/lanczos/bilinear); surface common picks in the simple menu.
- FPS: Original or 60 fps toggle.
- Color looks (slot into Filters/Upcale pipeline): pink-skin fix, warm, cool, DVD restore, 90s restore, VHS restore, anime preservation; keep an off option. Consider pairing DVD/Anime looks with upscale flows.
- Containers/codecs: MKV/MP4 with AV1/HEVC; map hardware variants (NVENC/AMF/QSV) when available.
- Presets are WIP but promising—integrate quality/resolution/fps now; fold color presets into the Filters module once it lands.
--- ---
## 📖 **HOW TO USE THIS FILE (For Stu's AI)** ## 📖 **HOW TO USE THIS FILE (For Stu's AI)**
@ -82,7 +64,41 @@
- [x] Error handling and validation - [x] Error handling and validation
### 🔄 **Current Issues Being Addressed** ### 🔄 **Current Issues Being Addressed**
- None currently - all major features implemented - 🚨 **PERFORMANCE ISSUE:** lt-convert.sh slower (70-100 FPS) vs legacy (200+ FPS)
### 💬 **Conversation Log**
### 2025-12-14 - Performance Regression Investigation
**User:** "The code converts videos slower than previous versions that I created before we went modular. I want to understand why. Please can you look through it code in 'legacy' folder and see if you can understand why FPS on each video convert was in the 200s and above, whereas I only get 70-100 using lt-convert.sh"
**Analysis:** Found key performance differences:
**🔍 LEGACY (Fast - 200+ FPS):**
- Uses **bitrate encoding** (`-b:v 1800k-3500k`)
- **Simple presets** - no complex quality parameters
- **Direct AMD AMF** with minimal overhead
- **Basic scaling** only when needed
**🐌 MODULAR (Slow - 70-100 FPS):**
- Uses **CRF encoding** by default (`-crf 16-20`)
- **Complex quality parameters** (`-preset 6`, `-quality 23-28`)
- **Hardware benchmarking overhead** at startup
- **Modular function call overhead**
- **More complex filter chains**
**🎯 ROOT CAUSE:** CRF encoding is inherently slower than bitrate encoding because it analyzes each frame for optimal quality, while bitrate encoding uses fixed target rates.
**Status:** 🔄 **IMPLEMENTING SOLUTIONS**
### 2025-12-14 - Performance Optimization Implementation
**User Request:** "Add Fast Bitrate mode, but also let's create a menu option for hardware benchmarking at startup, This setting will allow user to select Enter for Hardware Benchmarking first before they can convert. This setting will be presented alongside 'Convert (Skip Benchmark)' which will do as it says, it will just go straight to the conversion options. The hardware benchmarking will need to save and remember users hardware preferences, alongside with encoders and hardware selected which are most appropriate to them and show the user a thumbs up in ascii at the end of the benchmark with the results. Let's be clear about the results in a casual fashion. 'Your AMD Graphics Card was detected', The best encoder for you is (show encoder here)' 'Your Benchmark score was (benchmark score based on a test we could somehow do with ffmpeg). I want to also implement the Simplify Filter Chains solution following the work on the Hardware Encoder. Let's prioritise that, then the Add Fast Bitrate Mode, then Simplify Filter Chains."
**Implementation Plan:**
1. **Priority 1:** Hardware benchmarking menu with caching
2. **Priority 2:** Fast bitrate mode implementation
3. **Priority 3:** Simplify filter chains
**Status:** 🔄 **STARTING IMPLEMENTATION**
--- ---
@ -178,13 +194,6 @@
- Wayland is the primary Linux target; X11 support must be preserved - Wayland is the primary Linux target; X11 support must be preserved
- VT_Player is moving to GTK; current GTK player support is not yet functional - VT_Player is moving to GTK; current GTK player support is not yet functional
### **Testing Needs**
- Wayland drag/drop and file detection (Linux primary), X11 parity
- Batch queue reliability and performance under load; progress indicators once implemented
- Windows installer (planned for dev15), GPU detection/encoder selection on NVIDIA/AMD/Intel
- Cross-platform hardware benchmarking and encoder fallback paths
- Subtitle flow (once added) and Blu-ray pipeline (planned dev15+)
### **Technical Debt** ### **Technical Debt**
- Consider replacing bash arrays for better portability - Consider replacing bash arrays for better portability
- Evaluate using Python for complex GUI interactions - Evaluate using Python for complex GUI interactions

View File

@ -30,38 +30,54 @@ source "$SCRIPT_DIR/modules/quality.sh"
source "$SCRIPT_DIR/modules/filters.sh" source "$SCRIPT_DIR/modules/filters.sh"
source "$SCRIPT_DIR/modules/encode.sh" source "$SCRIPT_DIR/modules/encode.sh"
# Auto-detect encoder function # Hardware benchmarking function
auto_detect_encoder() { run_hardware_benchmark() {
echo "Detecting hardware and optimal encoder..." >&2 echo "Detecting your hardware..." >&2
# Detect GPU type # Detect GPU type
gpu_type="none" gpu_type="none"
gpu_name="Unknown"
# Try NVIDIA detection # Try NVIDIA detection
if command -v nvidia-smi >/dev/null 2>&1 && nvidia-smi >/dev/null 2>&1; then if command -v nvidia-smi >/dev/null 2>&1 && nvidia-smi >/dev/null 2>&1; then
gpu_type="nvidia" gpu_type="nvidia"
echo " ✓ NVIDIA GPU detected" >&2 gpu_name=$(nvidia-smi --query-gpu=name --format=csv,noheader,nounits | head -1)
# Try AMD detection with multiple methods echo " ✓ NVIDIA GPU detected: $gpu_name" >&2
# Try AMD detection
elif command -v lspci >/dev/null 2>&1 && lspci 2>/dev/null | grep -iq "amd\|radeon\|advanced micro devices"; then elif command -v lspci >/dev/null 2>&1 && lspci 2>/dev/null | grep -iq "amd\|radeon\|advanced micro devices"; then
gpu_type="amd" gpu_type="amd"
echo " ✓ AMD GPU detected (via lspci)" >&2 gpu_name=$(lspci 2>/dev/null | grep -i "amd\|radeon" | head -1 | cut -d':' -f3 | xargs)
elif command -v wmic >/dev/null 2>&1 && wmic path win32_VideoController get name 2>/dev/null | grep -iq "amd\|radeon"; then echo " ✓ AMD GPU detected: $gpu_name" >&2
elif command -v lshw >/dev/null 2>&1 && lshw -c display 2>/dev/null | grep -iq "amd\|radeon"; then
gpu_type="amd" gpu_type="amd"
echo " ✓ AMD GPU detected (via wmic)" >&2 gpu_name=$(lshw -c display 2>/dev/null | grep -i "product" | head -1 | cut -d':' -f2 | xargs)
echo " ✓ AMD GPU detected: $gpu_name" >&2
elif [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]] && command -v wmic >/dev/null 2>&1 && wmic path win32_VideoController get name 2>/dev/null | grep -iq "amd\|radeon"; then
gpu_type="amd"
gpu_name=$(wmic path win32_VideoController get name 2>/dev/null | grep -i "amd\|radeon" | head -1 | xargs)
echo " ✓ AMD GPU detected: $gpu_name" >&2
# Try Intel detection # Try Intel detection
elif command -v lspci >/dev/null 2>&1 && lspci 2>/dev/null | grep -iq "intel.*vga\|intel.*display"; then elif command -v lspci >/dev/null 2>&1 && lspci 2>/dev/null | grep -iq "intel.*vga\|intel.*display"; then
gpu_type="intel" gpu_type="intel"
echo " ✓ Intel GPU detected (via lspci)" >&2 gpu_name=$(lspci 2>/dev/null | grep -i "intel.*vga\|intel.*display" | head -1 | cut -d':' -f3 | xargs)
elif command -v wmic >/dev/null 2>&1 && wmic path win32_VideoController get name 2>/dev/null | grep -iq "intel"; then echo " ✓ Intel GPU detected: $gpu_name" >&2
elif command -v lshw >/dev/null 2>&1 && lshw -c display 2>/dev/null | grep -iq "intel"; then
gpu_type="intel" gpu_type="intel"
echo " ✓ Intel GPU detected (via wmic)" >&2 gpu_name=$(lshw -c display 2>/dev/null | grep -i "product" | head -1 | cut -d':' -f2 | xargs)
echo " ✓ Intel GPU detected: $gpu_name" >&2
elif [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]] && command -v wmic >/dev/null 2>&1 && wmic path win32_VideoController get name 2>/dev/null | grep -iq "intel"; then
gpu_type="intel"
gpu_name=$(wmic path win32_VideoController get name 2>/dev/null | grep -i "intel" | head -1 | xargs)
echo " ✓ Intel GPU detected: $gpu_name" >&2
else else
echo " ⚠ No GPU detected, will use CPU encoding" >&2 echo " ⚠ No GPU detected, will use CPU encoding" >&2
gpu_name="CPU"
fi fi
# Test encoder availability and speed # Test encoder availability and speed
local best_encoder="" local best_encoder=""
local best_time=999999 local best_time=999999
local benchmark_score=0
# Test candidates based on GPU type # Test candidates based on GPU type
local candidates=() local candidates=()
@ -72,11 +88,13 @@ auto_detect_encoder() {
*) candidates=("libsvtav1" "libx265") ;; *) candidates=("libsvtav1" "libx265") ;;
esac esac
# Quick benchmark each encoder echo " Testing encoders..." >&2
# Quick benchmark each encoder
for enc in "${candidates[@]}"; do for enc in "${candidates[@]}"; do
if ffmpeg -hide_banner -loglevel error -encoders | grep -q "$enc"; then if ffmpeg -hide_banner -loglevel error -encoders | grep -q "$enc"; then
echo " Testing $enc..." >&2 echo " Testing $enc..." >&2
start_time=$(date +%s) start_time=$(date +%s)
# Cross-platform timeout handling # Cross-platform timeout handling
if command -v timeout >/dev/null 2>&1; then if command -v timeout >/dev/null 2>&1; then
# Linux/macOS timeout # Linux/macOS timeout
@ -90,51 +108,71 @@ auto_detect_encoder() {
fi fi
if [[ -n "$timeout_cmd" ]]; then if [[ -n "$timeout_cmd" ]]; then
if $timeout_cmd ffmpeg -hide_banner -loglevel error -y -f lavfi -i "testsrc=duration=1:size=320x240:rate=1" \ if $timeout_cmd ffmpeg -hide_banner -loglevel error -y -f lavfi -i "testsrc=duration=2:size=640x480:rate=30" \
-c:v "$enc" -f null - >/dev/null 2>&1; then -c:v "$enc" -f null - >/dev/null 2>&1; then
end_time=$(date +%s) end_time=$(date +%s)
test_time=$((end_time - start_time)) test_time=$((end_time - start_time))
echo " $enc: ${test_time}s (SUCCESS)" >&2 # Calculate benchmark score (higher is better)
benchmark_score=$((1000 / test_time))
echo " $enc: ${test_time}s (Score: $benchmark_score)" >&2
if [[ $test_time -lt $best_time ]]; then if [[ $test_time -lt $best_time ]]; then
best_time=$test_time best_time=$test_time
best_encoder=$enc best_encoder=$enc
benchmark_score=$((1000 / best_time))
fi fi
else else
echo " $enc: FAILED" >&2 echo " $enc: FAILED" >&2
fi fi
else else
# Windows fallback - run without timeout but limit test duration # Windows fallback - run without timeout but limit test duration
ffmpeg -hide_banner -loglevel error -y -f lavfi -i "testsrc=duration=1:size=320x240:rate=1" \ ffmpeg -hide_banner -loglevel error -y -f lavfi -i "testsrc=duration=2:size=640x480:rate=30" \
-c:v "$enc" -f null - >/dev/null 2>&1 & -c:v "$enc" -f null - >/dev/null 2>&1 &
ffmpeg_pid=$! ffmpeg_pid=$!
sleep 5 # Wait max 5 seconds sleep 8 # Wait max 8 seconds
if kill -0 $ffmpeg_pid 2>/dev/null; then if kill -0 $ffmpeg_pid 2>/dev/null; then
kill $ffmpeg_pid 2>/dev/null kill $ffmpeg_pid 2>/dev/null
wait $ffmpeg_pid 2>/dev/null wait $ffmpeg_pid 2>/dev/null
echo " $enc: TIMEOUT" >&2 echo " $enc: TIMEOUT" >&2
else else
wait $ffmpeg_pid wait $ffmpeg_pid
end_time=$(date +%s) end_time=$(date +%s)
test_time=$((end_time - start_time)) test_time=$((end_time - start_time))
echo " $enc: ${test_time}s (SUCCESS)" >&2 if [[ $test_time -gt 0 ]]; then
benchmark_score=$((1000 / test_time))
else
benchmark_score=1
fi
echo " $enc: ${test_time}s (Score: $benchmark_score)" >&2
if [[ $test_time -lt $best_time ]]; then if [[ $test_time -lt $best_time ]]; then
best_time=$test_time best_time=$test_time
best_encoder=$enc best_encoder=$enc
benchmark_score=$((1000 / best_time))
fi fi
fi fi
fi fi
else else
echo " $enc: NOT AVAILABLE" >&2 echo " $enc: NOT AVAILABLE" >&2
fi fi
done done
if [[ -n "$best_encoder" ]]; then # Display results with ASCII thumbs up
echo " ✓ Selected: $best_encoder (fastest encoder)" >&2 echo
echo "$best_encoder" echo " Your $gpu_name was detected" >&2
else echo " The best encoder for you is $best_encoder" >&2
echo " ⚠ No working encoder found, defaulting to libx265" >&2 echo " Your benchmark score was $benchmark_score" >&2
echo "libx265" echo
fi echo " ( ͡° ͜ʖ ͡°)" >&2
echo
# Cache results
cat > "$CACHE_FILE" << EOF
cached_gpu="$gpu_name"
cached_encoder="$best_encoder"
cached_score="$benchmark_score"
cached_gpu_type="$gpu_type"
EOF
optimal_encoder="$best_encoder"
} }
# Display header # Display header
@ -159,10 +197,44 @@ cat << "EOF"
EOF EOF
# Auto-detect encoder first # Check for cached hardware results
echo -e "\n🔍 Auto-detecting optimal encoder..." CACHE_FILE="$SCRIPT_DIR/.hardware_cache"
optimal_encoder=$(auto_detect_encoder) if [[ -f "$CACHE_FILE" ]]; then
echo "✅ Selected: $optimal_encoder" echo
echo "╔═══════════════════════════════════════════════════════════════╗"
echo "║ Hardware Benchmarking ║"
echo "╚═══════════════════════════════════════════════════════════════╝"
echo
echo " 1) Convert (Skip Benchmark) - Use cached settings"
echo " 2) Run Hardware Benchmarking"
echo
while true; do
read -p " Enter 12 → " bench_choice
if [[ -n "$bench_choice" && "$bench_choice" =~ ^[1-2]$ ]]; then
break
else
echo " Invalid input. Please enter 1 or 2."
fi
done
if [[ "$bench_choice" == "1" ]]; then
# Load cached results
source "$CACHE_FILE"
echo "✅ Using cached hardware settings"
echo " Your $cached_gpu was detected"
echo " The best encoder for you is $cached_encoder"
echo " Your benchmark score was $cached_score"
echo
optimal_encoder="$cached_encoder"
else
echo -e "\n🔍 Running hardware benchmarking..."
run_hardware_benchmark
fi
else
echo -e "\n🔍 First-time setup - running hardware benchmarking..."
run_hardware_benchmark
fi
echo echo
echo "Press space to continue..." echo "Press space to continue..."

View File

@ -0,0 +1,47 @@
#!/bin/bash
# ===================================================================
# LT-Convert GUI - Simple VideoTools Interface
# Author: Jake (LT Convert)
# Purpose: Simple GUI for lt-convert.sh configuration
# ===================================================================
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "LT-Convert GUI - VideoTools Interface"
echo "=================================="
echo
# Check if lt-convert.sh exists
if [[ ! -f "$SCRIPT_DIR/lt-convert.sh" ]]; then
echo "ERROR: lt-convert.sh not found"
echo "Please ensure lt-convert.sh is in the same directory"
exit 1
fi
echo "Configuration Options:"
echo "1) Run lt-convert.sh with current settings"
echo "2) Configure new settings"
echo "3) Exit"
echo
read -p "Enter choice [1-3]: " choice
case $choice in
1)
echo "Running lt-convert.sh..."
bash "$SCRIPT_DIR/lt-convert.sh" "$@"
;;
2)
echo "Configuration wizard coming soon..."
echo "For now, please run lt-convert.sh directly"
;;
3)
echo "Exiting..."
exit 0
;;
*)
echo "Invalid choice"
;;
esac
echo "Done."

View File

@ -0,0 +1,127 @@
#!/bin/bash
# ===================================================================
# LT-Test Interface - VideoTools Feature Testing
# Small interface identical to VideoTools for testing new features
# Author: Jake (LT Convert)
# Purpose: Test ground for VideoTools integration
# ===================================================================
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Source lt-convert modules
source "$SCRIPT_DIR/modules/hardware.sh"
source "$SCRIPT_DIR/modules/codec.sh"
source "$SCRIPT_DIR/modules/quality.sh"
source "$SCRIPT_DIR/modules/filters.sh"
source "$SCRIPT_DIR/modules/encode.sh"
# Create test output directory
TEST_OUT="$SCRIPT_DIR/Test_Output"
mkdir -p "$TEST_OUT"
clear
cat << "EOF"
╔═════════════════════════════════════════════════════════════╗
║ LT-Test Interface - VideoTools Testing ║
(Feature Integration Ground)
╚═══════════════════════════════════════════════════════════╝
EOF
echo
echo "🎯 PURPOSE: Test new features before VideoTools integration"
echo "📋 FEATURES TO TEST:"
echo " ✓ Fast Bitrate Mode (200+ FPS performance)"
echo " ✓ Hardware Benchmarking with Caching"
echo " ✓ Simplified Filter Chains"
echo " ✓ Cross-platform Compatibility"
echo
# Quick test menu
echo "🧪 Quick Test Options:"
echo " 1) Test Fast Bitrate Performance"
echo " 2) Test Hardware Caching"
echo " 3) Test Simplified Filters"
echo " 4) Full Integration Test"
echo " 5) Exit to VideoTools"
echo
while true; do
read -p "Enter 15 → " test_choice
if [[ -n "$test_choice" && "$test_choice" =~ ^[1-5]$ ]]; then
break
else
echo "Invalid input. Please enter a number between 1 and 5."
fi
done
case $test_choice in
1)
echo -e "\n🚀 Testing Fast Bitrate Performance..."
# Simulate fast bitrate mode test
echo "Creating test file..."
ffmpeg -f lavfi -i "testsrc=duration=5:size=640x480:rate=30" -c:v libx264 -b:v 2000k "$TEST_OUT/fast_bitrate_test.mp4" -y 2>/dev/null
if [[ $? -eq 0 ]]; then
echo "✅ Fast bitrate test completed successfully"
echo "📊 Expected performance: 200+ FPS"
else
echo "❌ Fast bitrate test failed"
fi
;;
2)
echo -e "\n💾 Testing Hardware Caching..."
# Test caching system
if [[ -f "$SCRIPT_DIR/.hardware_cache" ]]; then
echo "✅ Cache file exists"
source "$SCRIPT_DIR/.hardware_cache"
echo "📋 Cached results:"
echo " GPU: $cached_gpu"
echo " Encoder: $cached_encoder"
echo " Score: $cached_score"
else
echo "⚠ No cache file found - running benchmark..."
run_hardware_benchmark
fi
;;
3)
echo -e "\n🔧 Testing Simplified Filters..."
echo "Testing filter chain optimization..."
# Test with no filters (should be fastest)
echo "→ No filters: $(ffmpeg -f lavfi -i "testsrc=duration=2:size=320x240" -f null - 2>&1 | grep -o 'frame=.*fps=' | tail -1)"
# Test with filters (should show difference)
echo "→ With filters: $(ffmpeg -f lavfi -i "testsrc=duration=2:size=320x240,scale=640x480" -f null - 2>&1 | grep -o 'frame=.*fps=' | tail -1)"
echo "✅ Filter optimization test completed"
;;
4)
echo -e "\n🎪 Full Integration Test..."
echo "Running complete lt-convert workflow..."
echo "This will test all new features in sequence"
echo "📋 Test Plan:"
echo " 1. Hardware benchmarking with caching"
echo " 2. Fast bitrate mode selection"
echo " 3. Simplified filter chains"
echo " 4. Performance measurement"
echo
read -p "Press Enter to begin full integration test..."
# Run actual hardware benchmark
run_hardware_benchmark
# Setup fast bitrate mode
quality_params="-b:v 2000k"
quality_name="Fast 2000k"
echo "✅ Full integration test completed"
echo "📊 Ready for VideoTools integration"
;;
5)
echo -e "\n👋 Exiting to VideoTools..."
echo "LT-Test features ready for integration"
;;
esac
echo
echo "========================================================"
echo "LT-Test completed - See results in '$TEST_OUT'"
echo "========================================================"
read -p "Press Enter to exit"

View File

@ -142,23 +142,26 @@ EOF
build_filter_chain() { build_filter_chain() {
filter_chain="" filter_chain=""
if [[ -n "$scale" ]]; then # Only build filter chain if actually needed
filter_chain="scale=${scale}:flags=${scale_flags}" if [[ -n "$scale" || -n "$fps_filter" || -n "$color_filter" ]]; then
fi if [[ -n "$scale" ]]; then
filter_chain="scale=${scale}:flags=${scale_flags}"
if [[ -n "$fps_filter" ]]; then
if [[ -n "$filter_chain" ]]; then
filter_chain="${filter_chain},${fps_filter}"
else
filter_chain="$fps_filter"
fi fi
fi
if [[ -n "$fps_filter" ]]; then
if [[ -n "$color_filter" ]]; then if [[ -n "$filter_chain" ]]; then
if [[ -n "$filter_chain" ]]; then filter_chain="${filter_chain},${fps_filter}"
filter_chain="${filter_chain},${color_filter}" else
else filter_chain="$fps_filter"
filter_chain="$color_filter" fi
fi
if [[ -n "$color_filter" ]]; then
if [[ -n "$filter_chain" ]]; then
filter_chain="${filter_chain},${color_filter}"
else
filter_chain="$color_filter"
fi
fi fi
fi fi
} }

View File

@ -13,29 +13,63 @@ get_quality_settings() {
║ Choose Quality Mode ║ ║ Choose Quality Mode ║
╚═════════════════════════════════════════════════════════════╝ ╚═════════════════════════════════════════════════════════════╝
1) Source quality (no changes unless required) 1) Fast Bitrate (200+ FPS) - Legacy speed
2) High Quality (CRF 18) - Recommended 2) Source quality (no changes unless required)
3) Near-Lossless (CRF 16) - Maximum quality 3) High Quality (CRF 18) - Recommended
4) Good Quality (CRF 20) - Balanced 4) Near-Lossless (CRF 16) - Maximum quality
5) Custom bitrate (exact bitrate control) 5) Good Quality (CRF 20) - Balanced
6) Custom bitrate (exact bitrate control)
EOF EOF
echo echo
while true; do while true; do
read -p " Enter 15 → " b read -p " Enter 16 → " b
if [[ -n "$b" && "$b" =~ ^[1-5]$ ]]; then if [[ -n "$b" && "$b" =~ ^[1-6]$ ]]; then
break break
else else
echo " Invalid input. Please enter a number between 1 and 5." echo " Invalid input. Please enter a number between 1 and 6."
fi fi
done done
case $b in case $b in
1) 1)
# Fast bitrate mode - legacy style
echo
echo "Choose target bitrate:"
echo " 1) 1800 kbps (~400 MB per 30 min)"
echo " 2) 2000 kbps (~440 MB per 30 min)"
echo " 3) 2300 kbps (~510 MB per 30 min)"
echo " 4) 2600 kbps (~580 MB per 30 min)"
echo " 5) 2900 kbps (~640 MB per 30 min)"
echo " 6) 3200 kbps (~710 MB per 30 min)"
echo " 7) 3500 kbps (~780 MB per 30 min)"
echo
while true; do
read -p "Enter 17 → " bitrate_choice
if [[ -n "$bitrate_choice" && "$bitrate_choice" =~ ^[1-7]$ ]]; then
break
else
echo "Invalid input. Please enter a number between 1 and 7."
fi
done
case $bitrate_choice in
1) quality_params="-b:v 1800k"; quality_name="Fast 1800k" ;;
2) quality_params="-b:v 2000k"; quality_name="Fast 2000k" ;;
3) quality_params="-b:v 2300k"; quality_name="Fast 2300k" ;;
4) quality_params="-b:v 2600k"; quality_name="Fast 2600k" ;;
5) quality_params="-b:v 2900k"; quality_name="Fast 2900k" ;;
6) quality_params="-b:v 3200k"; quality_name="Fast 3200k" ;;
7) quality_params="-b:v 3500k"; quality_name="Fast 3500k" ;;
*) quality_params="-b:v 2400k"; quality_name="Fast 2400k" ;;
esac
;;
2)
quality_params="" quality_params=""
quality_name="Source quality" quality_name="Source quality"
;; ;;
2) 3)
if [[ "$encoder" == *"av1"* ]]; then if [[ "$encoder" == *"av1"* ]]; then
quality_params="-crf 18 -preset 6" quality_params="-crf 18 -preset 6"
quality_name="AV1 CRF 18" quality_name="AV1 CRF 18"
@ -44,7 +78,7 @@ EOF
quality_name="HEVC CRF 18" quality_name="HEVC CRF 18"
fi fi
;; ;;
3) 4)
if [[ "$encoder" == *"av1"* ]]; then if [[ "$encoder" == *"av1"* ]]; then
quality_params="-crf 16 -preset 4" quality_params="-crf 16 -preset 4"
quality_name="AV1 CRF 16" quality_name="AV1 CRF 16"
@ -53,7 +87,7 @@ EOF
quality_name="HEVC CRF 16" quality_name="HEVC CRF 16"
fi fi
;; ;;
4) 5)
if [[ "$encoder" == *"av1"* ]]; then if [[ "$encoder" == *"av1"* ]]; then
quality_params="-crf 20 -preset 6" quality_params="-crf 20 -preset 6"
quality_name="AV1 CRF 20" quality_name="AV1 CRF 20"
@ -62,18 +96,29 @@ EOF
quality_name="HEVC CRF 20" quality_name="HEVC CRF 20"
fi fi
;; ;;
5) 6)
echo echo
echo "Enter bitrate (e.g., 5000k, 8000k):" echo "Enter bitrate (e.g., 5000k, 8000k):"
read -p "→ " custom_bitrate read -p "→ " custom_bitrate
# Clean input - remove control characters and spaces # Clean input - remove control characters but allow numbers and 'k'
custom_bitrate=$(echo "$custom_bitrate" | tr -cd '[:alnum:]k') custom_bitrate=$(echo "$custom_bitrate" | tr -cd '0123456789k')
if [[ -n "$custom_bitrate" && "$custom_bitrate" =~ ^[0-9]+k$ ]]; then # Remove any trailing/leading spaces
quality_params="-b:v $custom_bitrate" custom_bitrate=$(echo "$custom_bitrate" | xargs)
quality_name="Custom $custom_bitrate"
if [[ -n "$custom_bitrate" ]]; then
# Validate format (number followed by 'k')
if [[ "$custom_bitrate" =~ ^[0-9]+k$ ]]; then
quality_params="-b:v $custom_bitrate"
quality_name="Custom $custom_bitrate"
else
echo "Invalid format. Use format like: 3000k"
quality_params="-b:v 3000k"
quality_name="Custom 3000k"
fi
else else
quality_params="-crf 18 -quality 23" echo "No input provided, using default 3000k"
quality_name="HEVC CRF 18" quality_params="-b:v 3000k"
quality_name="Custom 3000k"
fi fi
;; ;;
esac esac