Update transcode_bench.py

This commit is contained in:
2025-10-12 20:20:32 +13:00
parent fb8e0404a6
commit b5d3863a48

View File

@@ -370,9 +370,13 @@ class TranscodeJob:
self.fps = self._parse_fps(stderr)
self.success = self.process.returncode == 0
# Store stderr for debugging
self.stderr = stderr
except Exception as e:
self.success = False
self.end_time = time.time()
self.stderr = str(e)
def _parse_fps(self, ffmpeg_output: str) -> float:
"""Parse average FPS from FFmpeg output."""
@@ -432,6 +436,14 @@ class Benchmark:
avg_fps = sum(job.fps for job in jobs) / len(jobs) if jobs else 0.0
return True, avg_fps
# If failed, print first error for debugging
for job in jobs:
if not job.success and hasattr(job, 'stderr'):
# Only print first few lines of error
error_lines = job.stderr.split('\n')[:5]
print(f"\n Debug - First error: {' '.join(error_lines)}")
break
return False, 0.0
def find_max_streams(self, min_fps: float = 30.0) -> int:
@@ -442,9 +454,23 @@ class Benchmark:
print(f"\nBenchmarking with {self.accel_name}...")
print("Finding maximum simultaneous 1080p streams at real-time or better...\n")
# First verify that 1 stream works
print(f"Testing 1 simultaneous stream...", end=' ', flush=True)
success, avg_fps = self.run_parallel_transcodes(1)
if not success:
print(f"✗ (failed)")
return 0
if avg_fps < min_fps:
print(f"✗ (avg {avg_fps:.1f} fps - below real-time)")
return 0
print(f"✓ (avg {avg_fps:.1f} fps)")
max_streams = 1
# Binary search bounds
low, high = 1, 64
max_streams = 0
low, high = 2, 64
while low <= high:
mid = (low + high) // 2