# -*- coding: utf-8 -*- """临时诊断脚本:以奇数尺寸 1707x1067 验证取偶修复""" import os import sys import time import subprocess os.chdir(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from devices.screen_recorder import RecordingManager mgr = RecordingManager() print('screen_size:', mgr.screen_size, flush=True) r = mgr.start_recording_ffmpeg('TEST_SESSION', 'TEST_PATIENT', [0, 0, 1707, 1067]) print('start result:', r, flush=True) for i in range(5): time.sleep(2) proc = mgr._ffmpeg_processes.get('screen') alive = proc.poll() if proc else 'no-proc' print(f'[{i}] proc.poll={alive}', flush=True) rr = mgr.stop_recording_ffmpeg('TEST_SESSION') print('stop result:', rr, flush=True) time.sleep(1) base = mgr._ffmpeg_meta.get('screen') or {} base_path = base.get('base_path') if base_path: for f in sorted(os.listdir(base_path)): p = os.path.join(base_path, f) print(f'FILE: {f} size={os.path.getsize(p)}', flush=True) log = os.path.join(base_path, 'ffmpeg_screen.log') if os.path.exists(log): print('--- ffmpeg_screen.log ---', flush=True) with open(log, 'r', encoding='utf-8', errors='ignore') as fh: print(fh.read()[-2000:], flush=True) print('DONE', flush=True)