Files
VMAFOptimiser/test_run.py
2026-01-03 11:57:26 +01:00

43 lines
1.2 KiB
Python

import os
import subprocess
from pathlib import Path
# Setup
TEST_DIR = Path("test_media")
TEST_DIR.mkdir(exist_ok=True)
TEST_FILE = TEST_DIR / "test_video.mkv"
print("--- SMART ENCODER TEST ---")
# 1. Create Dummy Video (10s, 1080p, noise to ensure it's not trivial)
if not TEST_FILE.exists():
print("Generating dummy video...")
# Generate 10s video with noise
cmd = [
"ffmpeg", "-y", "-f", "lavfi", "-i", "testsrc=duration=10:size=1920x1080:rate=30",
"-f", "lavfi", "-i", "sine=frequency=1000:duration=10",
"-c:v", "libx264", "-pix_fmt", "yuv420p", "-b:v", "5M",
"-c:a", "aac",
str(TEST_FILE)
]
subprocess.run(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
print(f"Created {TEST_FILE}")
# 2. Run Encoder in Debug Mode
print("\nRunning Smart Encoder on test file...")
print("(This should show detailed ffmpeg output)")
print("="*60)
cmd = [
"python", "smart_gpu_encoder.py",
"--tv-dir", str(TEST_DIR.resolve()),
"--content-dir", str(TEST_DIR.resolve()),
"--jobs", "1",
"--debug"
]
subprocess.run(cmd)
print("\n--- TEST COMPLETE ---")
print("Check for .mkv files in C:\\Users\\bnair\\Videos\\encodes")