upgrade: gwencoder v3.1 with interactive menu and Tdarr alignment
This commit is contained in:
74
gwencoder/scripts/add_resolution_feature.sh
Executable file
74
gwencoder/scripts/add_resolution_feature.sh
Executable file
@@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
# Script to add resolution preset support to main.go
|
||||
# This script will guide you through the manual changes needed
|
||||
|
||||
echo "================================================================"
|
||||
echo "Resolution Preset Integration Script"
|
||||
echo "================================================================"
|
||||
echo ""
|
||||
echo "Since main.go is in .gitignore, please make the following changes manually:"
|
||||
echo ""
|
||||
|
||||
cat << 'EOF'
|
||||
|
||||
STEP 1: Add Resolution field to EncodingOptions struct
|
||||
-------------------------------------------------------
|
||||
Find the EncodingOptions struct (search for "type EncodingOptions struct")
|
||||
Add this field:
|
||||
|
||||
Resolution string // Resolution preset (480p, 720p, 1080p, original)
|
||||
|
||||
|
||||
STEP 2: Add resolution flag in parseFlags() function
|
||||
----------------------------------------------------
|
||||
Find where flags are defined (search for "flag.String" or "flag.Bool")
|
||||
Add this line with the other flag definitions:
|
||||
|
||||
resolution := flag.String("resolution", "", "Target resolution (480p, 720p, 1080p, original)")
|
||||
|
||||
Then in the EncodingOptions initialization, add:
|
||||
|
||||
Resolution: *resolution,
|
||||
|
||||
|
||||
STEP 3: Integrate into encodeFile() function
|
||||
--------------------------------------------
|
||||
Find the encodeFile() function and locate where FFmpeg command is built.
|
||||
Add this code BEFORE building the FFmpeg command:
|
||||
|
||||
// Build scale filter for resolution preset
|
||||
scaleFilter := ""
|
||||
if opts.Resolution != "" {
|
||||
filter, err := encoding.BuildScaleFilter(file, opts.Resolution)
|
||||
if err != nil {
|
||||
fmt.Printf("⚠️ Warning: Could not build scale filter: %v\n", err)
|
||||
} else if filter != "" {
|
||||
scaleFilter = filter
|
||||
targetHeight := encoding.GetResolutionPresetHeight(opts.Resolution)
|
||||
fmt.Printf("📐 Scaling video to %dp\n", targetHeight)
|
||||
}
|
||||
}
|
||||
|
||||
Then when building the FFmpeg args array, if scaleFilter is not empty,
|
||||
add it to the command arguments (typically after video codec args).
|
||||
|
||||
|
||||
STEP 4: Update printHelp() function
|
||||
-----------------------------------
|
||||
Find the printHelp() function and add in the appropriate section:
|
||||
|
||||
fmt.Println("\n📐 Resolution Options:")
|
||||
fmt.Println(" --resolution <preset> Scale video to target resolution")
|
||||
fmt.Println(" Options: 480p, 720p, 1080p, original")
|
||||
fmt.Println(" Only scales down, never upscales")
|
||||
|
||||
|
||||
EOF
|
||||
|
||||
echo ""
|
||||
echo "================================================================"
|
||||
echo "After making these changes:"
|
||||
echo " 1. Save main.go"
|
||||
echo " 2. Run: make clean && make build"
|
||||
echo " 3. Test with: ./build/gwencoder --help"
|
||||
echo "================================================================"
|
||||
29
gwencoder/scripts/check_test_progress.sh
Executable file
29
gwencoder/scripts/check_test_progress.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Quick script to check Phase 5 test progress
|
||||
|
||||
LOG_FILE="phase5_test_results.log"
|
||||
|
||||
if [ ! -f "$LOG_FILE" ]; then
|
||||
echo "Test log not found. Tests may not have started yet."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
total_tests=10
|
||||
completed=$(tail -n +2 "$LOG_FILE" | wc -l)
|
||||
successful=$(grep -c "✅" "$LOG_FILE" 2>/dev/null || echo "0")
|
||||
failed=$(grep -c "❌" "$LOG_FILE" 2>/dev/null || echo "0")
|
||||
|
||||
echo "══════════════════════════════════════════════════════════════"
|
||||
echo "Phase 5 Test Progress"
|
||||
echo "══════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
echo "Completed: $completed / $total_tests"
|
||||
echo "Successful: $successful"
|
||||
echo "Failed: $failed"
|
||||
echo ""
|
||||
echo "Recent results:"
|
||||
echo ""
|
||||
tail -5 "$LOG_FILE" | column -t -s'|'
|
||||
echo ""
|
||||
|
||||
93
gwencoder/scripts/phase5_quick_test.sh
Executable file
93
gwencoder/scripts/phase5_quick_test.sh
Executable file
@@ -0,0 +1,93 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Phase 5 Quick Test - Tests 3 key combinations
|
||||
# This is a faster subset of the full test suite
|
||||
|
||||
TEST_FILE="testvid.webm"
|
||||
OUTPUT_DIR="phase5_quick_outputs"
|
||||
LOG_FILE="phase5_quick_results.log"
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
|
||||
if [ ! -f "$TEST_FILE" ]; then
|
||||
echo -e "${RED}❌ Test file not found: $TEST_FILE${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ORIGINAL_SIZE=$(du -b "$TEST_FILE" 2>/dev/null | cut -f1)
|
||||
ORIGINAL_SIZE_MB=$(echo "scale=2; $ORIGINAL_SIZE / 1024 / 1024" | bc)
|
||||
|
||||
echo -e "${BLUE}══════════════════════════════════════════════════════════════${NC}"
|
||||
echo -e "${BLUE}GWENCODER PHASE 5 QUICK TEST${NC}"
|
||||
echo -e "${BLUE}══════════════════════════════════════════════════════════════${NC}"
|
||||
echo ""
|
||||
echo -e "Test file: ${GREEN}$TEST_FILE${NC} (${ORIGINAL_SIZE_MB} MB)"
|
||||
echo ""
|
||||
|
||||
get_file_size_mb() {
|
||||
local file=$1
|
||||
if [ -f "$file" ]; then
|
||||
local size=$(du -b "$file" 2>/dev/null | cut -f1)
|
||||
echo "scale=2; $size / 1024 / 1024" | bc
|
||||
else
|
||||
echo "0"
|
||||
fi
|
||||
}
|
||||
|
||||
run_quick_test() {
|
||||
local test_name=$1
|
||||
local mode=$2
|
||||
local flags=$3
|
||||
|
||||
echo -e "${YELLOW}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo -e "${BLUE}TEST: $test_name${NC}"
|
||||
echo -e "Command: ${GREEN}./gwencoder $mode $flags${NC}"
|
||||
echo ""
|
||||
|
||||
find . -maxdepth 1 -name "*GWELL.*" -type f -delete 2>/dev/null
|
||||
|
||||
start_time=$(date +%s.%N)
|
||||
./gwencoder $mode $flags 2>&1 | tee "$OUTPUT_DIR/${test_name}.log" > /dev/null
|
||||
end_time=$(date +%s.%N)
|
||||
duration=$(echo "$end_time - $start_time" | bc)
|
||||
duration_rounded=$(printf "%.1f" "$duration")
|
||||
|
||||
output_file=$(find . -maxdepth 1 -name "*GWELL.*" -type f -newer "$TEST_FILE" 2>/dev/null | head -1)
|
||||
|
||||
if [ -n "$output_file" ]; then
|
||||
file_size_mb=$(get_file_size_mb "$output_file")
|
||||
mv "$output_file" "$OUTPUT_DIR/" 2>/dev/null
|
||||
echo -e "${GREEN}✅ Completed${NC} - Duration: ${duration_rounded}s, Size: ${file_size_mb} MB"
|
||||
echo "$test_name|$mode|$flags|$duration_rounded|$file_size_mb|✅" >> "$LOG_FILE"
|
||||
else
|
||||
echo -e "${RED}❌ Failed${NC}"
|
||||
echo "$test_name|$mode|$flags|N/A|N/A|❌" >> "$LOG_FILE"
|
||||
fi
|
||||
echo ""
|
||||
}
|
||||
|
||||
echo "Test Name|Mode|Flags|Duration (s)|Size (MB)|Status" > "$LOG_FILE"
|
||||
|
||||
# Test 1: Default settings
|
||||
run_quick_test "1_Default" "--fast" ""
|
||||
|
||||
# Test 2: With AV1 advanced options
|
||||
run_quick_test "2_AV1_Advanced" "--fast" "--av1-preset 8 --av1-crf 30"
|
||||
|
||||
# Test 3: With audio options
|
||||
run_quick_test "3_Audio_Options" "--fast" "--audio-quality balanced --audio-stereo"
|
||||
|
||||
echo -e "${BLUE}══════════════════════════════════════════════════════════════${NC}"
|
||||
echo -e "${BLUE}QUICK TEST SUMMARY${NC}"
|
||||
echo -e "${BLUE}══════════════════════════════════════════════════════════════${NC}"
|
||||
echo ""
|
||||
column -t -s'|' "$LOG_FILE"
|
||||
echo ""
|
||||
echo "Full logs in: $OUTPUT_DIR/"
|
||||
|
||||
213
gwencoder/scripts/phase5_test.sh
Executable file
213
gwencoder/scripts/phase5_test.sh
Executable file
@@ -0,0 +1,213 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Phase 5 Comprehensive Testing Script
|
||||
# Tests various flag combinations and logs results
|
||||
|
||||
TEST_FILE="testvid.webm"
|
||||
OUTPUT_DIR="phase5_test_outputs"
|
||||
LOG_FILE="phase5_test_results.log"
|
||||
RESULTS_TABLE="PHASE5_TEST_RESULTS.md"
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Create output directory
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
|
||||
# Check if test file exists
|
||||
if [ ! -f "$TEST_FILE" ]; then
|
||||
echo -e "${RED}❌ Test file not found: $TEST_FILE${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get original file size
|
||||
ORIGINAL_SIZE=$(du -b "$TEST_FILE" 2>/dev/null | cut -f1)
|
||||
ORIGINAL_SIZE_MB=$(echo "scale=2; $ORIGINAL_SIZE / 1024 / 1024" | bc)
|
||||
|
||||
echo -e "${BLUE}══════════════════════════════════════════════════════════════${NC}"
|
||||
echo -e "${BLUE}GWENCODER PHASE 5 COMPREHENSIVE TESTING${NC}"
|
||||
echo -e "${BLUE}══════════════════════════════════════════════════════════════${NC}"
|
||||
echo ""
|
||||
echo -e "Test file: ${GREEN}$TEST_FILE${NC} (${ORIGINAL_SIZE_MB} MB)"
|
||||
echo -e "Output directory: ${GREEN}$OUTPUT_DIR${NC}"
|
||||
echo -e "Log file: ${GREEN}$LOG_FILE${NC}"
|
||||
echo -e "Results table: ${GREEN}$RESULTS_TABLE${NC}"
|
||||
echo ""
|
||||
|
||||
# Function to get file size in MB
|
||||
get_file_size_mb() {
|
||||
local file=$1
|
||||
if [ -f "$file" ]; then
|
||||
local size=$(du -b "$file" 2>/dev/null | cut -f1)
|
||||
echo "scale=2; $size / 1024 / 1024" | bc
|
||||
else
|
||||
echo "0"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to calculate compression ratio
|
||||
get_compression_ratio() {
|
||||
local original=$1
|
||||
local output=$2
|
||||
local orig_mb=$(echo "scale=2; $original / 1024 / 1024" | bc)
|
||||
local out_mb=$(get_file_size_mb "$output")
|
||||
if [ "$out_mb" != "0" ] && [ "$orig_mb" != "0" ]; then
|
||||
echo "scale=1; ($orig_mb - $out_mb) / $orig_mb * 100" | bc
|
||||
else
|
||||
echo "0"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to calculate encoding speed (fps if available, or just time)
|
||||
get_encoding_speed() {
|
||||
local log_file=$1
|
||||
# Try to extract fps from FFmpeg output
|
||||
local fps=$(grep -oP 'fps=\K[0-9.]+' "$log_file" 2>/dev/null | tail -1)
|
||||
if [ -n "$fps" ]; then
|
||||
echo "${fps} fps"
|
||||
else
|
||||
echo "N/A"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to run test and log results
|
||||
run_test() {
|
||||
local test_num=$1
|
||||
local test_name=$2
|
||||
local mode=$3
|
||||
local flags=$4
|
||||
local description=$5
|
||||
|
||||
echo ""
|
||||
echo -e "${YELLOW}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo -e "${BLUE}TEST $test_num: $test_name${NC}"
|
||||
echo -e "${YELLOW}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo -e "Mode: ${GREEN}$mode${NC}"
|
||||
echo -e "Flags: ${GREEN}$flags${NC}"
|
||||
echo -e "Description: $description"
|
||||
echo ""
|
||||
|
||||
# Clean up old output files
|
||||
find . -maxdepth 1 -name "*GWELL.*" -type f -delete 2>/dev/null
|
||||
|
||||
start_time=$(date +%s.%N)
|
||||
|
||||
# Build command
|
||||
cmd="./gwencoder $mode $flags"
|
||||
echo -e "${BLUE}Running: ${NC}$cmd"
|
||||
echo ""
|
||||
|
||||
# Run encoding and capture output
|
||||
output_log="$OUTPUT_DIR/test${test_num}_${test_name}.log"
|
||||
$cmd 2>&1 | tee "$output_log"
|
||||
|
||||
end_time=$(date +%s.%N)
|
||||
duration=$(echo "$end_time - $start_time" | bc)
|
||||
duration_rounded=$(printf "%.1f" "$duration")
|
||||
|
||||
# Find output file
|
||||
output_file=$(find . -maxdepth 1 -name "*GWELL.*" -type f -newer "$TEST_FILE" 2>/dev/null | head -1)
|
||||
|
||||
if [ -n "$output_file" ]; then
|
||||
file_size_mb=$(get_file_size_mb "$output_file")
|
||||
compression=$(get_compression_ratio "$ORIGINAL_SIZE" "$output_file")
|
||||
speed=$(get_encoding_speed "$output_log")
|
||||
|
||||
# Move output file to test directory
|
||||
mv "$output_file" "$OUTPUT_DIR/" 2>/dev/null
|
||||
output_file="$OUTPUT_DIR/$(basename "$output_file")"
|
||||
|
||||
echo ""
|
||||
echo -e "${GREEN}✅ Test completed${NC}"
|
||||
echo -e " Duration: ${GREEN}${duration_rounded}s${NC}"
|
||||
echo -e " File size: ${GREEN}${file_size_mb} MB${NC}"
|
||||
echo -e " Compression: ${GREEN}${compression}%${NC}"
|
||||
echo -e " Speed: ${GREEN}$speed${NC}"
|
||||
echo -e " Output: ${GREEN}$output_file${NC}"
|
||||
|
||||
# Log to CSV
|
||||
echo "$test_num|$test_name|$mode|$flags|$duration_rounded|$file_size_mb|$compression|$speed|✅|$output_file" >> "$LOG_FILE"
|
||||
else
|
||||
echo ""
|
||||
echo -e "${RED}❌ Test failed - no output file found${NC}"
|
||||
echo "$test_num|$test_name|$mode|$flags|N/A|N/A|N/A|N/A|❌|N/A" >> "$LOG_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
# Initialize log file
|
||||
echo "Test#|Test Name|Mode|Flags|Duration (s)|Size (MB)|Compression %|Speed|Status|Output File" > "$LOG_FILE"
|
||||
|
||||
# Test 1: Default settings (Fast mode)
|
||||
run_test "1" "Default Fast" "--fast" "" "Default settings: AV1 preset 10, CRF 28, stream reordering enabled"
|
||||
|
||||
# Test 2: Fast with AV1 advanced options
|
||||
run_test "2" "Fast AV1 Advanced" "--fast" "--av1-preset 8 --av1-crf 30" "Fast mode with custom preset and CRF"
|
||||
|
||||
# Test 3: Fast with audio options
|
||||
run_test "3" "Fast Audio Options" "--fast" "--audio-quality balanced --audio-stereo" "Fast mode with balanced audio quality and stereo downmix"
|
||||
|
||||
# Test 4: Web mode (different container)
|
||||
run_test "4" "Web Mode" "--web" "" "Web mode: WEBM container, CRF 35, optimized for streaming"
|
||||
|
||||
# Test 5: Web with maxrate cap
|
||||
run_test "5" "Web Maxrate" "--web" "--av1-maxrate 5000" "Web mode with 5Mbps maxrate cap"
|
||||
|
||||
# Test 6: Tiny mode (maximum compression)
|
||||
run_test "6" "Tiny Mode" "--tiny" "" "Tiny mode: MP4 container, CRF 42, maximum compression"
|
||||
|
||||
# Test 7: HQ mode (high quality)
|
||||
run_test "7" "HQ Mode" "--hq" "" "HQ mode: MKV container, CRF 22, high quality preset"
|
||||
|
||||
# Test 8: Fast with subtitle extraction
|
||||
run_test "8" "Fast Extract Subs" "--fast" "--extract-subs" "Fast mode with subtitle extraction"
|
||||
|
||||
# Test 9: Fast with force transcode
|
||||
run_test "9" "Fast Force Transcode" "--fast" "--force-transcode" "Fast mode with force transcode enabled"
|
||||
|
||||
# Test 10: Fast with all audio options
|
||||
run_test "10" "Fast Full Audio" "--fast" "--audio-quality high --audio-create-downmix" "Fast mode with high quality audio and downmix creation"
|
||||
|
||||
# Generate results table
|
||||
echo "# Phase 5 Test Results" > "$RESULTS_TABLE"
|
||||
echo "" >> "$RESULTS_TABLE"
|
||||
echo "## Test Overview" >> "$RESULTS_TABLE"
|
||||
echo "" >> "$RESULTS_TABLE"
|
||||
echo "**Test File**: \`$TEST_FILE\` (${ORIGINAL_SIZE_MB} MB)" >> "$RESULTS_TABLE"
|
||||
echo "**Test Date**: $(date)" >> "$RESULTS_TABLE"
|
||||
echo "" >> "$RESULTS_TABLE"
|
||||
echo "## Results Table" >> "$RESULTS_TABLE"
|
||||
echo "" >> "$RESULTS_TABLE"
|
||||
echo "| Test# | Test Name | Mode | Flags | Duration (s) | Size (MB) | Compression % | Speed | Status |" >> "$RESULTS_TABLE"
|
||||
echo "|-------|-----------|------|-------|--------------|-----------|---------------|-------|--------|" >> "$RESULTS_TABLE"
|
||||
|
||||
# Add results to table (skip header)
|
||||
tail -n +2 "$LOG_FILE" | while IFS='|' read -r num name mode flags duration size compression speed status output; do
|
||||
echo "| $num | $name | $mode | \`$flags\` | $duration | $size | $compression | $speed | $status |" >> "$RESULTS_TABLE"
|
||||
done
|
||||
|
||||
echo "" >> "$RESULTS_TABLE"
|
||||
echo "## Summary" >> "$RESULTS_TABLE"
|
||||
echo "" >> "$RESULTS_TABLE"
|
||||
echo "Total tests: $(tail -n +2 "$LOG_FILE" | wc -l)" >> "$RESULTS_TABLE"
|
||||
echo "Successful: $(grep -c "✅" "$LOG_FILE")" >> "$RESULTS_TABLE"
|
||||
echo "Failed: $(grep -c "❌" "$LOG_FILE")" >> "$RESULTS_TABLE"
|
||||
|
||||
# Print summary
|
||||
echo ""
|
||||
echo -e "${BLUE}══════════════════════════════════════════════════════════════${NC}"
|
||||
echo -e "${BLUE}TEST SUMMARY${NC}"
|
||||
echo -e "${BLUE}══════════════════════════════════════════════════════════════${NC}"
|
||||
echo ""
|
||||
echo -e "Total tests: ${GREEN}$(tail -n +2 "$LOG_FILE" | wc -l)${NC}"
|
||||
echo -e "Successful: ${GREEN}$(grep -c "✅" "$LOG_FILE")${NC}"
|
||||
echo -e "Failed: ${RED}$(grep -c "❌" "$LOG_FILE")${NC}"
|
||||
echo ""
|
||||
echo -e "Full results logged to: ${GREEN}$LOG_FILE${NC}"
|
||||
echo -e "Results table: ${GREEN}$RESULTS_TABLE${NC}"
|
||||
echo -e "Individual test outputs in: ${GREEN}$OUTPUT_DIR/${NC}"
|
||||
echo ""
|
||||
|
||||
70
gwencoder/scripts/run_tests.sh
Executable file
70
gwencoder/scripts/run_tests.sh
Executable file
@@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Quick test script for different encoding combinations
|
||||
# Tests default settings and 2-3 other combinations
|
||||
|
||||
TEST_FILE="../tests/artifacts/testvid.webm"
|
||||
RESULTS="../tests/logs/test_results.txt"
|
||||
|
||||
echo "══════════════════════════════════════════════════════════════" | tee "$RESULTS"
|
||||
echo "GWENCODER PHASE 2 TEST RUNS" | tee -a "$RESULTS"
|
||||
echo "══════════════════════════════════════════════════════════════" | tee -a "$RESULTS"
|
||||
echo "" | tee -a "$RESULTS"
|
||||
echo "Test file: $TEST_FILE" | tee -a "$RESULTS"
|
||||
echo "Started: $(date)" | tee -a "$RESULTS"
|
||||
echo "" | tee -a "$RESULTS"
|
||||
|
||||
# Test 1: Default settings (Fast mode)
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | tee -a "$RESULTS"
|
||||
echo "TEST 1: Default Settings (--fast mode)" | tee -a "$RESULTS"
|
||||
echo "Settings: Custom quality preset, stream reordering enabled, CRF 28" | tee -a "$RESULTS"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | tee -a "$RESULTS"
|
||||
start1=$(date +%s)
|
||||
./gwencoder --fast 2>&1 | tee ../tests/logs/test1_output.log | grep -E "(Encoding|CRF|preset|audio|Reordering|complete|size|Duration|Resolution)" | tee -a "$RESULTS"
|
||||
end1=$(date +%s)
|
||||
duration1=$((end1 - start1))
|
||||
output1=$(ls -t testvid-AV1-Fast-GWELL.mkv 2>/dev/null | head -1)
|
||||
size1=$(du -h "$output1" 2>/dev/null | cut -f1)
|
||||
echo "Duration: ${duration1}s | Output: $output1 ($size1)" | tee -a "$RESULTS"
|
||||
echo "" | tee -a "$RESULTS"
|
||||
|
||||
# Test 2: Web mode (different container, higher CRF)
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | tee -a "$RESULTS"
|
||||
echo "TEST 2: Web Mode (--web)" | tee -a "$RESULTS"
|
||||
echo "Settings: WEBM container, CRF 35, stream reordering enabled" | tee -a "$RESULTS"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | tee -a "$RESULTS"
|
||||
start2=$(date +%s)
|
||||
./gwencoder --web 2>&1 | tee ../tests/logs/test2_output.log | grep -E "(Encoding|CRF|preset|audio|Reordering|complete|size|Duration|Resolution)" | tee -a "$RESULTS"
|
||||
end2=$(date +%s)
|
||||
duration2=$((end2 - start2))
|
||||
output2=$(ls -t testvid-AV1-Web-GWELL.webm 2>/dev/null | head -1)
|
||||
size2=$(du -h "$output2" 2>/dev/null | cut -f1)
|
||||
echo "Duration: ${duration2}s | Output: $output2 ($size2)" | tee -a "$RESULTS"
|
||||
echo "" | tee -a "$RESULTS"
|
||||
|
||||
# Test 3: Tiny mode (maximum compression)
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | tee -a "$RESULTS"
|
||||
echo "TEST 3: Tiny Mode (--tiny)" | tee -a "$RESULTS"
|
||||
echo "Settings: MP4 container, CRF 42, maximum compression" | tee -a "$RESULTS"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | tee -a "$RESULTS"
|
||||
start3=$(date +%s)
|
||||
./gwencoder --tiny 2>&1 | tee ../tests/logs/test3_output.log | grep -E "(Encoding|CRF|preset|audio|Reordering|complete|size|Duration|Resolution)" | tee -a "$RESULTS"
|
||||
end3=$(date +%s)
|
||||
duration3=$((end3 - start3))
|
||||
output3=$(ls -t testvid-AV1-Tiny-GWELL.mp4 2>/dev/null | head -1)
|
||||
size3=$(du -h "$output3" 2>/dev/null | cut -f1)
|
||||
echo "Duration: ${duration3}s | Output: $output3 ($size3)" | tee -a "$RESULTS"
|
||||
echo "" | tee -a "$RESULTS"
|
||||
|
||||
# Summary
|
||||
echo "══════════════════════════════════════════════════════════════" | tee -a "$RESULTS"
|
||||
echo "TEST SUMMARY" | tee -a "$RESULTS"
|
||||
echo "══════════════════════════════════════════════════════════════" | tee -a "$RESULTS"
|
||||
echo "Test 1 (Fast): ${duration1}s | $size1" | tee -a "$RESULTS"
|
||||
echo "Test 2 (Web): ${duration2}s | $size2" | tee -a "$RESULTS"
|
||||
echo "Test 3 (Tiny): ${duration3}s | $size3" | tee -a "$RESULTS"
|
||||
echo "" | tee -a "$RESULTS"
|
||||
echo "Completed: $(date)" | tee -a "$RESULTS"
|
||||
echo "" | tee -a "$RESULTS"
|
||||
echo "Full results saved to: $RESULTS" | tee -a "$RESULTS"
|
||||
|
||||
86
gwencoder/scripts/test_combinations.sh
Executable file
86
gwencoder/scripts/test_combinations.sh
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Test script for Gwencoder Phase 2 features
|
||||
# Tests different combinations of settings
|
||||
|
||||
TEST_FILE="testvid.webm"
|
||||
OUTPUT_DIR="test_outputs"
|
||||
LOG_FILE="test_results.log"
|
||||
|
||||
# Create output directory
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
|
||||
echo "══════════════════════════════════════════════════════════════"
|
||||
echo "GWENCODER PHASE 2 FEATURE TESTING"
|
||||
echo "══════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
echo "Test file: $TEST_FILE"
|
||||
echo "Output directory: $OUTPUT_DIR"
|
||||
echo "Log file: $LOG_FILE"
|
||||
echo ""
|
||||
|
||||
# Function to run test and log results
|
||||
run_test() {
|
||||
local test_name=$1
|
||||
local mode=$2
|
||||
local description=$3
|
||||
|
||||
echo ""
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "TEST: $test_name"
|
||||
echo "Mode: $mode"
|
||||
echo "Description: $description"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo ""
|
||||
|
||||
start_time=$(date +%s)
|
||||
|
||||
# Run encoding
|
||||
./gwencoder "$mode" 2>&1 | tee "$OUTPUT_DIR/${test_name}_output.log"
|
||||
|
||||
end_time=$(date +%s)
|
||||
duration=$((end_time - start_time))
|
||||
|
||||
# Find output file
|
||||
output_file=$(find . -maxdepth 1 -name "*${mode}*GWELL.*" -type f -newer "$TEST_FILE" 2>/dev/null | head -1)
|
||||
|
||||
if [ -n "$output_file" ]; then
|
||||
file_size=$(du -h "$output_file" | cut -f1)
|
||||
echo ""
|
||||
echo "✅ Test completed in ${duration}s"
|
||||
echo "📁 Output: $output_file ($file_size)"
|
||||
echo ""
|
||||
echo "$test_name|$mode|$duration|$file_size|$output_file" >> "$LOG_FILE"
|
||||
else
|
||||
echo ""
|
||||
echo "❌ Test failed - no output file found"
|
||||
echo ""
|
||||
echo "$test_name|$mode|FAILED|N/A|N/A" >> "$LOG_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
# Initialize log file
|
||||
echo "Test Name|Mode|Duration (s)|File Size|Output File" > "$LOG_FILE"
|
||||
|
||||
# Test 1: Default settings (Fast mode)
|
||||
run_test "test1_defaults" "--fast" "Default settings: custom quality preset, stream reordering enabled, subtitle conversion enabled"
|
||||
|
||||
# Test 2: Web mode (different container and CRF)
|
||||
run_test "test2_web" "--web" "Web mode: WEBM container, higher CRF, stream reordering enabled"
|
||||
|
||||
# Test 3: Tiny mode (maximum compression)
|
||||
run_test "test3_tiny" "--tiny" "Tiny mode: MP4 container, high CRF, stream reordering enabled"
|
||||
|
||||
# Test 4: High Quality mode
|
||||
run_test "test4_hq" "--hq" "HQ mode: MKV container, lower CRF, stream reordering enabled"
|
||||
|
||||
echo ""
|
||||
echo "══════════════════════════════════════════════════════════════"
|
||||
echo "TEST SUMMARY"
|
||||
echo "══════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
cat "$LOG_FILE" | column -t -s'|'
|
||||
echo ""
|
||||
echo "Full results logged to: $LOG_FILE"
|
||||
echo "Individual test outputs in: $OUTPUT_DIR/"
|
||||
|
||||
Reference in New Issue
Block a user