diff --git a/.gitignore b/.gitignore index ca0effe..548ba94 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,4 @@ dist.zip __pycache__ models *.log - *.yolo_detection \ No newline at end of file +yolo_detection.log diff --git a/__pycache__/_minio.cpython-312.pyc b/__pycache__/_minio.cpython-312.pyc index 60cea3c..8553475 100644 Binary files a/__pycache__/_minio.cpython-312.pyc and b/__pycache__/_minio.cpython-312.pyc differ diff --git a/__pycache__/config.cpython-312.pyc b/__pycache__/config.cpython-312.pyc index c96f1d6..b38f4dc 100644 Binary files a/__pycache__/config.cpython-312.pyc and b/__pycache__/config.cpython-312.pyc differ diff --git a/__pycache__/detectionThread.cpython-312.pyc b/__pycache__/detectionThread.cpython-312.pyc index e21d29f..f64f9f8 100644 Binary files a/__pycache__/detectionThread.cpython-312.pyc and b/__pycache__/detectionThread.cpython-312.pyc differ diff --git a/__pycache__/ffmpegStreamer.cpython-312.pyc b/__pycache__/ffmpegStreamer.cpython-312.pyc index 9d61b80..8656a6c 100644 Binary files a/__pycache__/ffmpegStreamer.cpython-312.pyc and b/__pycache__/ffmpegStreamer.cpython-312.pyc differ diff --git a/__pycache__/global_data.cpython-312.pyc b/__pycache__/global_data.cpython-312.pyc index 28764c7..72cc17e 100644 Binary files a/__pycache__/global_data.cpython-312.pyc and b/__pycache__/global_data.cpython-312.pyc differ diff --git a/__pycache__/log.cpython-312.pyc b/__pycache__/log.cpython-312.pyc index 34433d3..73d6712 100644 Binary files a/__pycache__/log.cpython-312.pyc and b/__pycache__/log.cpython-312.pyc differ diff --git a/__pycache__/server.cpython-312.pyc b/__pycache__/server.cpython-312.pyc index efc2a30..2d941db 100644 Binary files a/__pycache__/server.cpython-312.pyc and b/__pycache__/server.cpython-312.pyc differ diff --git a/config.py b/config.py index 8b21d24..63d0b81 100644 --- a/config.py +++ b/config.py @@ -69,5 +69,16 @@ def get_default_config(): 'check_interval': 5, 'adjust_threshold': 5 }, - 'model_path': 'models' + 'model_path': 'models', + # 添加上传配置 + 'upload': { + 'enabled': True, + 'max_file_size': 1024 * 1024 * 1024, # 1GB + 'chunk_size': 1024 * 1024 * 5, # 5MB + 'allowed_extensions': ['.pt', '.pth', '.onnx', '.engine'], + 'uploads_dir': 'uploads', + 'temp_dir': 'temp_uploads', + 'encrypted_models_dir': 'encrypted_models', + 'session_expire_hours': 24 + }, } diff --git a/detectionThread.py b/detectionThread.py index 99ecd33..ff615eb 100644 --- a/detectionThread.py +++ b/detectionThread.py @@ -1,8 +1,10 @@ import datetime import gc +import hashlib import json import os import queue +import tempfile import threading import time import traceback @@ -17,89 +19,131 @@ from _minio import MinioUploader from log import logger from global_data import gd from detection_render import OptimizedDetectionRenderer +from mandatory_model_crypto import MandatoryModelEncryptor +# detectionThread.py - 修改 ModelManager 类 + class ModelManager: """模型管理器,支持多模型和加密模型""" def __init__(self, config): self.config = config self.models_dir = "models" + self.encrypted_models_dir = config.get('upload', {}).get('encrypted_models_dir', 'encrypted_models') + + # 确保目录存在 os.makedirs(self.models_dir, exist_ok=True) + os.makedirs(self.encrypted_models_dir, exist_ok=True) + + # 模型加载缓存(避免重复解密) + self.model_cache = {} + self.cache_lock = threading.Lock() def load_model(self, model_config, require_verification=False): - """加载单个模型(支持加密),可选密钥验证""" + """加载单个模型 - 从本地加载加密模型""" try: model_path = model_config['path'] encrypted = model_config.get('encrypted', False) encryption_key = model_config.get('encryption_key') # 构建本地路径 - local_path = os.path.join(self.models_dir, os.path.basename(model_path)) - - # 下载模型(如果不存在且提供下载地址) - if not os.path.exists(local_path): - download_url = model_config.get('download_url') - if download_url: - if not self.download_model(model_config, local_path): - logger.warning(f"模型文件不存在且下载失败: {local_path}") - return None, None # 返回模型和验证结果 + if encrypted: + # 加密模型从加密模型目录加载 + if model_path.startswith('encrypted_models/'): + # 相对路径 + local_path = os.path.join(self.encrypted_models_dir, os.path.basename(model_path)) + elif os.path.isabs(model_path): + # 绝对路径 + local_path = model_path else: - logger.warning(f"模型文件不存在: {local_path}") - return None, None + # 尝试在加密目录中查找 + model_filename = os.path.basename(model_path) + if not model_filename.endswith('.enc'): + model_filename += '.enc' + local_path = os.path.join(self.encrypted_models_dir, model_filename) + else: + # 普通模型从普通模型目录加载 + local_path = os.path.join(self.models_dir, os.path.basename(model_path)) + + # 检查模型文件是否存在 + if not os.path.exists(local_path): + logger.error(f"模型文件不存在: {local_path}") + return None, {'success': False, 'error': f'模型文件不存在: {local_path}'} + + # 检查缓存 + cache_key = f"{local_path}_{hashlib.md5(encryption_key.encode()).hexdigest()[:8]}" if encryption_key else local_path + + with self.cache_lock: + if cache_key in self.model_cache: + logger.info(f"使用缓存的模型: {model_path}") + cached_info = self.model_cache[cache_key] + return cached_info['model'], cached_info.get('verification_result', {'success': True}) # 验证加密模型密钥(如果需要) verification_result = None + model = None + if encrypted and encryption_key: - if require_verification: - verification_result = self.verify_model_key(local_path, encryption_key) - if not verification_result.get('success', False): - logger.error(f"加密模型密钥验证失败: {model_path}") - return None, verification_result - logger.info(f"加密模型密钥验证成功: {model_path}") - - # 解密并加载模型 + # 创建临时解密模型 try: - from mandatory_model_crypto import MandatoryModelEncryptor - encryptor = MandatoryModelEncryptor() + from mandatory_model_crypto import MandatoryModelValidator + validator = MandatoryModelValidator() - # 解密模型 - decrypt_result = encryptor.decrypt_model(local_path, encryption_key, - verify_key=require_verification) + # 解密模型到内存 + decrypt_result = validator.decrypt_and_verify(local_path, encryption_key) - if not decrypt_result.get('success', False): - logger.error(f"解密模型失败: {model_path}") + if not decrypt_result['success']: + logger.error(f"解密模型失败: {model_path} - {decrypt_result.get('error', '未知错误')}") return None, decrypt_result - decrypted_path = decrypt_result.get('temp_path') - if not decrypted_path: - logger.error(f"未获取到解密后的模型路径: {model_path}") - return None, decrypt_result + verification_result = { + 'success': True, + 'model_hash': decrypt_result.get('model_hash', ''), + 'original_size': decrypt_result.get('original_size', 0) + } - logger.info(f"解密模型成功: {model_path}") - model = YOLO(decrypted_path) + # 解密数据 + decrypted_data = decrypt_result['decrypted_data'] + + # 保存到临时文件并加载 + with tempfile.NamedTemporaryFile(delete=False, suffix='.pt') as tmp: + tmp.write(decrypted_data) + temp_path = tmp.name + + # 加载YOLO模型 + model = YOLO(temp_path) # 清理临时文件 try: - os.unlink(decrypted_path) + os.unlink(temp_path) except Exception as e: logger.warning(f"清理临时文件失败: {str(e)}") + logger.info(f"加密模型解密加载成功: {model_path}") + except ImportError: logger.error("mandatory_model_crypto模块未找到,无法处理加密模型") return None, {'success': False, 'error': '加密模块未找到'} except Exception as e: logger.error(f"加密模型处理失败: {str(e)}") return None, {'success': False, 'error': str(e)} + elif encrypted and not encryption_key: + # 加密模型但没有密钥 + logger.error(f"加密模型但未提供密钥: {model_path}") + return None, {'success': False, 'error': '加密模型需要密钥'} else: # 普通模型加载 - if encrypted and not encryption_key: - logger.warning(f"模型标记为加密但未提供密钥: {model_path}") - model = YOLO(local_path) - verification_result = {'success': True} if not encrypted else { - 'success': False, - 'error': '模型标记为加密但未提供密钥' - } + try: + model = YOLO(local_path) + logger.info(f"普通模型加载成功: {local_path}") + verification_result = {'success': True} + except Exception as e: + logger.error(f"加载普通模型失败: {str(e)}") + return None, {'success': False, 'error': str(e)} + + if model is None: + return None, verification_result or {'success': False, 'error': '模型加载失败'} # 应用设备配置 device = model_config.get('device', 'cuda:0' if torch.cuda.is_available() else 'cpu') @@ -110,59 +154,37 @@ class ModelManager: model = model.half() logger.info(f"启用半精度推理: {model_path}") + # 缓存模型 + with self.cache_lock: + self.model_cache[cache_key] = { + 'model': model, + 'verification_result': verification_result, + 'device': device, + 'cached_at': time.time() + } + logger.info(f"模型加载成功: {model_path} -> {device}") - return model, verification_result + return model, verification_result or {'success': True} except Exception as e: logger.error(f"加载模型失败 {model_config.get('path')}: {str(e)}") logger.error(traceback.format_exc()) return None, {'success': False, 'error': str(e)} - def download_model(self, model_config, save_path): - """下载模型文件""" - try: - download_url = model_config.get('download_url') + def clear_cache(self): + """清空模型缓存""" + with self.cache_lock: + self.model_cache.clear() + logger.info("模型缓存已清空") - if not download_url: - logger.error(f"模型无下载地址: {model_config['path']}") - return False - - logger.info(f"下载模型: {download_url} -> {save_path}") - - response = requests.get(download_url, stream=True, timeout=30) - response.raise_for_status() - - total_size = int(response.headers.get('content-length', 0)) - downloaded = 0 - - with open(save_path, 'wb') as f: - for chunk in response.iter_content(chunk_size=8192): - if chunk: - downloaded += len(chunk) - f.write(chunk) - - if total_size > 0: - progress = (downloaded * 100) // total_size - if progress % 25 == 0: # 每25%输出一次 - logger.info(f"下载进度: {progress}%") - - logger.info(f"模型下载完成: {save_path} ({downloaded} 字节)") - return True - - except Exception as e: - logger.error(f"下载模型失败: {str(e)}") - return False - - def verify_model_key(self, path, encryption_key): - """验证模型密钥""" - try: - from mandatory_model_crypto import MandatoryModelEncryptor - encryptor = MandatoryModelEncryptor() - return encryptor.decrypt_model(path, encryption_key, verify_key=True) - except ImportError: - return {'success': False, 'error': '加密模块未找到'} - except Exception as e: - return {'success': False, 'error': str(e)} + def get_cache_info(self): + """获取缓存信息""" + with self.cache_lock: + return { + 'cache_size': len(self.model_cache), + 'cached_models': list(self.model_cache.keys()), + 'total_size': sum(info.get('original_size', 0) for info in self.model_cache.values()) + } class DetectionThread(threading.Thread): @@ -296,14 +318,14 @@ class DetectionThread(threading.Thread): return os.name == 'nt' or os.name == 'win32' def load_models(self): - """加载多个模型 - 简化版本""" + """加载多个模型 - 优化版本,从本地加载""" try: models_config = self.config.get('models', []) if not models_config or not isinstance(models_config, list): logger.error("未找到有效的models配置列表") return False - logger.info(f"开始加载 {len(models_config)} 个模型") + logger.info(f"开始从本地加载 {len(models_config)} 个模型") loaded_models = [] key_verification_results = {} @@ -317,14 +339,11 @@ class DetectionThread(threading.Thread): model_path = model_config.get('path', 'unknown') model_name = os.path.basename(model_path).split('.')[0] - # 强制验证加密模型密钥 - require_verification = model_config.get('encrypted', False) - - # 加载模型(包含密钥验证) + # 加载模型(从本地) logger.info(f"加载模型 {i}: {model_name}") model, verification_result = self.model_manager.load_model( model_config, - require_verification=require_verification + require_verification=True # 总是验证密钥 ) # 记录验证结果 diff --git a/encrypted_models/c9cd25d454e06595.enc b/encrypted_models/c9cd25d454e06595.enc new file mode 100644 index 0000000..d7a6b06 Binary files /dev/null and b/encrypted_models/c9cd25d454e06595.enc differ diff --git a/encrypted_models/d568ab8378383793.enc b/encrypted_models/d568ab8378383793.enc new file mode 100644 index 0000000..0b9f82d Binary files /dev/null and b/encrypted_models/d568ab8378383793.enc differ diff --git a/mandatory_model_crypto.py b/mandatory_model_crypto.py index aba3dfb..6caa795 100644 --- a/mandatory_model_crypto.py +++ b/mandatory_model_crypto.py @@ -1,94 +1,90 @@ -# mandatory_model_crypto.py +# mandatory_model_crypto.py - 强制加密模型验证和解密模块 import os import tempfile import hashlib import pickle import traceback +import time +import secrets +import string from pathlib import Path +import base64 import requests import torch from cryptography.fernet import Fernet from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC -import base64 + from log import logger -class MandatoryModelEncryptor: - """强制模型加密器 - 所有模型必须加密""" +class MandatoryModelValidator: + """强制加密模型验证器 - 只负责验证和解密""" @staticmethod - def encrypt_model(model_path, output_path, password, require_encryption=True): - """加密模型文件 - 强制模式""" - try: - # 读取模型文件 - with open(model_path, 'rb') as f: - model_data = f.read() - - # 计算模型哈希 - model_hash = hashlib.sha256(model_data).hexdigest() - - # 生成加密密钥 - salt = os.urandom(16) - kdf = PBKDF2HMAC( - algorithm=hashes.SHA256(), - length=32, - salt=salt, - iterations=100000, - ) - key = base64.urlsafe_b64encode(kdf.derive(password.encode())) - fernet = Fernet(key) - - # 加密数据 - encrypted_data = fernet.encrypt(model_data) - - # 保存加密数据 - encrypted_payload = { - 'salt': salt, - 'data': encrypted_data, - 'model_hash': model_hash, - 'original_size': len(model_data), - 'encrypted': True, - 'version': '1.0' - } - - with open(output_path, 'wb') as f: - pickle.dump(encrypted_payload, f) - - logger.info(f"模型强制加密成功: {model_path} -> {output_path}") - logger.info(f"模型哈希: {model_hash[:16]}...") - - # 返回密钥信息(用于验证) - return { - 'success': True, - 'model_hash': model_hash, - 'key_hash': hashlib.sha256(key).hexdigest()[:16], - 'output_path': output_path - } - - except Exception as e: - logger.error(f"模型强制加密失败: {str(e)}") - return {'success': False, 'error': str(e)} - - @staticmethod - def decrypt_model(encrypted_path, password, verify_key=True): - """解密模型文件 - 带密钥验证""" + def verify_model_encryption(encrypted_path): + """验证模型是否被正确加密""" try: if not os.path.exists(encrypted_path): - return {'success': False, 'error': '加密模型文件不存在'} + return {'valid': False, 'error': '加密模型文件不存在'} - # 读取加密文件 with open(encrypted_path, 'rb') as f: - encrypted_payload = pickle.load(f) + data = pickle.load(f) - # 验证加密格式 - if not encrypted_payload.get('encrypted', False): - return {'success': False, 'error': '模型未加密'} + # 检查必要的加密字段 + required_fields = ['salt', 'data', 'encrypted', 'model_hash', 'version'] + for field in required_fields: + if field not in data: + return {'valid': False, 'error': f'缺少加密字段: {field}'} + if data.get('encrypted', False) is not True: + return {'valid': False, 'error': '模型未加密'} + + # 验证版本兼容性 + if data.get('version') not in ['1.0', '2.0']: + return {'valid': False, 'error': f'不支持的加密版本: {data.get("version")}'} + + return {'valid': True, 'encrypted_data': data} + + except Exception as e: + return {'valid': False, 'error': f'验证失败: {str(e)}'} + + @staticmethod + def is_properly_encrypted(encrypted_path): + """检查模型是否被正确加密(简化的验证)""" + try: + with open(encrypted_path, 'rb') as f: + data = pickle.load(f) + + # 基本字段检查 + if not isinstance(data, dict): + return False + + required_fields = ['salt', 'data', 'encrypted', 'model_hash'] + for field in required_fields: + if field not in data: + return False + + return data.get('encrypted', False) is True + + except Exception as e: + logger.warning(f"检查加密格式失败: {str(e)}") + return False + + @staticmethod + def decrypt_and_verify(encrypted_path, password, verify_key=True): + """解密模型文件并验证完整性""" + try: + # 先验证加密格式 + verify_result = MandatoryModelValidator.verify_model_encryption(encrypted_path) + if not verify_result['valid']: + return {'success': False, 'error': verify_result['error']} + + encrypted_payload = verify_result['encrypted_data'] salt = encrypted_payload['salt'] encrypted_data = encrypted_payload['data'] - expected_hash = encrypted_payload.get('model_hash', '') + expected_hash = encrypted_payload['model_hash'] # 生成解密密钥 kdf = PBKDF2HMAC( @@ -99,36 +95,41 @@ class MandatoryModelEncryptor: ) key = base64.urlsafe_b64encode(kdf.derive(password.encode())) - # 验证密钥(可选) - if verify_key: - key_hash = hashlib.sha256(key).hexdigest()[:16] - logger.debug(f"解密密钥哈希: {key_hash}") - + # 解密数据 fernet = Fernet(key) - # 解密数据 - decrypted_data = fernet.decrypt(encrypted_data) + try: + decrypted_data = fernet.decrypt(encrypted_data) + except Exception as e: + if "InvalidToken" in str(e) or "Invalid signature" in str(e): + return {'success': False, 'error': '解密密钥错误'} + return {'success': False, 'error': f'解密失败: {str(e)}'} # 验证模型哈希 actual_hash = hashlib.sha256(decrypted_data).hexdigest() - if expected_hash and actual_hash != expected_hash: + if actual_hash != expected_hash: return { 'success': False, 'error': f'模型哈希不匹配: 期望{expected_hash[:16]}..., 实际{actual_hash[:16]}...' } - # 保存到临时文件 - with tempfile.NamedTemporaryFile(delete=False, suffix='.pt') as tmp: - tmp.write(decrypted_data) - temp_path = tmp.name + # 验证文件大小 + original_size = encrypted_payload.get('original_size', 0) + if original_size > 0 and len(decrypted_data) != original_size: + return { + 'success': False, + 'error': f'文件大小不匹配: 期望{original_size}, 实际{len(decrypted_data)}' + } logger.info(f"模型解密验证成功: {encrypted_path}") + logger.debug(f"模型哈希: {actual_hash[:16]}...") return { 'success': True, - 'temp_path': temp_path, 'model_hash': actual_hash, - 'original_size': len(decrypted_data) + 'original_size': len(decrypted_data), + 'decrypted_data': decrypted_data, # 返回解密数据,供后续处理 + 'version': encrypted_payload.get('version', '1.0') } except Exception as e: @@ -138,83 +139,382 @@ class MandatoryModelEncryptor: return {'success': False, 'error': f'解密失败: {error_msg}'} @staticmethod - def is_properly_encrypted(model_path): - """检查模型是否被正确加密""" - try: - with open(model_path, 'rb') as f: - data = pickle.load(f) + def decrypt_model(encrypted_path, password, verify_key=False): + """解密模型文件 - 兼容旧接口""" + return MandatoryModelValidator.decrypt_and_verify( + encrypted_path, password, verify_key=verify_key + ) - # 检查必要的加密字段 - required_fields = ['salt', 'data', 'encrypted', 'model_hash'] - for field in required_fields: - if field not in data: - return False - return data.get('encrypted', False) is True - - except: - return False +class ModelEncryptionService: + """模型加密服务 - 处理密钥生成、验证和加密流程""" @staticmethod - def generate_secure_key(): + def generate_secure_key(length=32): """生成安全的加密密钥""" - # 生成随机密钥 - key = Fernet.generate_key() + # 使用加密安全的随机数生成器 + alphabet = string.ascii_letters + string.digits + "!@#$%^&*" + key = ''.join(secrets.choice(alphabet) for _ in range(length)) - # 生成密钥指纹 - key_hash = hashlib.sha256(key).hexdigest() + # 计算密钥哈希 + key_hash = hashlib.sha256(key.encode()).hexdigest() return { - 'key': key.decode('utf-8'), + 'key': key, 'key_hash': key_hash, 'short_hash': key_hash[:16] } + @staticmethod + def validate_key_strength(key): + """验证密钥强度""" + if len(key) < 16: + return False, "密钥长度至少16位" -class MandatoryModelManager: - """强制加密模型管理器""" + # 检查字符种类 + has_upper = any(c.isupper() for c in key) + has_lower = any(c.islower() for c in key) + has_digit = any(c.isdigit() for c in key) + has_special = any(c in "!@#$%^&*" for c in key) + + if not (has_upper and has_lower and has_digit and has_special): + return False, "密钥应包含大小写字母、数字和特殊字符" + + return True, "密钥强度足够" + + @staticmethod + def create_key_pair(): + """创建密钥对(用于客户端-服务器通信)""" + # 生成主密钥 + master_key = secrets.token_urlsafe(32) + + # 生成验证令牌 + verification_token = hashlib.sha256( + (master_key + str(time.time())).encode() + ).hexdigest()[:20] + + return { + 'master_key': master_key, + 'verification_token': verification_token, + 'created_at': time.time() + } + + +class PreTaskModelValidator: + """任务前模型验证器 - 在创建任务前验证所有模型""" + + def __init__(self, config=None): + self.config = config or {} + self.encrypted_models_dir = self.config.get('encrypted_models_dir', 'encrypted_models') + os.makedirs(self.encrypted_models_dir, exist_ok=True) + + # 验证状态缓存 + self.validation_cache = {} + self.cache_lock = threading.Lock() + self.cache_expiry = 300 # 5分钟缓存有效期 + + def validate_models_before_task(self, task_config): + """在创建任务前验证所有模型和密钥""" + try: + models_config = task_config.get('models', []) + if not models_config: + return { + 'success': False, + 'error': '任务配置中未找到模型列表' + } + + validation_results = [] + all_valid = True + + for i, model_config in enumerate(models_config): + # 检查必要的配置项 + required_fields = ['path', 'encryption_key'] + for field in required_fields: + if field not in model_config: + return { + 'success': False, + 'error': f'模型 {i} 缺少必要字段: {field}' + } + + model_path = model_config['path'] + encryption_key = model_config['encryption_key'] + + # 构建完整的模型文件路径 + full_model_path = self._get_full_model_path(model_path) + + # 验证模型文件是否存在 + if not os.path.exists(full_model_path): + return { + 'success': False, + 'error': f'模型文件不存在: {full_model_path}' + } + + # 验证密钥强度 + key_valid, key_msg = ModelEncryptionService.validate_key_strength(encryption_key) + if not key_valid: + return { + 'success': False, + 'error': f'模型 {i} 密钥强度不足: {key_msg}' + } + + # 验证密钥是否正确(尝试解密) + validator = MandatoryModelValidator() + decrypt_result = validator.decrypt_and_verify(full_model_path, encryption_key) + + validation_result = { + 'model_index': i, + 'model_path': model_path, + 'full_path': full_model_path, + 'file_exists': True, + 'key_valid': decrypt_result['success'], + 'model_hash': decrypt_result.get('model_hash', '')[:16] if decrypt_result['success'] else '', + 'model_size': decrypt_result.get('original_size', 0) if decrypt_result['success'] else 0, + 'validation_time': time.time() + } + + if not decrypt_result['success']: + validation_result['error'] = decrypt_result.get('error', '验证失败') + all_valid = False + + validation_results.append(validation_result) + + return { + 'success': all_valid, + 'valid': all_valid, + 'total_models': len(models_config), + 'valid_models': sum(1 for r in validation_results if r['key_valid']), + 'validation_results': validation_results, + 'timestamp': time.time() + } + + except Exception as e: + logger.error(f"预验证模型失败: {str(e)}") + return { + 'success': False, + 'error': f'预验证失败: {str(e)}' + } + + def verify_single_model(self, model_path, encryption_key): + """验证单个模型""" + try: + # 构建完整路径 + full_model_path = self._get_full_model_path(model_path) + + # 检查文件是否存在 + if not os.path.exists(full_model_path): + return { + 'success': False, + 'error': f'模型文件不存在: {full_model_path}' + } + + # 验证密钥强度 + key_valid, key_msg = ModelEncryptionService.validate_key_strength(encryption_key) + if not key_valid: + return { + 'success': False, + 'error': f'密钥强度不足: {key_msg}' + } + + # 解密验证 + validator = MandatoryModelValidator() + decrypt_result = validator.decrypt_and_verify(full_model_path, encryption_key) + + if decrypt_result['success']: + return { + 'success': True, + 'valid': True, + 'model_hash': decrypt_result.get('model_hash', '')[:16], + 'model_size': decrypt_result.get('original_size', 0), + 'file_path': full_model_path, + 'timestamp': time.time() + } + else: + return { + 'success': False, + 'valid': False, + 'error': decrypt_result.get('error', '验证失败'), + 'timestamp': time.time() + } + + except Exception as e: + logger.error(f"验证单个模型失败: {str(e)}") + return { + 'success': False, + 'error': f'验证失败: {str(e)}' + } + + def _get_full_model_path(self, model_path): + """获取完整的模型文件路径""" + if os.path.isabs(model_path): + return model_path + + # 如果路径以 encrypted_models/ 开头 + if model_path.startswith('encrypted_models/'): + model_filename = os.path.basename(model_path) + return os.path.join(self.encrypted_models_dir, model_filename) + + # 否则直接使用文件名 + model_filename = os.path.basename(model_path) + return os.path.join(self.encrypted_models_dir, model_filename) + + def get_model_info(self, model_path): + """获取模型信息(不验证密钥)""" + try: + full_model_path = self._get_full_model_path(model_path) + + if not os.path.exists(full_model_path): + return None + + verify_result = MandatoryModelValidator().verify_model_encryption(full_model_path) + + if verify_result['valid']: + data = verify_result['encrypted_data'] + return { + 'encrypted': True, + 'model_hash': data.get('model_hash', '')[:16], + 'original_size': data.get('original_size', 0), + 'version': data.get('version', 'unknown'), + 'file_path': full_model_path, + 'file_size': os.path.getsize(full_model_path) + } + return None + + except Exception as e: + logger.error(f"获取模型信息失败: {str(e)}") + return None + + +class SecureModelManager: + """安全模型管理器 - 负责下载、验证、加载加密模型""" def __init__(self, config): self.config = config - self.models_dir = "encrypted_models" + self.models_dir = config.get('models_dir', 'models') + self.encrypted_models_dir = config.get('encrypted_models_dir', 'encrypted_models') os.makedirs(self.models_dir, exist_ok=True) + os.makedirs(self.encrypted_models_dir, exist_ok=True) - # 加载加密器 - self.encryptor = MandatoryModelEncryptor() + # 验证器实例 + self.validator = MandatoryModelValidator() + self.pre_validator = PreTaskModelValidator(config) # 模型缓存 self.model_cache = {} + self.cache_lock = threading.Lock() + self.cache_expiry = 600 # 10分钟缓存 - def load_encrypted_model(self, model_config): - """加载加密模型 - 必须提供密钥""" + # 验证状态记录 + self.verification_status = {} + self.verification_expiry = 300 # 5分钟验证缓存 + + def ensure_model_available(self, model_config): + """确保模型可用:验证模型文件存在""" try: - model_path = model_config['path'] - encryption_key = model_config.get('encryption_key') + model_path = model_config.get('path') + if not model_path: + return {'available': False, 'error': '模型路径未配置'} - # 必须提供密钥 - if not encryption_key: - raise ValueError(f"模型 {model_path} 必须提供加密密钥") + # 获取模型本地路径 + local_path = self._get_local_model_path(model_path, model_config) - # 构建本地路径 - local_path = os.path.join(self.models_dir, os.path.basename(model_path)) - - # 检查本地文件是否存在 + # 检查模型文件是否存在 if not os.path.exists(local_path): - # 尝试下载(如果提供下载地址) - if not self.download_encrypted_model(model_config, local_path): - raise FileNotFoundError(f"加密模型文件不存在且无法下载: {local_path}") + return {'available': False, 'error': f'模型文件不存在: {local_path}'} - # 验证是否为正确加密的模型 - if not self.encryptor.is_properly_encrypted(local_path): - raise ValueError(f"模型文件未正确加密: {local_path}") + # 验证加密格式 + verify_result = self.validator.verify_model_encryption(local_path) + if not verify_result['valid']: + return {'available': False, 'error': f'模型加密格式无效: {verify_result.get("error", "未知错误")}'} - # 解密模型 - decrypt_result = self.encryptor.decrypt_model(local_path, encryption_key) + return { + 'available': True, + 'local_path': local_path, + 'model_hash': verify_result['encrypted_data'].get('model_hash', '')[:16] + } + except Exception as e: + return {'available': False, 'error': f'确保模型可用失败: {str(e)}'} + + def verify_model_key(self, model_config, encryption_key): + """验证模型密钥 - 这是创建任务的前置条件""" + try: + # 确保模型文件存在 + availability = self.ensure_model_available(model_config) + if not availability['available']: + return {'valid': False, 'error': availability['error']} + + local_path = availability['local_path'] + model_hash_short = availability.get('model_hash', 'unknown') + + # 检查是否已验证过(避免重复验证) + cache_key = f"{local_path}_{hashlib.md5(encryption_key.encode()).hexdigest()[:8]}" + with self.cache_lock: + if cache_key in self.verification_status: + cached_result = self.verification_status[cache_key] + if time.time() - cached_result.get('verified_at', 0) < self.verification_expiry: + if cached_result['valid']: + logger.info(f"使用缓存的验证结果: {model_hash_short}") + return cached_result + else: + # 缓存过期,删除 + del self.verification_status[cache_key] + + # 解密验证 + decrypt_result = self.validator.decrypt_and_verify(local_path, encryption_key) + + if decrypt_result['success']: + result = { + 'valid': True, + 'model_hash': decrypt_result.get('model_hash', '')[:16], + 'original_size': decrypt_result.get('original_size', 0), + 'local_path': local_path, + 'verified_at': time.time() + } + + # 缓存验证结果 + with self.cache_lock: + self.verification_status[cache_key] = result + + logger.info(f"模型密钥验证成功: {model_hash_short}") + return result + else: + result = {'valid': False, 'error': decrypt_result.get('error', '验证失败')} + logger.warning(f"模型密钥验证失败: {model_hash_short} - {result['error']}") + return result + + except Exception as e: + error_msg = f"验证模型密钥失败: {str(e)}" + logger.error(error_msg) + return {'valid': False, 'error': error_msg} + + def load_verified_model(self, model_config, encryption_key): + """加载已验证的模型 - 仅在验证通过后调用""" + try: + # 先验证密钥 + verify_result = self.verify_model_key(model_config, encryption_key) + if not verify_result['valid']: + raise ValueError(f"模型验证未通过: {verify_result.get('error', '未知错误')}") + + local_path = verify_result['local_path'] + + # 检查缓存 + cache_key = f"{local_path}_{hashlib.md5(encryption_key.encode()).hexdigest()[:8]}" + with self.cache_lock: + if cache_key in self.model_cache: + cached_info = self.model_cache[cache_key] + if time.time() - cached_info.get('loaded_at', 0) < self.cache_expiry: + logger.info(f"使用缓存的模型: {local_path}") + return cached_info['model'] + + # 解密模型(使用已验证的密钥) + decrypt_result = self.validator.decrypt_and_verify(local_path, encryption_key) if not decrypt_result['success']: raise ValueError(f"模型解密失败: {decrypt_result.get('error', '未知错误')}") - temp_path = decrypt_result['temp_path'] + # 保存解密数据到临时文件 + with tempfile.NamedTemporaryFile(delete=False, suffix='.pt') as tmp: + tmp.write(decrypt_result['decrypted_data']) + temp_path = tmp.name # 加载YOLO模型 from ultralytics import YOLO @@ -227,7 +527,7 @@ class MandatoryModelManager: # 应用半精度配置 if model_config.get('half', False) and 'cuda' in device: model = model.half() - logger.info(f"启用半精度推理: {model_path}") + logger.info(f"启用半精度推理: {model_config.get('path', '未知模型')}") # 清理临时文件 try: @@ -235,90 +535,336 @@ class MandatoryModelManager: except: pass - # 记录模型信息 - model_hash = decrypt_result.get('model_hash', 'unknown')[:16] - logger.info(f"加密模型加载成功: {model_path} -> {device} [哈希: {model_hash}...]") + # 缓存模型 + with self.cache_lock: + self.model_cache[cache_key] = { + 'model': model, + 'device': device, + 'loaded_at': time.time(), + 'original_size': decrypt_result.get('original_size', 0) + } + + logger.info(f"加密模型加载成功: {model_config.get('path', '未知模型')} -> {device}") return model except Exception as e: - logger.error(f"加载加密模型失败 {model_config.get('path')}: {str(e)}") + logger.error(f"加载已验证模型失败: {str(e)}") logger.error(traceback.format_exc()) return None - def download_encrypted_model(self, model_config, save_path): - """下载加密模型文件""" + def _get_local_model_path(self, model_path, model_config): + """获取模型本地路径""" + # 如果已经是本地路径,直接返回 + if os.path.exists(model_path): + return model_path + + # 检查是否是加密模型 + encrypted = model_config.get('encrypted', False) + + if encrypted: + # 从加密模型目录查找 + model_filename = os.path.basename(model_path) + if not model_filename.endswith('.enc'): + model_filename += '.enc' + return os.path.join(self.encrypted_models_dir, model_filename) + else: + # 从普通模型目录查找 + model_filename = os.path.basename(model_path) + return os.path.join(self.models_dir, model_filename) + + def get_model_info(self, model_config): + """获取模型信息(不验证密钥)""" try: - download_url = model_config.get('download_url') + availability = self.ensure_model_available(model_config) + if not availability['available']: + return None - if not download_url: - logger.error(f"加密模型无下载地址: {model_config['path']}") - return False - - logger.info(f"下载加密模型: {download_url} -> {save_path}") - - response = requests.get(download_url, stream=True, timeout=30) - response.raise_for_status() - - total_size = int(response.headers.get('content-length', 0)) - downloaded = 0 - - with open(save_path, 'wb') as f: - for chunk in response.iter_content(chunk_size=8192): - if chunk: - downloaded += len(chunk) - f.write(chunk) - - if total_size > 0: - progress = (downloaded * 100) // total_size - if progress % 25 == 0: - logger.info(f"下载进度: {progress}%") - - logger.info(f"加密模型下载完成: {save_path} ({downloaded} 字节)") - - # 验证下载的文件是否正确加密 - if not self.encryptor.is_properly_encrypted(save_path): - logger.error(f"下载的文件不是正确加密的模型: {save_path}") - os.remove(save_path) - return False - - return True - - except Exception as e: - logger.error(f"下载加密模型失败: {str(e)}") - return False - - def encrypt_existing_model(self, model_path, output_path, password): - """加密现有模型文件""" - return self.encryptor.encrypt_model(model_path, output_path, password) - - def verify_model_key(self, model_path, encryption_key): - """验证模型密钥是否正确""" - try: - if not os.path.exists(model_path): - return {'valid': False, 'error': '模型文件不存在'} - - if not self.encryptor.is_properly_encrypted(model_path): - return {'valid': False, 'error': '模型文件未正确加密'} - - # 尝试解密(不保存文件) - result = self.encryptor.decrypt_model(model_path, encryption_key) - - if result['success']: - # 清理临时文件 - if 'temp_path' in result and os.path.exists(result['temp_path']): - try: - os.unlink(result['temp_path']) - except: - pass + local_path = availability['local_path'] + verify_result = self.validator.verify_model_encryption(local_path) + if verify_result['valid']: + data = verify_result['encrypted_data'] return { - 'valid': True, - 'model_hash': result.get('model_hash', '')[:16], - 'original_size': result.get('original_size', 0) + 'encrypted': True, + 'model_hash': data.get('model_hash', '')[:16], + 'original_size': data.get('original_size', 0), + 'version': data.get('version', 'unknown'), + 'local_path': local_path, + 'file_size': os.path.getsize(local_path) } - else: - return {'valid': False, 'error': result.get('error', '解密失败')} + return None except Exception as e: - return {'valid': False, 'error': str(e)} \ No newline at end of file + logger.error(f"获取模型信息失败: {str(e)}") + return None + + def clear_cache(self): + """清空缓存""" + with self.cache_lock: + self.model_cache.clear() + self.verification_status.clear() + logger.info("模型缓存已清空") + + def get_cache_info(self): + """获取缓存信息""" + with self.cache_lock: + return { + 'model_cache_size': len(self.model_cache), + 'verification_cache_size': len(self.verification_status), + 'model_cache_keys': list(self.model_cache.keys()), + 'verification_cache_keys': list(self.verification_status.keys()) + } + + +class SimpleModelEncryptor: + """简化模型加密器 - 仅用于测试或本地转换""" + + @staticmethod + def create_encrypted_payload(model_data, password): + """创建加密数据包(模拟.NET服务器的加密过程)""" + # 生成盐和密钥 + salt = os.urandom(16) + kdf = PBKDF2HMAC( + algorithm=hashes.SHA256(), + length=32, + salt=salt, + iterations=100000, + ) + key = base64.urlsafe_b64encode(kdf.derive(password.encode())) + fernet = Fernet(key) + + # 加密数据 + encrypted_data = fernet.encrypt(model_data) + model_hash = hashlib.sha256(model_data).hexdigest() + + # 创建加密数据包 + encrypted_payload = { + 'salt': salt, + 'data': encrypted_data, + 'model_hash': model_hash, + 'original_size': len(model_data), + 'encrypted': True, + 'version': '2.0', + 'created_at': time.time() + } + + return encrypted_payload, key + + @staticmethod + def encrypt_model_file(input_path, output_path, password): + """加密模型文件""" + try: + # 读取原始模型文件 + with open(input_path, 'rb') as f: + model_data = f.read() + + # 创建加密数据包 + encrypted_payload, key = SimpleModelEncryptor.create_encrypted_payload(model_data, password) + + # 保存加密文件 + with open(output_path, 'wb') as f: + pickle.dump(encrypted_payload, f) + + logger.info(f"模型加密成功: {input_path} -> {output_path}") + + return { + 'success': True, + 'output_path': output_path, + 'model_hash': encrypted_payload['model_hash'][:16], + 'original_size': len(model_data), + 'encrypted_size': os.path.getsize(output_path) + } + + except Exception as e: + logger.error(f"加密模型文件失败: {str(e)}") + return {'success': False, 'error': str(e)} + + @staticmethod + def verify_encryption(encrypted_path, password): + """验证加密文件""" + return MandatoryModelValidator().decrypt_and_verify(encrypted_path, password) + + +# ==================== 全局实例和接口函数 ==================== + +# 导入线程模块 +import threading + +# 全局实例 +_model_manager = None +_pre_task_validator = None +_upload_manager = None + + +def get_model_manager(config=None): + """获取模型管理器单例""" + global _model_manager + if _model_manager is None: + if config is None: + from config import get_default_config + config = get_default_config() + _model_manager = SecureModelManager(config) + return _model_manager + + +def get_pre_task_validator(config=None): + """获取预验证器单例""" + global _pre_task_validator + if _pre_task_validator is None: + if config is None: + from config import get_default_config + config = get_default_config() + _pre_task_validator = PreTaskModelValidator(config.get('upload', {})) + return _pre_task_validator + + +def validate_models_before_task(task_config): + """验证任务的所有模型(外部调用接口)""" + validator = get_pre_task_validator() + return validator.validate_models_before_task(task_config) + + +def verify_single_model_api(model_path, encryption_key): + """验证单个模型(API接口)""" + validator = get_pre_task_validator() + return validator.verify_single_model(model_path, encryption_key) + + +def verify_model_key_api(model_config, encryption_key): + """验证模型密钥(API接口)""" + manager = get_model_manager() + return manager.verify_model_key(model_config, encryption_key) + + +def load_verified_model_api(model_config, encryption_key): + """加载已验证的模型(API接口)""" + manager = get_model_manager() + return manager.load_verified_model(model_config, encryption_key) + + +def generate_secure_key_api(length=32): + """生成安全密钥(API接口)""" + return ModelEncryptionService.generate_secure_key(length) + + +def validate_key_strength_api(key): + """验证密钥强度(API接口)""" + return ModelEncryptionService.validate_key_strength(key) + + +def test_decryption_api(encrypted_path, password): + """测试解密(API接口)""" + validator = MandatoryModelValidator() + return validator.decrypt_and_verify(encrypted_path, password) + + +# ==================== 向后兼容的接口 ==================== + +class MandatoryModelEncryptor: + """向后兼容的加密器类""" + + @staticmethod + def encrypt_model(input_path, output_path, password, require_encryption=True): + """加密模型 - 向后兼容接口""" + return SimpleModelEncryptor.encrypt_model_file(input_path, output_path, password) + + @staticmethod + def decrypt_model(encrypted_path, password, verify_key=False): + """解密模型 - 向后兼容接口""" + validator = MandatoryModelValidator() + return validator.decrypt_model(encrypted_path, password, verify_key=verify_key) + + @staticmethod + def is_properly_encrypted(encrypted_path): + """检查是否被正确加密 - 向后兼容接口""" + return MandatoryModelValidator.is_properly_encrypted(encrypted_path) + + @staticmethod + def generate_secure_key(): + """生成安全密钥 - 向后兼容接口""" + return ModelEncryptionService.generate_secure_key() + + @staticmethod + def verify_model_key(encrypted_path, password): + """验证模型密钥 - 向后兼容接口""" + validator = MandatoryModelValidator() + return validator.decrypt_and_verify(encrypted_path, password) + + +# ==================== 测试代码 ==================== + +if __name__ == "__main__": + import time + + print("=== 强制加密模型验证模块测试 ===") + + # 配置示例 + config = { + 'models_dir': './models', + 'encrypted_models_dir': './encrypted_models', + 'cache_verification': True + } + + # 模型配置示例 + model_config = { + 'path': 'yolov8n.enc', # 加密模型文件路径 + 'device': 'cpu', + 'half': False, + 'encrypted': True, + 'encryption_key': 'test-password-123!@#' # 测试密钥 + } + + # 测试密钥生成 + print("\n1. 测试密钥生成:") + key_info = ModelEncryptionService.generate_secure_key() + print(f" 生成的密钥: {key_info['key']}") + print(f" 密钥哈希: {key_info['key_hash']}") + print(f" 短哈希: {key_info['short_hash']}") + + # 测试密钥强度验证 + print("\n2. 测试密钥强度验证:") + test_key = "WeakKey123" + valid, msg = ModelEncryptionService.validate_key_strength(test_key) + print(f" 密钥 '{test_key}': {valid} - {msg}") + + test_key = "Strong@Password#2024!Complex" + valid, msg = ModelEncryptionService.validate_key_strength(test_key) + print(f" 密钥 '{test_key}': {valid} - {msg}") + + # 测试模型验证器 + print("\n3. 测试模型验证器:") + validator = MandatoryModelValidator() + + # 测试不存在的文件 + result = validator.verify_model_encryption("nonexistent.enc") + print(f" 不存在的文件验证: {result['valid']} - {result.get('error', '')}") + + # 测试预验证器 + print("\n4. 测试预验证器:") + pre_validator = PreTaskModelValidator(config) + + task_config = { + 'models': [ + { + 'path': 'test_model.enc', + 'encryption_key': 'Test@Password#2024!Complex' + } + ] + } + + result = pre_validator.validate_models_before_task(task_config) + print(f" 任务验证结果: 成功={result['success']}, 错误={result.get('error', '无')}") + + # 测试安全模型管理器 + print("\n5. 测试安全模型管理器:") + manager = SecureModelManager(config) + + # 测试模型信息获取 + model_info = manager.get_model_info(model_config) + if model_info: + print(f" 模型信息: 哈希={model_info['model_hash']}, 大小={model_info['original_size']}") + else: + print(f" 模型信息: 不可用") + + print("\n=== 测试完成 ===") \ No newline at end of file diff --git a/model_crypto.py b/model_crypto.py deleted file mode 100644 index c846727..0000000 --- a/model_crypto.py +++ /dev/null @@ -1,202 +0,0 @@ -# model_crypto.py -import os -import tempfile - -import requests -from cryptography.fernet import Fernet -from cryptography.hazmat.primitives import hashes -from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC -import base64 -import pickle -from pathlib import Path -from log import logger - - -class ModelEncryptor: - """模型加密/解密器""" - - @staticmethod - def generate_key(password: str, salt: bytes = None): - """生成加密密钥""" - if salt is None: - salt = os.urandom(16) - - kdf = PBKDF2HMAC( - algorithm=hashes.SHA256(), - length=32, - salt=salt, - iterations=100000, - ) - key = base64.urlsafe_b64encode(kdf.derive(password.encode())) - return key, salt - - @staticmethod - def encrypt_model(model_path: str, output_path: str, password: str): - """加密模型文件""" - try: - # 读取模型文件 - with open(model_path, 'rb') as f: - model_data = f.read() - - # 生成密钥 - key, salt = ModelEncryptor.generate_key(password) - fernet = Fernet(key) - - # 加密数据 - encrypted_data = fernet.encrypt(model_data) - - # 保存加密数据(包含salt) - encrypted_payload = { - 'salt': salt, - 'data': encrypted_data, - 'original_size': len(model_data) - } - - with open(output_path, 'wb') as f: - pickle.dump(encrypted_payload, f) - - logger.info(f"模型加密成功: {model_path} -> {output_path}") - return True - - except Exception as e: - logger.error(f"模型加密失败: {str(e)}") - return False - - @staticmethod - def decrypt_model(encrypted_path: str, password: str): - """解密模型到内存""" - try: - # 读取加密文件 - with open(encrypted_path, 'rb') as f: - encrypted_payload = pickle.load(f) - - salt = encrypted_payload['salt'] - encrypted_data = encrypted_payload['data'] - - # 生成密钥 - key, _ = ModelEncryptor.generate_key(password, salt) - fernet = Fernet(key) - - # 解密数据 - decrypted_data = fernet.decrypt(encrypted_data) - - # 保存到临时文件 - with tempfile.NamedTemporaryFile(delete=False, suffix='.pt') as tmp: - tmp.write(decrypted_data) - temp_path = tmp.name - - logger.info(f"模型解密成功: {encrypted_path}") - return temp_path - - except Exception as e: - logger.error(f"模型解密失败: {str(e)}") - return None - - @staticmethod - def is_encrypted(model_path: str): - """检查模型是否加密""" - try: - with open(model_path, 'rb') as f: - # 尝试读取加密格式 - data = pickle.load(f) - return isinstance(data, dict) and 'salt' in data and 'data' in data - except: - return False - - -class ModelManager: - """模型管理器,支持加密模型加载""" - - def __init__(self, config): - self.config = config - self.models_dir = "models" - os.makedirs(self.models_dir, exist_ok=True) - - def load_model(self, model_config): - """加载模型(支持加密)""" - model_path = model_config['path'] - encrypted = model_config.get('encrypted', False) - encryption_key = model_config.get('encryption_key') - - local_path = os.path.join(self.models_dir, os.path.basename(model_path)) - - # 下载模型(如果不存在) - if not os.path.exists(local_path): - if not self.download_model(model_config): - return None - - # 如果是加密模型,需要解密 - if encrypted and encryption_key: - if ModelEncryptor.is_encrypted(local_path): - decrypted_path = ModelEncryptor.decrypt_model(local_path, encryption_key) - if decrypted_path: - try: - from ultralytics import YOLO - model = YOLO(decrypted_path).to(model_config['device']) - - # 清理临时文件 - try: - os.unlink(decrypted_path) - except: - pass - - return model - except Exception as e: - logger.error(f"加载解密模型失败: {str(e)}") - return None - else: - return None - else: - logger.warning(f"模型未加密或密钥错误: {local_path}") - return None - else: - # 普通模型加载 - try: - from ultralytics import YOLO - model = YOLO(local_path).to(model_config['device']) - - # 应用配置 - if model_config.get('half', False) and 'cuda' in model_config['device']: - model = model.half() - - return model - except Exception as e: - logger.error(f"加载模型失败: {str(e)}") - return None - - def download_model(self, model_config): - """下载模型""" - try: - model_path = model_config['path'] - download_url = model_config.get('download_url') - - if not download_url: - logger.error(f"模型无下载地址: {model_path}") - return False - - local_path = os.path.join(self.models_dir, os.path.basename(model_path)) - - logger.info(f"下载模型: {download_url} -> {local_path}") - - response = requests.get(download_url, stream=True, timeout=30) - response.raise_for_status() - - total_size = int(response.headers.get('content-length', 0)) - downloaded = 0 - - with open(local_path, 'wb') as f: - for chunk in response.iter_content(chunk_size=8192): - downloaded += len(chunk) - f.write(chunk) - - if total_size > 0: - progress = downloaded * 100 // total_size - if progress % 10 == 0: - logger.info(f"下载进度: {progress}%") - - logger.info(f"模型下载完成: {local_path} ({downloaded} 字节)") - return True - - except Exception as e: - logger.error(f"下载模型失败: {str(e)}") - return False diff --git a/model_upload_manager.py b/model_upload_manager.py new file mode 100644 index 0000000..36bd8e3 --- /dev/null +++ b/model_upload_manager.py @@ -0,0 +1,358 @@ +# model_upload_manager.py +import os +import hashlib +import json +import tempfile +import time +import threading +from pathlib import Path +from log import logger +from cryptography.fernet import Fernet +from cryptography.hazmat.primitives import hashes +from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC +import base64 +import pickle + + +class ChunkedUploadManager: + """分片上传管理器""" + + def __init__(self, config): + self.config = config + self.uploads_dir = config.get('uploads_dir', 'uploads') + self.temp_dir = config.get('temp_dir', 'temp_uploads') + self.encrypted_models_dir = config.get('encrypted_models_dir', 'encrypted_models') + + # 创建必要的目录 + os.makedirs(self.uploads_dir, exist_ok=True) + os.makedirs(self.temp_dir, exist_ok=True) + os.makedirs(self.encrypted_models_dir, exist_ok=True) + + # 存储上传状态 + self.upload_sessions = {} + self.lock = threading.Lock() + + # 清理过期的上传会话(每10分钟) + self._start_cleanup_thread() + + def _start_cleanup_thread(self): + """启动清理线程""" + + def cleanup(): + while True: + try: + self.cleanup_expired_sessions() + time.sleep(600) # 每10分钟清理一次 + except Exception as e: + logger.error(f"清理上传会话失败: {str(e)}") + time.sleep(60) + + thread = threading.Thread(target=cleanup, daemon=True) + thread.start() + + def create_upload_session(self, filename, total_size, chunk_size, encryption_key=None): + """创建上传会话""" + try: + # 生成唯一的session_id + session_id = hashlib.md5(f"{filename}_{time.time()}".encode()).hexdigest() + + # 创建临时目录用于存储分片 + session_dir = os.path.join(self.temp_dir, session_id) + os.makedirs(session_dir, exist_ok=True) + + # 计算总分片数 + total_chunks = (total_size + chunk_size - 1) // chunk_size + + session_info = { + 'session_id': session_id, + 'filename': filename, + 'original_filename': filename, + 'total_size': total_size, + 'chunk_size': chunk_size, + 'total_chunks': total_chunks, + 'received_chunks': set(), + 'received_size': 0, + 'created_at': time.time(), + 'last_activity': time.time(), + 'status': 'uploading', + 'session_dir': session_dir, + 'encryption_key': encryption_key, + 'encrypted': encryption_key is not None, + 'merged_file': None, + 'encrypted_file': None + } + + with self.lock: + self.upload_sessions[session_id] = session_info + + logger.info(f"创建上传会话: {session_id}, 文件: {filename}, 总分片: {total_chunks}") + + return { + 'success': True, + 'session_id': session_id, + 'total_chunks': total_chunks + } + + except Exception as e: + logger.error(f"创建上传会话失败: {str(e)}") + return {'success': False, 'error': str(e)} + + def upload_chunk(self, session_id, chunk_index, chunk_data): + """上传分片""" + try: + with self.lock: + if session_id not in self.upload_sessions: + return {'success': False, 'error': '会话不存在或已过期'} + + session = self.upload_sessions[session_id] + + # 检查分片索引是否有效 + if chunk_index < 0 or chunk_index >= session['total_chunks']: + return {'success': False, 'error': f'无效的分片索引: {chunk_index}'} + + # 检查分片是否已接收 + if chunk_index in session['received_chunks']: + return {'success': False, 'error': f'分片 {chunk_index} 已接收'} + + # 保存分片 + chunk_filename = os.path.join(session['session_dir'], f'chunk_{chunk_index:06d}') + with open(chunk_filename, 'wb') as f: + f.write(chunk_data) + + # 更新会话状态 + session['received_chunks'].add(chunk_index) + session['received_size'] += len(chunk_data) + session['last_activity'] = time.time() + + # 计算进度 + progress = (len(session['received_chunks']) / session['total_chunks']) * 100 + + logger.debug(f"上传分片: {session_id} - 分片 {chunk_index}, 进度: {progress:.1f}%") + + # 检查是否所有分片都已上传完成 + if len(session['received_chunks']) == session['total_chunks']: + session['status'] = 'merging' + # 启动合并线程 + threading.Thread(target=self._merge_and_encrypt, args=(session_id,), daemon=True).start() + + return { + 'success': True, + 'progress': progress, + 'received_chunks': len(session['received_chunks']), + 'total_chunks': session['total_chunks'] + } + + except Exception as e: + logger.error(f"上传分片失败: {str(e)}") + return {'success': False, 'error': str(e)} + + def _merge_and_encrypt(self, session_id): + """合并分片并加密""" + try: + with self.lock: + session = self.upload_sessions.get(session_id) + if not session: + return + + session['status'] = 'merging' + logger.info(f"开始合并分片: {session_id}, 文件: {session['filename']}") + + # 合并分片 + merged_path = os.path.join(session['session_dir'], 'merged_file') + with open(merged_path, 'wb') as output: + for chunk_idx in range(session['total_chunks']): + chunk_file = os.path.join(session['session_dir'], f'chunk_{chunk_idx:06d}') + with open(chunk_file, 'rb') as input_chunk: + output.write(input_chunk.read()) + + # 更新会话状态 + with self.lock: + session['merged_file'] = merged_path + session['status'] = 'encrypting' + logger.info(f"分片合并完成: {session_id}, 开始加密") + + # 加密文件 + if session['encryption_key']: + encrypted_result = self._encrypt_in_memory(merged_path, session['encryption_key']) + + with self.lock: + if encrypted_result['success']: + session['encrypted_file'] = encrypted_result['encrypted_path'] + session['model_hash'] = encrypted_result['model_hash'] + session['key_hash'] = encrypted_result['key_hash'] + session['status'] = 'completed' + session['last_activity'] = time.time() + + # 清理合并的原始文件(不在磁盘保存) + if os.path.exists(merged_path): + os.remove(merged_path) + + # 清理分片文件 + self._cleanup_chunks(session['session_dir']) + + logger.info(f"文件加密完成: {session_id}, 加密文件: {session['encrypted_file']}") + else: + session['status'] = 'failed' + session['error'] = encrypted_result.get('error', '加密失败') + logger.error(f"文件加密失败: {session_id}, 错误: {session['error']}") + else: + # 如果没有提供密钥,直接保存原始文件(不推荐) + with self.lock: + session['status'] = 'failed' + session['error'] = '未提供加密密钥' + logger.warning(f"未提供加密密钥: {session_id}") + + except Exception as e: + logger.error(f"合并加密过程失败: {str(e)}") + with self.lock: + if session_id in self.upload_sessions: + self.upload_sessions[session_id]['status'] = 'failed' + self.upload_sessions[session_id]['error'] = str(e) + + def _encrypt_in_memory(self, file_path, password): + """在内存中加密文件""" + try: + # 读取文件到内存 + with open(file_path, 'rb') as f: + model_data = f.read() + + # 计算模型哈希 + model_hash = hashlib.sha256(model_data).hexdigest() + + # 生成盐和密钥 + salt = os.urandom(16) + kdf = PBKDF2HMAC( + algorithm=hashes.SHA256(), + length=32, + salt=salt, + iterations=100000, + ) + key = base64.urlsafe_b64encode(kdf.derive(password.encode())) + key_hash = hashlib.sha256(key).hexdigest() + + # 加密数据 + fernet = Fernet(key) + encrypted_data = fernet.encrypt(model_data) + + # 创建加密数据包 + encrypted_payload = { + 'salt': salt, + 'data': encrypted_data, + 'model_hash': model_hash, + 'original_size': len(model_data), + 'encrypted': True, + 'version': '2.0', # 新版本标识 + 'created_at': time.time(), + 'key_hash': key_hash[:16] # 保存密钥哈希的前16位用于验证 + } + + # 生成加密文件名 + encrypted_filename = f"{model_hash[:16]}.enc" + encrypted_path = os.path.join(self.encrypted_models_dir, encrypted_filename) + + # 保存加密文件 + with open(encrypted_path, 'wb') as f: + pickle.dump(encrypted_payload, f) + + return { + 'success': True, + 'encrypted_path': encrypted_path, + 'model_hash': model_hash, + 'key_hash': key_hash, + 'filename': encrypted_filename + } + + except Exception as e: + logger.error(f"内存加密失败: {str(e)}") + return {'success': False, 'error': str(e)} + + def _cleanup_chunks(self, session_dir): + """清理分片文件""" + try: + for item in os.listdir(session_dir): + item_path = os.path.join(session_dir, item) + if os.path.isfile(item_path): + os.remove(item_path) + os.rmdir(session_dir) + except Exception as e: + logger.warning(f"清理分片文件失败: {str(e)}") + + def get_upload_status(self, session_id): + """获取上传状态""" + with self.lock: + if session_id not in self.upload_sessions: + return {'success': False, 'error': '会话不存在'} + + session = self.upload_sessions[session_id] + + # 构建返回数据 + result = { + 'session_id': session_id, + 'filename': session['filename'], + 'status': session['status'], + 'progress': (len(session['received_chunks']) / session['total_chunks']) * 100, + 'received_chunks': len(session['received_chunks']), + 'total_chunks': session['total_chunks'], + 'received_size': session['received_size'], + 'total_size': session['total_size'], + 'encrypted': session['encrypted'], + 'created_at': session['created_at'], + 'last_activity': session['last_activity'] + } + + if session['status'] == 'completed': + result['encrypted_file'] = session['encrypted_file'] + result['model_hash'] = session.get('model_hash') + result['key_hash'] = session.get('key_hash') + result['relative_path'] = os.path.basename(session['encrypted_file']) + elif session['status'] == 'failed': + result['error'] = session.get('error', '未知错误') + + return {'success': True, 'data': result} + + def cleanup_expired_sessions(self, expire_hours=24): + """清理过期的上传会话""" + try: + current_time = time.time() + expired_sessions = [] + + with self.lock: + for session_id, session in list(self.upload_sessions.items()): + # 清理超过24小时无活动的会话 + if current_time - session['last_activity'] > expire_hours * 3600: + expired_sessions.append(session_id) + + for session_id in expired_sessions: + session = self.upload_sessions.pop(session_id) + # 清理临时文件 + if os.path.exists(session['session_dir']): + try: + self._cleanup_chunks(session['session_dir']) + except: + pass + logger.info(f"清理过期会话: {session_id}") + + return len(expired_sessions) + + except Exception as e: + logger.error(f"清理过期会话失败: {str(e)}") + return 0 + + +# 全局上传管理器实例 +_upload_manager = None + + +def get_upload_manager(config=None): + """获取上传管理器单例""" + global _upload_manager + if _upload_manager is None: + if config is None: + config = { + 'uploads_dir': 'uploads', + 'temp_dir': 'temp_uploads', + 'encrypted_models_dir': 'encrypted_models' + } + _upload_manager = ChunkedUploadManager(config) + return _upload_manager + diff --git a/server.py b/server.py index 6114ac1..de6f769 100644 --- a/server.py +++ b/server.py @@ -1,5 +1,8 @@ # server.py +import hashlib import os +import pickle +import secrets from datetime import datetime import torch @@ -8,11 +11,13 @@ from flask_socketio import SocketIO from flask_cors import CORS from config import get_default_config from mandatory_model_crypto import MandatoryModelEncryptor +from model_upload_manager import get_upload_manager from task_manager import task_manager # 导入任务管理器 from global_data import gd from log import logger import time import traceback +from mandatory_model_crypto import ModelEncryptionService, validate_models_before_task, verify_single_model_api # Flask初始化 app = Flask(__name__, static_url_path='/static') @@ -49,6 +54,8 @@ def video_player(): return render_template("flv2.html") +# server.py - 修改 create_task 函数 + @app.route('/api/tasks/create', methods=['POST']) def create_task(): """创建新任务 - 强制模型加密和密钥验证""" @@ -73,6 +80,46 @@ def create_task(): if len(data['models']) == 0: return jsonify({"status": "error", "message": "models列表不能为空"}), 400 + # ================= 关键修改:创建任务前的模型验证 ================= + logger.info("开始创建任务前的模型验证...") + + # 1. 检查所有模型是否都有加密密钥 + for i, model_data in enumerate(data['models']): + if 'encryption_key' not in model_data: + return jsonify({ + "status": "error", + "message": f"模型 {i} 必须提供encryption_key" + }), 400 + + # 2. 验证所有模型的密钥 + task_config = { + 'models': data['models'] + } + + validation_result = validate_models_before_task(task_config) + + if not validation_result['success']: + logger.error(f"模型验证失败: {validation_result.get('error', '未知错误')}") + + # 提供详细的验证结果 + error_details = [] + for result in validation_result.get('validation_results', []): + if not result.get('key_valid', False): + error_details.append(f"模型 {result['model_index']}: {result.get('error', '验证失败')}") + + error_message = validation_result.get('error', '模型验证失败') + if error_details: + error_message += f" | 详情: {', '.join(error_details)}" + + return jsonify({ + "status": "error", + "message": error_message, + "data": validation_result + }), 400 + + logger.info(f"模型验证通过: {validation_result['valid_models']}/{validation_result['total_models']} 个模型有效") + # ================= 验证结束 ================= + # 更新配置 config['rtmp']['url'] = data['rtmp_url'] @@ -87,37 +134,28 @@ def create_task(): if 'AlgoId' in data: config['task']['aiid'] = data['AlgoId'] - # 处理多模型配置 - 强制加密验证 + # 处理多模型配置 - 使用已验证的模型 config['models'] = [] - encryption_checker = MandatoryModelEncryptor() for i, model_data in enumerate(data['models']): - # 必须提供加密密钥 - encryption_key = model_data.get('encryption_key') - if not encryption_key: - return jsonify({ - "status": "error", - "message": f"模型 {i} ({model_data.get('path', 'unknown')}) 必须提供encryption_key" - }), 400 + # 此时密钥已验证通过 + encryption_key = model_data['encryption_key'] - model_path = model_data.get('path', f'model_{i}.pt') - model_name = os.path.basename(model_path).split('.')[0] + # 使用加密模型文件名(相对路径) + model_path = model_data.get('path', f'model_{i}.enc') - # 检查模型文件是否加密(如果是本地文件) - local_model_path = os.path.join(os.path.basename(model_path)) - # 如果本地文件存在,验证加密格式 - if os.path.exists(local_model_path): - if not encryption_checker.is_properly_encrypted(local_model_path): - return jsonify({ - "status": "error", - "message": f"模型 {i} ({model_name}) 未正确加密" - }), 400 + # 确保路径是加密模型目录中的文件 + if not model_path.startswith('encrypted_models/'): + model_filename = os.path.basename(model_path) + if not model_filename.endswith('.enc'): + model_filename += '.enc' + model_path = f"encrypted_models/{model_filename}" # 构建模型配置 model_config = { 'path': model_path, - 'encryption_key': encryption_key, # 必须提供 - 'encrypted': True, # 强制加密 + 'encryption_key': encryption_key, + 'encrypted': True, 'tags': model_data.get('tags', {}), 'conf_thres': float(model_data.get('conf_thres', 0.25)), 'iou_thres': float(model_data.get('iou_thres', 0.45)), @@ -127,11 +165,11 @@ def create_task(): 'device': model_data.get('device', 'cuda:0' if torch.cuda.is_available() else 'cpu'), 'half': model_data.get('half', True), 'enabled': model_data.get('enabled', True), - 'download_url': model_data.get('download_url') # 可选的下载地址 + # 注意:不再需要 download_url,模型从本地加载 } config['models'].append(model_config) - logger.info(f"添加加密模型 {i}: {model_name}") + logger.info(f"添加已验证的加密模型 {i}: {model_path}") # 在创建任务前清理已停止的任务,释放资源 logger.info("创建任务前清理已停止的任务...") @@ -167,7 +205,7 @@ def create_task(): }), 503 # 创建任务 - logger.info(f"开始创建任务,包含 {len(config['models'])} 个加密模型...") + logger.info(f"开始创建任务,包含 {len(config['models'])} 个已验证的加密模型...") try: task_id = task_manager.create_task(config, socketio) @@ -185,12 +223,21 @@ def create_task(): if success: logger.info(f"任务启动成功: {task_id}") + + # 获取任务详细信息 + task_status = task_manager.get_task_status(task_id) + return jsonify({ "status": "success", "message": "任务创建并启动成功", - "task_id": task_id, - "models_count": len(config['models']), - "encryption_required": True + "data": { + "task_id": task_id, + "models_count": len(config['models']), + "encryption_required": True, + "key_validated": True, + "validation_result": validation_result, + "task_info": task_status + } }) else: logger.error(f"任务启动失败: {task_id}") @@ -266,14 +313,6 @@ def encrypt_model(): return jsonify({"status": "error", "message": "缺少必要参数"}), 400 local_path = os.path.join(config['model_path'], model_path) output_path = os.path.join(config['model_path'], output_path) - # 验证输入文件是否存在 - if not os.path.exists(model_path): - from model_crypto import ModelManager - model_d = ModelManager(data) - down_status = model_d.download_model({"path": model_path, "download_url": download_url}) - if not down_status: - return jsonify({"status": "error", "message": f"模型文件不存在: {model_path}"}), 400 - # 使用强制加密器 from mandatory_model_crypto import MandatoryModelEncryptor encryptor = MandatoryModelEncryptor() @@ -741,40 +780,6 @@ def get_task_stream_status(task_id): }), 500 -@app.route('/api/tasks//stream/restart', methods=['POST']) -def restart_task_stream(task_id): - """重启任务推流""" - try: - from task_stream_manager import task_stream_manager - - # 检查任务是否存在 - if task_id not in task_manager.tasks: - return jsonify({ - "status": "error", - "message": f"任务不存在: {task_id}" - }), 404 - - # 重启推流 - success = task_stream_manager._restart_task_streamer(task_id) - - if success: - return jsonify({ - "status": "success", - "message": f"任务推流重启成功: {task_id}" - }) - else: - return jsonify({ - "status": "error", - "message": f"重启失败: {task_id}" - }), 500 - except Exception as e: - logger.error(f"重启任务推流失败: {str(e)}") - return jsonify({ - "status": "error", - "message": f"重启失败: {str(e)}" - }), 500 - - @app.route('/api/system/streams/info', methods=['GET']) def get_all_streams_info(): """获取所有任务推流信息""" @@ -799,10 +804,645 @@ def get_all_streams_info(): }), 500 +# 在适当位置初始化上传管理器 +upload_manager = None + + +def init_upload_manager(config): + """初始化上传管理器""" + global upload_manager + if not upload_manager: + upload_manager = get_upload_manager(config['upload']) + return upload_manager + + +# 添加上传相关路由 +@app.route('/api/models/upload/start', methods=['POST']) +def start_model_upload(): + """开始模型文件上传""" + try: + data = request.json + if not data: + return jsonify({"status": "error", "message": "请求数据不能为空"}), 400 + + filename = data.get('filename') + total_size = data.get('total_size') + encryption_key = data.get('encryption_key') # 可选,但建议提供 + + if not all([filename, total_size]): + return jsonify({"status": "error", "message": "缺少必要参数"}), 400 + + # 初始化上传管理器 + config = get_default_config() + upload_mgr = init_upload_manager(config) + + # 获取分片大小配置 + chunk_size = config['upload'].get('chunk_size', 5 * 1024 * 1024) + + # 创建上传会话 + result = upload_mgr.create_upload_session( + filename=filename, + total_size=total_size, + chunk_size=chunk_size, + encryption_key=encryption_key + ) + + if result['success']: + return jsonify({ + "status": "success", + "message": "上传会话创建成功", + "data": { + "session_id": result['session_id'], + "total_chunks": result['total_chunks'], + "chunk_size": chunk_size + } + }) + else: + return jsonify({ + "status": "error", + "message": f"创建上传会话失败: {result.get('error', '未知错误')}" + }), 500 + + except Exception as e: + logger.error(f"开始上传失败: {str(e)}") + return jsonify({ + "status": "error", + "message": f"开始上传失败: {str(e)}" + }), 500 + + +@app.route('/api/models/upload/chunk', methods=['POST']) +def upload_model_chunk(): + """上传模型文件分片""" + try: + # 获取表单数据 + session_id = request.form.get('session_id') + chunk_index = int(request.form.get('chunk_index', 0)) + + if not session_id: + return jsonify({"status": "error", "message": "缺少session_id"}), 400 + + # 获取文件数据 + if 'chunk' not in request.files: + return jsonify({"status": "error", "message": "未找到文件分片"}), 400 + + chunk_file = request.files['chunk'] + chunk_data = chunk_file.read() + + # 获取上传管理器 + config = get_default_config() + upload_mgr = init_upload_manager(config) + + # 上传分片 + result = upload_mgr.upload_chunk(session_id, chunk_index, chunk_data) + + if result['success']: + return jsonify({ + "status": "success", + "message": "分片上传成功", + "data": { + "progress": result['progress'], + "received_chunks": result['received_chunks'], + "total_chunks": result['total_chunks'], + "chunk_index": chunk_index + } + }) + else: + return jsonify({ + "status": "error", + "message": f"分片上传失败: {result.get('error', '未知错误')}" + }), 500 + + except Exception as e: + logger.error(f"上传分片失败: {str(e)}") + return jsonify({ + "status": "error", + "message": f"上传分片失败: {str(e)}" + }), 500 + + +@app.route('/api/models/upload/status/', methods=['GET']) +def get_upload_status(session_id): + """获取上传状态""" + try: + config = get_default_config() + upload_mgr = init_upload_manager(config) + + result = upload_mgr.get_upload_status(session_id) + + if result['success']: + return jsonify({ + "status": "success", + "data": result['data'] + }) + else: + return jsonify({ + "status": "error", + "message": result.get('error', '获取状态失败') + }), 404 + + except Exception as e: + logger.error(f"获取上传状态失败: {str(e)}") + return jsonify({ + "status": "error", + "message": f"获取上传状态失败: {str(e)}" + }), 500 + + +@app.route('/api/models/upload/cancel/', methods=['POST']) +def cancel_upload(session_id): + """取消上传""" + try: + # 实现取消逻辑 + config = get_default_config() + upload_mgr = init_upload_manager(config) + + # 这里需要在上传管理器中添加取消功能 + # upload_mgr.cancel_upload(session_id) + + return jsonify({ + "status": "success", + "message": f"上传已取消: {session_id}" + }) + + except Exception as e: + logger.error(f"取消上传失败: {str(e)}") + return jsonify({ + "status": "error", + "message": f"取消上传失败: {str(e)}" + }), 500 + + +@app.route('/api/models/list', methods=['GET']) +def list_encrypted_models(): + """列出所有已加密的模型文件""" + try: + config = get_default_config() + encrypted_dir = config['upload']['encrypted_models_dir'] + + if not os.path.exists(encrypted_dir): + return jsonify({ + "status": "success", + "data": { + "models": [], + "total": 0 + } + }) + + models = [] + for filename in os.listdir(encrypted_dir): + if filename.endswith('.enc'): + filepath = os.path.join(encrypted_dir, filename) + stats = os.stat(filepath) + models.append({ + 'filename': filename, + 'path': filepath, + 'size': stats.st_size, + 'modified': stats.st_mtime, + 'encrypted': True + }) + + return jsonify({ + "status": "success", + "data": { + "models": models, + "total": len(models), + "encrypted_dir": encrypted_dir + } + }) + + except Exception as e: + logger.error(f"列出模型失败: {str(e)}") + return jsonify({ + "status": "error", + "message": f"列出模型失败: {str(e)}" + }), 500 + + +# 在 server.py 中添加上传页面路由 +@app.route('/model_upload') +def model_upload_page(): + """模型上传页面""" + return render_template("model_upload.html") + + +# server.py - 添加以下路由 + +from mandatory_model_crypto import ModelEncryptionService, validate_models_before_task, verify_single_model_api + + +@app.route('/api/models/process/start', methods=['POST']) +def start_model_processing(): + """开始模型处理流程:生成密钥 -> 上传模型""" + try: + data = request.json + + # 选项1:客户端提供自己的密钥 + client_key = data.get('encryption_key') + + # 选项2:服务器生成密钥 + generate_new = data.get('generate_key', False) + + response_data = {} + + if generate_new and not client_key: + # 服务器生成新密钥 + key_info = ModelEncryptionService.generate_secure_key() + response_data['key_info'] = { + 'key': key_info['key'], + 'key_hash': key_info['key_hash'], + 'short_hash': key_info['short_hash'], + 'generated_by': 'server' + } + + elif client_key: + # 验证客户端提供的密钥 + key_valid, key_msg = ModelEncryptionService.validate_key_strength(client_key) + if not key_valid: + return jsonify({ + "status": "error", + "message": f"密钥强度不足: {key_msg}" + }), 400 + + response_data['key_info'] = { + 'key': client_key, + 'key_hash': hashlib.sha256(client_key.encode()).hexdigest(), + 'short_hash': hashlib.sha256(client_key.encode()).hexdigest()[:16], + 'generated_by': 'client' + } + else: + return jsonify({ + "status": "error", + "message": "请提供加密密钥或选择生成新密钥" + }), 400 + + # 生成上传令牌 + upload_token = secrets.token_urlsafe(32) + response_data['upload_token'] = upload_token + response_data['token_expires'] = time.time() + 3600 # 1小时有效期 + + # 存储上传会话(简化版,生产环境应使用数据库) + upload_sessions = gd.get_or_create_dict('upload_sessions') + upload_sessions[upload_token] = { + 'key_info': response_data['key_info'], + 'created_at': time.time(), + 'status': 'pending' + } + + return jsonify({ + "status": "success", + "message": "模型处理流程已启动", + "data": response_data + }) + + except Exception as e: + logger.error(f"启动模型处理流程失败: {str(e)}") + return jsonify({ + "status": "error", + "message": f"启动流程失败: {str(e)}" + }), 500 + + +@app.route('/api/models/process/verify_key', methods=['POST']) +def verify_encryption_key(): + """验证加密密钥""" + try: + data = request.json + encryption_key = data.get('encryption_key') + model_path = data.get('model_path') # 可选,如果有具体模型 + + if not encryption_key: + return jsonify({ + "status": "error", + "message": "请提供加密密钥" + }), 400 + + # 验证密钥强度 + key_valid, key_msg = ModelEncryptionService.validate_key_strength(encryption_key) + + if not key_valid: + return jsonify({ + "status": "error", + "message": key_msg, + "data": { + "valid": False, + "strength": "weak" + } + }), 400 + + response_data = { + "valid": True, + "strength": "strong", + "key_hash": hashlib.sha256(encryption_key.encode()).hexdigest()[:16] + } + + # 如果有具体模型,尝试解密验证 + if model_path: + verify_result = verify_single_model_api(model_path, encryption_key) + response_data['model_verification'] = verify_result + + return jsonify({ + "status": "success", + "message": "密钥验证成功", + "data": response_data + }) + + except Exception as e: + logger.error(f"验证密钥失败: {str(e)}") + return jsonify({ + "status": "error", + "message": f"验证失败: {str(e)}" + }), 500 + + +@app.route('/api/models/process/validate_task', methods=['POST']) +def validate_task_models(): + """创建任务前的模型验证""" + try: + data = request.json + + if not data: + return jsonify({ + "status": "error", + "message": "请求数据不能为空" + }), 400 + + # 提取任务配置 + task_config = { + 'models': data.get('models', []) + } + + # 验证所有模型 + validation_result = validate_models_before_task(task_config) + + if validation_result['success']: + return jsonify({ + "status": "success", + "message": f"模型验证通过 ({validation_result['valid_models']}/{validation_result['total_models']})", + "data": validation_result + }) + else: + return jsonify({ + "status": "error", + "message": f"模型验证失败: {validation_result.get('error', '未知错误')}", + "data": validation_result + }), 400 + + except Exception as e: + logger.error(f"验证任务模型失败: {str(e)}") + return jsonify({ + "status": "error", + "message": f"验证失败: {str(e)}" + }), 500 + + +@app.route('/api/models/encrypted/list_available', methods=['GET']) +def list_available_encrypted_models(): + """列出可用的加密模型(用于任务创建选择)""" + try: + config = get_default_config() + encrypted_dir = config['upload']['encrypted_models_dir'] + + if not os.path.exists(encrypted_dir): + return jsonify({ + "status": "success", + "data": { + "models": [], + "total": 0 + } + }) + + models = [] + for filename in os.listdir(encrypted_dir): + if filename.endswith('.enc'): + filepath = os.path.join(encrypted_dir, filename) + stats = os.stat(filepath) + + # 尝试读取模型基本信息(不验证密钥) + try: + with open(filepath, 'rb') as f: + encrypted_data = pickle.load(f) + + model_info = { + 'filename': filename, + 'path': f"encrypted_models/{filename}", # 相对路径 + 'size': stats.st_size, + 'modified': stats.st_mtime, + 'encrypted': True, + 'model_hash': encrypted_data.get('model_hash', '')[:16] if isinstance(encrypted_data, + dict) else '', + 'version': encrypted_data.get('version', 'unknown') if isinstance(encrypted_data, dict) else '', + 'original_size': encrypted_data.get('original_size', 0) if isinstance(encrypted_data, + dict) else 0 + } + + models.append(model_info) + + except Exception as e: + logger.warning(f"读取模型信息失败 {filename}: {str(e)}") + models.append({ + 'filename': filename, + 'path': f"encrypted_models/{filename}", + 'size': stats.st_size, + 'modified': stats.st_mtime, + 'encrypted': True, + 'error': '无法读取模型信息' + }) + + # 按修改时间排序 + models.sort(key=lambda x: x['modified'], reverse=True) + + return jsonify({ + "status": "success", + "data": { + "models": models, + "total": len(models), + "directory": encrypted_dir + } + }) + + except Exception as e: + logger.error(f"列出可用模型失败: {str(e)}") + return jsonify({ + "status": "error", + "message": f"列出模型失败: {str(e)}" + }), 500 + + +@app.route('/api/models/process/test_decrypt', methods=['POST']) +def test_model_decryption(): + """测试模型解密(不实际加载YOLO模型)""" + try: + data = request.json + model_path = data.get('model_path') + encryption_key = data.get('encryption_key') + + if not all([model_path, encryption_key]): + return jsonify({ + "status": "error", + "message": "请提供模型路径和加密密钥" + }), 400 + + # 构建完整路径 + config = get_default_config() + encrypted_dir = config['upload']['encrypted_models_dir'] + + if not os.path.isabs(model_path): + model_filename = os.path.basename(model_path) + full_model_path = os.path.join(encrypted_dir, model_filename) + else: + full_model_path = model_path + + # 检查文件是否存在 + if not os.path.exists(full_model_path): + return jsonify({ + "status": "error", + "message": f"模型文件不存在: {full_model_path}" + }), 404 + + # 测试解密 + from mandatory_model_crypto import MandatoryModelValidator + validator = MandatoryModelValidator() + + start_time = time.time() + decrypt_result = validator.decrypt_and_verify(full_model_path, encryption_key) + elapsed_time = time.time() - start_time + + if decrypt_result['success']: + return jsonify({ + "status": "success", + "message": "解密测试成功", + "data": { + 'success': True, + 'model_hash': decrypt_result.get('model_hash', '')[:16], + 'model_size': decrypt_result.get('original_size', 0), + 'decryption_time': elapsed_time, + 'file_path': full_model_path + } + }) + else: + return jsonify({ + "status": "error", + "message": f"解密测试失败: {decrypt_result.get('error', '未知错误')}", + "data": { + 'success': False, + 'error': decrypt_result.get('error', '未知错误'), + 'decryption_time': elapsed_time + } + }), 400 + + except Exception as e: + logger.error(f"测试解密失败: {str(e)}") + return jsonify({ + "status": "error", + "message": f"测试失败: {str(e)}" + }), 500 + + +# server.py - 添加任务创建页面路由 +@app.route('/task_create') +def task_create_page(): + """任务创建页面""" + return render_template("task_create.html") + + +# server.py - 添加资源检查接口 + +@app.route('/api/system/check_resources', methods=['GET']) +def check_system_resources(): + """检查系统资源是否足够创建新任务""" + try: + import psutil + import torch + + # 获取系统资源 + cpu_percent = psutil.cpu_percent(interval=0.1) + memory_info = psutil.virtual_memory() + memory_percent = memory_info.percent + + # GPU信息 + gpu_info = [] + gpu_available = torch.cuda.is_available() + if gpu_available: + for i in range(torch.cuda.device_count()): + gpu_memory_used = torch.cuda.memory_allocated(i) / 1024 ** 2 # MB + gpu_memory_total = torch.cuda.get_device_properties(i).total_memory / 1024 ** 2 # MB + gpu_memory_percent = (gpu_memory_used / gpu_memory_total) * 100 if gpu_memory_total > 0 else 0 + + gpu_info.append({ + 'id': i, + 'name': torch.cuda.get_device_name(i), + 'memory_used': gpu_memory_used, + 'memory_total': gpu_memory_total, + 'memory_percent': gpu_memory_percent + }) + + # 获取当前任务信息 + active_tasks = task_manager.get_active_tasks_count() + max_tasks = task_manager.get_current_max_tasks() + + # 资源阈值 + cpu_threshold = 80 # CPU使用率阈值 + memory_threshold = 85 # 内存使用率阈值 + gpu_memory_threshold = 90 # GPU内存使用率阈值 + + # 检查资源状态 + resources_ok = True + warnings = [] + + if cpu_percent > cpu_threshold: + resources_ok = False + warnings.append(f"CPU使用率过高: {cpu_percent:.1f}% > {cpu_threshold}%") + + if memory_percent > memory_threshold: + resources_ok = False + warnings.append(f"内存使用率过高: {memory_percent:.1f}% > {memory_threshold}%") + + if gpu_available and gpu_info: + max_gpu_memory = max(gpu['memory_percent'] for gpu in gpu_info) + if max_gpu_memory > gpu_memory_threshold: + warnings.append(f"GPU内存使用率过高: {max_gpu_memory:.1f}% > {gpu_memory_threshold}%") + # GPU内存高不是致命错误,只是警告 + + if active_tasks >= max_tasks: + resources_ok = False + warnings.append(f"任务数达到上限: {active_tasks}/{max_tasks}") + + return jsonify({ + "status": "success", + "data": { + "resources_available": resources_ok, + "active_tasks": active_tasks, + "max_tasks": max_tasks, + "slots_available": max(0, max_tasks - active_tasks), + "cpu_percent": cpu_percent, + "memory_percent": memory_percent, + "memory_used": memory_info.used / 1024 ** 2, # MB + "memory_total": memory_info.total / 1024 ** 2, # MB + "gpu_available": gpu_available, + "gpu_info": gpu_info, + "warnings": warnings, + "thresholds": { + "cpu": cpu_threshold, + "memory": memory_threshold, + "gpu_memory": gpu_memory_threshold + }, + "timestamp": time.time() + } + }) + + except Exception as e: + logger.error(f"检查系统资源失败: {str(e)}") + return jsonify({ + "status": "error", + "message": f"检查资源失败: {str(e)}" + }), 500 + + # 初始化函数,可在主程序中调用 def init_app(): """初始化应用程序""" with app.app_context(): gd.set_value('task_manager', task_manager) logger.info("任务管理器初始化完成") - return app \ No newline at end of file + return app diff --git a/task_manager.py b/task_manager.py index 7fc1578..0792954 100644 --- a/task_manager.py +++ b/task_manager.py @@ -116,6 +116,8 @@ class TaskManager: logger.error(f"检查任务创建条件失败: {str(e)}") return False # 出错时保守拒绝 + # task_manager.py - 修改 create_task 方法 + def create_task(self, config, socketio): """创建新任务 - 强制加密验证""" try: @@ -131,11 +133,23 @@ class TaskManager: if 'models' not in config or not isinstance(config['models'], list): raise Exception("配置必须包含models列表") + # ============ 增强验证 ============ # 验证所有模型都有加密密钥 for i, model_cfg in enumerate(config['models']): if not model_cfg.get('encryption_key'): raise Exception(f"模型 {i} ({model_cfg.get('path', 'unknown')}) 必须提供加密密钥") + # 验证模型路径是否指向加密模型目录 + model_path = model_cfg.get('path', '') + if not model_path.startswith('encrypted_models/') and not os.path.isabs(model_path): + # 尝试在加密目录中查找 + model_filename = os.path.basename(model_path) + if not model_filename.endswith('.enc'): + model_filename += '.enc' + + # 更新配置中的路径 + model_cfg['path'] = f"encrypted_models/{model_filename}" + # 准备任务信息 task_info = { 'task_id': task_id, @@ -152,9 +166,16 @@ class TaskManager: 'start_time': time.time(), 'models_loaded': len(config['models']), 'encrypted_models': len(config['models']), # 所有模型都加密 - 'key_validation_required': True + 'key_validation_required': True, + 'key_validated': True, # 创建时已验证 + 'validation_time': time.time() }, - 'key_validation': {} # 存储密钥验证结果 + 'key_validation': { + 'required': True, + 'validated': True, + 'validated_at': time.time(), + 'models_count': len(config['models']) + } } # 更新配置中的任务ID @@ -164,7 +185,7 @@ class TaskManager: self.tasks[task_id] = task_info gd.get_or_create_dict('tasks')[task_id] = task_info - logger.info(f"创建加密任务成功: {task_id}, 加密模型数: {len(config['models'])}") + logger.info(f"创建加密任务成功: {task_id}, 加密模型数: {len(config['models'])}, 密钥已验证") return task_id except Exception as e: diff --git a/templates/model_upload.html b/templates/model_upload.html new file mode 100644 index 0000000..075b792 --- /dev/null +++ b/templates/model_upload.html @@ -0,0 +1,444 @@ + + + + 模型文件上传 + + + + + +

加密模型文件上传

+ +
+ + + + +
+ +
+

拖放模型文件到此处,或点击选择文件

+

支持 .pt, .pth, .onnx, .engine 格式,最大 1GB

+ + +
+
+ +
+

上传进度

+
+
+
+
+ 0% + (0/0 分片) +
+
+ +
+ +
+

已上传的模型文件

+ +
+
+ + + + \ No newline at end of file diff --git a/templates/task_create.html b/templates/task_create.html new file mode 100644 index 0000000..6953d35 --- /dev/null +++ b/templates/task_create.html @@ -0,0 +1,896 @@ + + + + 创建AI检测任务 + + + + + + +
+

创建AI检测任务

+ + +
+
+
+ +
+
1
+
+

选择模型

+

选择要使用的加密模型文件

+
+
+ +
+
2
+
+

配置密钥

+

为每个模型配置加密密钥

+
+
+ +
+
3
+
+

任务设置

+

配置RTMP流和任务参数

+
+
+ +
+
4
+
+

验证和创建

+

验证所有配置并创建任务

+
+
+ +
+ +
+ +
+

选择加密模型

+
+ +
+
加载模型中...
+
没有找到加密模型文件
+
+
{{ model.filename }}
+
+ 大小: {{ formatFileSize(model.size) }} | + 哈希: {{ model.model_hash || '未知' }} | + 修改: {{ formatTimestamp(model.modified) }} +
+
+
+
+ +
+

已选模型 ({{ selectedModels.length }})

+
+
+
{{ model.filename }}
+ +
+
+ 路径: {{ model.path }}
+ 模型哈希: {{ model.model_hash || '未知' }} +
+
+
+ +
+ + +
+
+ + +
+

配置模型加密密钥

+

为每个选中的模型配置加密密钥。密钥将在创建任务前进行验证。

+ +
+
+
+ {{ model.filename }} + + {{ model.validation.checked ? (model.validation.valid ? '有效' : '无效') : '待验证' }} + +
+
+ +
+ + + +
+
+ ✓ 密钥验证成功
+ 模型哈希: {{ model.validation.model_hash }} +
+
+ ✗ 密钥验证失败: {{ model.validation.error }} +
+
+
+ +
+ + +
+
+ +
+ + + +
+
+ + +
+

任务配置

+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+
+ 模型数量: + {{ selectedModels.length }} +
+
+ 已验证模型: + {{ validModelsCount }} / {{ selectedModels.length }} +
+
+ 加密要求: + 强制加密 ✓ +
+
+
+ +
+ + +
+
+ + +
+

验证并创建任务

+ +
+

正在创建任务...

+

{{ createTaskMessage }}

+
+ +
+

配置概览

+
+
+ 任务名称: + {{ taskConfig.taskname }} +
+
+ 视频流: + {{ taskConfig.rtmp_url }} +
+
+ 推流地址: + {{ taskConfig.push_url || '未设置' }} +
+
+ 模型数量: + {{ selectedModels.length }} 个 +
+
+ 密钥验证: + {{ validModelsCount === selectedModels.length ? '全部通过 ✓' : '未通过 ✗' }} +
+
+ +

最终验证

+
+ +
+ +
+

✓ 验证通过

+

✗ 验证失败

+ +
+

所有模型验证成功,可以创建任务

+

有效模型: {{ finalValidationResult.valid_models }} / {{ finalValidationResult.total_models }}

+
+
+

验证失败: {{ finalValidationResult.error }}

+
+

详细错误:

+
    +
  • + 模型 {{ result.model_index }}: {{ result.error }} +
  • +
+
+
+
+ +
+ + +
+
+
+
+ + +
+

任务状态

+ +
+

步骤1/4: 选择模型

+

请从已上传的加密模型中选择要使用的模型。可以多选。

+

提示: 模型文件必须已经通过上传接口加密上传。

+
+ +
+

步骤2/4: 配置密钥

+

为每个模型输入加密密钥。密钥强度要求:

+
    +
  • 长度至少16位
  • +
  • 包含大小写字母
  • +
  • 包含数字
  • +
  • 包含特殊字符
  • +
+

点击"测试解密"可以验证密钥是否正确。

+
+ +
+

步骤3/4: 任务设置

+

配置任务的基本参数:

+
    +
  • RTMP流: 输入视频流地址
  • +
  • 推流地址: 处理后的视频推流地址(可选)
  • +
  • 任务名称: 用于标识任务的名称
  • +
+
+ +
+

步骤4/4: 验证和创建

+

系统将执行最终验证:

+
    +
  • 验证所有模型密钥
  • +
  • 检查系统资源
  • +
  • 确认任务参数
  • +
+

验证通过后,点击"创建任务"启动检测。

+
+ +
+

任务创建成功

+

任务ID: {{ createdTaskId }}

+

状态: {{ taskStatus }}

+

创建时间: {{ new Date().toLocaleString() }}

+ +
+ + +
+
+ +
+

错误信息

+

{{ errorMessage }}

+
+
+
+
+ + + + \ No newline at end of file diff --git a/yolo_detection.log b/yolo_detection.log index b92fc3e..59988f8 100644 --- a/yolo_detection.log +++ b/yolo_detection.log @@ -58978,3 +58978,2389 @@ OSError: 无法连接RTMP流 (rtmp://192.168.10.131:1935/live/14) 2025-12-11 14:58:07,598 [INFO] [task_manager:375] 任务资源已清理: 544dd4c2-058c-49fd-8da9-01c93ff0b197 2025-12-11 14:58:07,598 [INFO] [task_manager:399] 已清理所有任务,共1个 2025-12-11 14:58:07,598 [INFO] [main:57] 服务已退出 +2025-12-12 11:41:25,195 [INFO] [main:23] 任务管理器初始化... +2025-12-12 11:41:25,195 [INFO] [main:24] 任务管理器实例: +2025-12-12 11:41:25,195 [INFO] [main:102] 启动多任务版YOLOv8服务 +2025-12-12 11:41:25,245 [INFO] [main:103] PyTorch版本: 2.9.1+cu126, CUDA可用: True +2025-12-12 11:41:25,246 [INFO] [main:77] 定时清理调度器已启动 +2025-12-12 11:41:31,874 [INFO] [task_stream_manager:202] 任务推流健康监控启动 +2025-12-12 11:41:31,874 [INFO] [main:113] 任务推流管理器初始化完成 +2025-12-12 11:41:53,148 [INFO] [server:35] 任务管理器初始化完成 +2025-12-12 11:41:53,148 [INFO] [server:63] 收到创建任务请求: 多模型道路监控 +2025-12-12 11:41:53,149 [INFO] [server:134] 添加加密模型 0: yolov8n_car +2025-12-12 11:41:53,149 [INFO] [server:134] 添加加密模型 1: yolov8n_e8c6fabc5d3128e8 +2025-12-12 11:41:53,149 [INFO] [server:137] 创建任务前清理已停止的任务... +2025-12-12 11:41:53,149 [INFO] [task_manager:506] 开始清理已停止的任务... +2025-12-12 11:41:53,149 [INFO] [task_manager:523] 清理已停止任务完成: 清理了 0 个 +2025-12-12 11:41:53,149 [INFO] [server:170] 开始创建任务,包含 2 个加密模型... +2025-12-12 11:41:53,149 [INFO] [task_manager:77] 当前活动任务: 0/5 +2025-12-12 11:41:53,149 [INFO] [task_manager:167] 创建加密任务成功: 0324dbdd-13af-4317-85ed-7459c42e0c8b, 加密模型数: 2 +2025-12-12 11:41:53,149 [INFO] [server:174] 任务创建成功,ID: 0324dbdd-13af-4317-85ed-7459c42e0c8b +2025-12-12 11:41:53,149 [INFO] [server:183] 启动任务 0324dbdd-13af-4317-85ed-7459c42e0c8b... +2025-12-12 11:41:57,963 [INFO] [task_stream_manager_windows:61] 找到FFmpeg: ffmpeg +2025-12-12 11:41:57,963 [INFO] [windows_utils:497] 检测到Windows系统,进行系统检测和配置... +2025-12-12 11:41:58,112 [INFO] [windows_utils:515] Windows系统: Windows 10/11 (Build 22621) +2025-12-12 11:41:58,676 [INFO] [windows_utils:530] FFmpeg版本: ffmpeg version N-117451-g0f5592cfc7-20241010 Copyright (c) 2000-2024 the FFmpeg developers +2025-12-12 11:41:58,676 [INFO] [windows_utils:531] FFmpeg路径: D:\ffmpeg-master-latest-win64-gpl\bin\ffmpeg.exe +2025-12-12 11:41:58,676 [INFO] [windows_utils:534] 运行FFmpeg功能测试... +2025-12-12 11:41:59,088 [INFO] [windows_utils:545] FFmpeg功能测试成功! +2025-12-12 11:41:59,121 [INFO] [windows_utils:551] 检测到 1 个GPU: +2025-12-12 11:41:59,121 [INFO] [windows_utils:553] GPU0: NVIDIA GeForce RTX 3060 +2025-12-12 11:41:59,185 [INFO] [windows_utils:565] 系统优化建议: +2025-12-12 11:41:59,185 [INFO] [windows_utils:572] power_scheme: 电源方案 GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (高性能) +2025-12-12 11:41:59,186 [INFO] [windows_utils:572] power_recommendation: For best streaming performance, use High Performance power plan. Run: powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c +2025-12-12 11:41:59,186 [INFO] [windows_utils:572] firewall: Consider adding firewall rules for RTMP ports (1935, 1936) +2025-12-12 11:41:59,186 [INFO] [windows_utils:568] network_optimizations: +2025-12-12 11:41:59,186 [INFO] [windows_utils:570] - Increase TCP buffer size: netsh int tcp set global autotuninglevel=normal +2025-12-12 11:41:59,186 [INFO] [windows_utils:570] - Disable TCP auto-tuning (if unstable): netsh int tcp set global autotuninglevel=disabled +2025-12-12 11:41:59,186 [INFO] [windows_utils:570] - Enable TCP fast open: netsh int tcp set global fastopen=enabled +2025-12-12 11:41:59,186 [INFO] [windows_utils:570] - Set TCP keepalive: netsh int tcp set global keepalivetime=30000 +2025-12-12 11:41:59,186 [INFO] [windows_utils:568] gpu_recommendations: +2025-12-12 11:41:59,186 [INFO] [windows_utils:570] - Update graphics drivers to latest version +2025-12-12 11:41:59,186 [INFO] [windows_utils:570] - In NVIDIA Control Panel: Set Power Management Mode to "Prefer Maximum Performance" +2025-12-12 11:41:59,186 [INFO] [windows_utils:570] - In Windows Graphics Settings: Add ffmpeg.exe and set to "High Performance" +2025-12-12 11:41:59,304 [INFO] [windows_utils:578] 系统资源: CPU 0.0%, 内存 18.1% +2025-12-12 11:41:59,304 [INFO] [windows_utils:623] Windows系统检测完成,状态正常 +2025-12-12 11:41:59,304 [INFO] [detectionThread:273] Windows系统检测完成: ready +2025-12-12 11:41:59,304 [INFO] [detectionThread:291] 检测线程初始化完成: 多模型道路监控 +2025-12-12 11:41:59,305 [INFO] [detectionThread:1117] 启动检测线程,任务ID: 0324dbdd-13af-4317-85ed-7459c42e0c8b +2025-12-12 11:41:59,305 [INFO] [detectionThread:306] 开始加载 2 个模型 +2025-12-12 11:41:59,305 [INFO] [detectionThread:324] 加载模型 0: yolov8n_car +2025-12-12 11:41:59,305 [WARNING] [detectionThread:48] 模型文件不存在: models\yolov8n_car.pt +2025-12-12 11:41:59,305 [ERROR] [detectionThread:334] 加载模型 0 失败: yolov8n_car +2025-12-12 11:41:59,305 [INFO] [detectionThread:324] 加载模型 1: yolov8n_e8c6fabc5d3128e8 +2025-12-12 11:41:59,305 [WARNING] [detectionThread:48] 模型文件不存在: models\yolov8n_e8c6fabc5d3128e8.pt +2025-12-12 11:41:59,305 [ERROR] [detectionThread:334] 加载模型 1 失败: yolov8n_e8c6fabc5d3128e8 +2025-12-12 11:41:59,306 [ERROR] [detectionThread:369] 所有模型加载失败 +2025-12-12 11:41:59,306 [ERROR] [detectionThread:378] 模型加载失败详情: +2025-12-12 11:41:59,306 [ERROR] [detectionThread:380] 模型 0: 未知错误 +2025-12-12 11:41:59,306 [ERROR] [detectionThread:380] 模型 1: 未知错误 +2025-12-12 11:41:59,306 [ERROR] [detectionThread:1124] 加密模型加载失败,线程退出 +2025-12-12 11:41:59,306 [INFO] [task_manager:466] 更新任务状态: 0324dbdd-13af-4317-85ed-7459c42e0c8b starting -> failed +2025-12-12 11:41:59,306 [INFO] [detectionThread:1329] 开始清理资源,任务ID: 0324dbdd-13af-4317-85ed-7459c42e0c8b +2025-12-12 11:41:59,306 [INFO] [detectionThread:1382] 释放所有模型,共 0 个 +2025-12-12 11:41:59,306 [INFO] [detectionThread:1409] 清理GPU缓存... +2025-12-12 11:41:59,396 [INFO] [detectionThread:1414] GPU缓存已清理 +2025-12-12 11:41:59,396 [INFO] [detectionThread:1419] 清理其他资源... +2025-12-12 11:41:59,396 [INFO] [detectionThread:1433] 其他资源已清理 +2025-12-12 11:41:59,396 [INFO] [detectionThread:1437] 资源清理完成 +2025-12-12 11:41:59,396 [INFO] [detectionThread:1282] 检测线程已安全停止 +2025-12-12 11:41:59,396 [INFO] [task_manager:466] 更新任务状态: 0324dbdd-13af-4317-85ed-7459c42e0c8b failed -> stopped +2025-12-12 11:42:00,305 [INFO] [task_manager:226] 任务启动成功: 0324dbdd-13af-4317-85ed-7459c42e0c8b +2025-12-12 11:42:00,305 [INFO] [server:187] 任务启动成功: 0324dbdd-13af-4317-85ed-7459c42e0c8b +2025-12-12 11:42:02,547 [INFO] [task_manager:477] 开始清理所有任务... +2025-12-12 11:42:02,547 [INFO] [task_manager:391] 开始清理任务: 0324dbdd-13af-4317-85ed-7459c42e0c8b, 状态: running +2025-12-12 11:42:02,548 [INFO] [task_manager:254] 正在停止任务: 0324dbdd-13af-4317-85ed-7459c42e0c8b, 当前状态: running +2025-12-12 11:42:02,548 [INFO] [detectionThread:1288] 收到停止请求,任务ID: 0324dbdd-13af-4317-85ed-7459c42e0c8b +2025-12-12 11:42:02,548 [INFO] [detectionThread:1325] 停止信号已发送,任务ID: 0324dbdd-13af-4317-85ed-7459c42e0c8b +2025-12-12 11:42:02,548 [INFO] [task_manager:267] 已调用线程停止方法: 0324dbdd-13af-4317-85ed-7459c42e0c8b +2025-12-12 11:42:02,548 [INFO] [task_manager:283] 任务线程已停止: 0324dbdd-13af-4317-85ed-7459c42e0c8b +2025-12-12 11:42:02,548 [INFO] [task_manager:300] 任务停止成功: 0324dbdd-13af-4317-85ed-7459c42e0c8b +2025-12-12 11:42:03,599 [INFO] [task_manager:449] 任务清理完成: 0324dbdd-13af-4317-85ed-7459c42e0c8b +2025-12-12 11:42:03,599 [INFO] [task_manager:497] 任务清理完成: 成功 1 个, 失败 0 个, 总计 1 个 +2025-12-12 11:42:11,704 [INFO] [server:63] 收到创建任务请求: 多模型道路监控 +2025-12-12 11:42:11,704 [INFO] [server:134] 添加加密模型 0: yolov8n_car +2025-12-12 11:42:11,704 [INFO] [server:134] 添加加密模型 1: yolov8n_e8c6fabc5d3128e8 +2025-12-12 11:42:11,704 [INFO] [server:137] 创建任务前清理已停止的任务... +2025-12-12 11:42:11,704 [INFO] [task_manager:506] 开始清理已停止的任务... +2025-12-12 11:42:11,704 [INFO] [task_manager:523] 清理已停止任务完成: 清理了 0 个 +2025-12-12 11:42:11,704 [INFO] [server:170] 开始创建任务,包含 2 个加密模型... +2025-12-12 11:42:11,704 [INFO] [task_manager:77] 当前活动任务: 0/5 +2025-12-12 11:42:11,704 [INFO] [task_manager:167] 创建加密任务成功: 724b58f1-10de-42d2-a245-89a1856cb0d8, 加密模型数: 2 +2025-12-12 11:42:11,704 [INFO] [server:174] 任务创建成功,ID: 724b58f1-10de-42d2-a245-89a1856cb0d8 +2025-12-12 11:42:11,704 [INFO] [server:183] 启动任务 724b58f1-10de-42d2-a245-89a1856cb0d8... +2025-12-12 11:42:11,986 [INFO] [windows_utils:497] 检测到Windows系统,进行系统检测和配置... +2025-12-12 11:42:11,986 [INFO] [windows_utils:515] Windows系统: Windows 10/11 (Build 22621) +2025-12-12 11:42:12,108 [INFO] [windows_utils:530] FFmpeg版本: ffmpeg version N-117451-g0f5592cfc7-20241010 Copyright (c) 2000-2024 the FFmpeg developers +2025-12-12 11:42:12,108 [INFO] [windows_utils:531] FFmpeg路径: D:\ffmpeg-master-latest-win64-gpl\bin\ffmpeg.exe +2025-12-12 11:42:12,108 [INFO] [windows_utils:534] 运行FFmpeg功能测试... +2025-12-12 11:42:12,210 [INFO] [windows_utils:545] FFmpeg功能测试成功! +2025-12-12 11:42:12,211 [INFO] [windows_utils:551] 检测到 1 个GPU: +2025-12-12 11:42:12,211 [INFO] [windows_utils:553] GPU0: NVIDIA GeForce RTX 3060 +2025-12-12 11:42:12,260 [INFO] [windows_utils:565] 系统优化建议: +2025-12-12 11:42:12,260 [INFO] [windows_utils:572] power_scheme: 电源方案 GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (高性能) +2025-12-12 11:42:12,260 [INFO] [windows_utils:572] power_recommendation: For best streaming performance, use High Performance power plan. Run: powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c +2025-12-12 11:42:12,260 [INFO] [windows_utils:572] firewall: Consider adding firewall rules for RTMP ports (1935, 1936) +2025-12-12 11:42:12,260 [INFO] [windows_utils:568] network_optimizations: +2025-12-12 11:42:12,260 [INFO] [windows_utils:570] - Increase TCP buffer size: netsh int tcp set global autotuninglevel=normal +2025-12-12 11:42:12,260 [INFO] [windows_utils:570] - Disable TCP auto-tuning (if unstable): netsh int tcp set global autotuninglevel=disabled +2025-12-12 11:42:12,260 [INFO] [windows_utils:570] - Enable TCP fast open: netsh int tcp set global fastopen=enabled +2025-12-12 11:42:12,260 [INFO] [windows_utils:570] - Set TCP keepalive: netsh int tcp set global keepalivetime=30000 +2025-12-12 11:42:12,261 [INFO] [windows_utils:568] gpu_recommendations: +2025-12-12 11:42:12,261 [INFO] [windows_utils:570] - Update graphics drivers to latest version +2025-12-12 11:42:12,261 [INFO] [windows_utils:570] - In NVIDIA Control Panel: Set Power Management Mode to "Prefer Maximum Performance" +2025-12-12 11:42:12,261 [INFO] [windows_utils:570] - In Windows Graphics Settings: Add ffmpeg.exe and set to "High Performance" +2025-12-12 11:42:12,375 [INFO] [windows_utils:578] 系统资源: CPU 1.6%, 内存 18.4% +2025-12-12 11:42:12,375 [INFO] [windows_utils:623] Windows系统检测完成,状态正常 +2025-12-12 11:42:12,375 [INFO] [detectionThread:273] Windows系统检测完成: ready +2025-12-12 11:42:12,375 [INFO] [detectionThread:291] 检测线程初始化完成: 多模型道路监控 +2025-12-12 11:42:12,376 [INFO] [detectionThread:1117] 启动检测线程,任务ID: 724b58f1-10de-42d2-a245-89a1856cb0d8 +2025-12-12 11:42:12,376 [INFO] [detectionThread:306] 开始加载 2 个模型 +2025-12-12 11:42:12,376 [INFO] [detectionThread:324] 加载模型 0: yolov8n_car +2025-12-12 11:42:12,376 [WARNING] [detectionThread:48] 模型文件不存在: models\yolov8n_car.pt +2025-12-12 11:42:12,376 [ERROR] [detectionThread:334] 加载模型 0 失败: yolov8n_car +2025-12-12 11:42:12,376 [INFO] [detectionThread:324] 加载模型 1: yolov8n_e8c6fabc5d3128e8 +2025-12-12 11:42:12,376 [WARNING] [detectionThread:48] 模型文件不存在: models\yolov8n_e8c6fabc5d3128e8.pt +2025-12-12 11:42:12,376 [ERROR] [detectionThread:334] 加载模型 1 失败: yolov8n_e8c6fabc5d3128e8 +2025-12-12 11:42:12,376 [ERROR] [detectionThread:369] 所有模型加载失败 +2025-12-12 11:42:12,376 [ERROR] [detectionThread:378] 模型加载失败详情: +2025-12-12 11:42:12,376 [ERROR] [detectionThread:380] 模型 0: 未知错误 +2025-12-12 11:42:12,376 [ERROR] [detectionThread:380] 模型 1: 未知错误 +2025-12-12 11:42:12,376 [ERROR] [detectionThread:1124] 加密模型加载失败,线程退出 +2025-12-12 11:42:12,376 [INFO] [task_manager:466] 更新任务状态: 724b58f1-10de-42d2-a245-89a1856cb0d8 starting -> failed +2025-12-12 11:42:12,376 [INFO] [detectionThread:1329] 开始清理资源,任务ID: 724b58f1-10de-42d2-a245-89a1856cb0d8 +2025-12-12 11:42:12,377 [INFO] [detectionThread:1382] 释放所有模型,共 0 个 +2025-12-12 11:42:12,377 [INFO] [detectionThread:1409] 清理GPU缓存... +2025-12-12 11:42:12,430 [INFO] [detectionThread:1414] GPU缓存已清理 +2025-12-12 11:42:12,430 [INFO] [detectionThread:1419] 清理其他资源... +2025-12-12 11:42:12,430 [INFO] [detectionThread:1433] 其他资源已清理 +2025-12-12 11:42:12,430 [INFO] [detectionThread:1437] 资源清理完成 +2025-12-12 11:42:12,430 [INFO] [detectionThread:1282] 检测线程已安全停止 +2025-12-12 11:42:12,431 [INFO] [task_manager:466] 更新任务状态: 724b58f1-10de-42d2-a245-89a1856cb0d8 failed -> stopped +2025-12-12 11:42:13,377 [INFO] [task_manager:226] 任务启动成功: 724b58f1-10de-42d2-a245-89a1856cb0d8 +2025-12-12 11:42:13,377 [INFO] [server:187] 任务启动成功: 724b58f1-10de-42d2-a245-89a1856cb0d8 +2025-12-12 15:02:07,878 [INFO] [main:120] 收到退出信号,停止所有服务... +2025-12-12 15:02:07,878 [INFO] [task_stream_manager:234] 清理所有任务推流器 +2025-12-12 15:02:11,377 [INFO] [main:23] 任务管理器初始化... +2025-12-12 15:02:11,377 [INFO] [main:24] 任务管理器实例: +2025-12-12 15:02:11,377 [INFO] [main:102] 启动多任务版YOLOv8服务 +2025-12-12 15:02:11,396 [INFO] [main:103] PyTorch版本: 2.9.1+cu126, CUDA可用: True +2025-12-12 15:02:11,397 [INFO] [main:77] 定时清理调度器已启动 +2025-12-12 15:02:11,492 [INFO] [task_stream_manager:202] 任务推流健康监控启动 +2025-12-12 15:02:11,492 [INFO] [main:113] 任务推流管理器初始化完成 +2025-12-12 15:02:32,805 [INFO] [server:35] 任务管理器初始化完成 +2025-12-12 15:03:06,140 [ERROR] [server:828] 开始上传失败: name 'get_upload_manager' is not defined +2025-12-12 15:03:12,236 [ERROR] [server:828] 开始上传失败: name 'get_upload_manager' is not defined +2025-12-12 15:03:45,979 [INFO] [main:120] 收到退出信号,停止所有服务... +2025-12-12 15:03:45,979 [INFO] [task_stream_manager:234] 清理所有任务推流器 +2025-12-12 15:03:46,500 [INFO] [task_manager:477] 开始清理所有任务... +2025-12-12 15:03:46,500 [INFO] [task_manager:497] 任务清理完成: 成功 0 个, 失败 0 个, 总计 0 个 +2025-12-12 15:03:46,539 [INFO] [main:132] 清理了 0 个任务 +2025-12-12 15:03:46,539 [INFO] [main:134] 服务已退出 +2025-12-12 15:03:50,027 [INFO] [main:23] 任务管理器初始化... +2025-12-12 15:03:50,028 [INFO] [main:24] 任务管理器实例: +2025-12-12 15:03:50,028 [INFO] [main:102] 启动多任务版YOLOv8服务 +2025-12-12 15:03:50,045 [INFO] [main:103] PyTorch版本: 2.9.1+cu126, CUDA可用: True +2025-12-12 15:03:50,046 [INFO] [main:77] 定时清理调度器已启动 +2025-12-12 15:03:50,119 [INFO] [task_stream_manager:202] 任务推流健康监控启动 +2025-12-12 15:03:50,119 [INFO] [main:113] 任务推流管理器初始化完成 +2025-12-12 15:03:52,454 [INFO] [server:36] 任务管理器初始化完成 +2025-12-12 15:04:00,874 [INFO] [model_upload_manager:88] 创建上传会话: 7f7a044a67eb6e6264d6a9c7fb0d2212, 文件: best.pt, 总分片: 2 +2025-12-12 15:04:01,195 [INFO] [model_upload_manager:158] 开始合并分片: 7f7a044a67eb6e6264d6a9c7fb0d2212, 文件: best.pt +2025-12-12 15:04:01,201 [INFO] [model_upload_manager:172] 分片合并完成: 7f7a044a67eb6e6264d6a9c7fb0d2212, 开始加密 +2025-12-12 15:04:01,500 [INFO] [model_upload_manager:193] 文件加密完成: 7f7a044a67eb6e6264d6a9c7fb0d2212, 加密文件: encrypted_models\d568ab8378383793.enc +2025-12-12 15:44:41,056 [INFO] [main:120] 收到退出信号,停止所有服务... +2025-12-12 15:44:41,056 [INFO] [task_stream_manager:234] 清理所有任务推流器 +2025-12-12 15:44:44,256 [INFO] [main:23] 任务管理器初始化... +2025-12-12 15:44:44,256 [INFO] [main:24] 任务管理器实例: +2025-12-12 15:44:44,256 [INFO] [main:102] 启动多任务版YOLOv8服务 +2025-12-12 15:44:44,269 [INFO] [main:103] PyTorch版本: 2.9.1+cu126, CUDA可用: True +2025-12-12 15:44:44,270 [INFO] [main:77] 定时清理调度器已启动 +2025-12-12 15:44:44,317 [INFO] [task_stream_manager:202] 任务推流健康监控启动 +2025-12-12 15:44:44,317 [INFO] [main:113] 任务推流管理器初始化完成 +2025-12-12 15:45:05,906 [INFO] [server:40] 任务管理器初始化完成 +2025-12-12 15:45:56,347 [INFO] [main:120] 收到退出信号,停止所有服务... +2025-12-12 15:45:56,347 [INFO] [task_stream_manager:234] 清理所有任务推流器 +2025-12-12 15:46:05,526 [INFO] [main:23] 任务管理器初始化... +2025-12-12 15:46:05,526 [INFO] [main:24] 任务管理器实例: +2025-12-12 15:46:05,526 [INFO] [main:102] 启动多任务版YOLOv8服务 +2025-12-12 15:46:05,541 [INFO] [main:103] PyTorch版本: 2.9.1+cu126, CUDA可用: True +2025-12-12 15:46:05,541 [INFO] [main:77] 定时清理调度器已启动 +2025-12-12 15:46:05,591 [INFO] [task_stream_manager:202] 任务推流健康监控启动 +2025-12-12 15:46:05,591 [INFO] [main:113] 任务推流管理器初始化完成 +2025-12-12 15:47:03,083 [INFO] [server:40] 任务管理器初始化完成 +2025-12-12 15:47:48,048 [INFO] [server:70] 收到创建任务请求: 多模型道路监控 +2025-12-12 15:47:48,048 [INFO] [server:84] 开始创建任务前的模型验证... +2025-12-12 15:47:48,049 [ERROR] [server:102] 模型验证失败: 模型 0 密钥强度不足: 密钥长度至少16位 +2025-12-12 15:48:27,710 [INFO] [model_upload_manager:88] 创建上传会话: 83419129f058beccf84c7df400022fe5, 文件: best.pt, 总分片: 2 +2025-12-12 15:48:28,275 [INFO] [model_upload_manager:158] 开始合并分片: 83419129f058beccf84c7df400022fe5, 文件: best.pt +2025-12-12 15:48:28,280 [INFO] [model_upload_manager:172] 分片合并完成: 83419129f058beccf84c7df400022fe5, 开始加密 +2025-12-12 15:48:28,389 [INFO] [model_upload_manager:193] 文件加密完成: 83419129f058beccf84c7df400022fe5, 加密文件: encrypted_models\d568ab8378383793.enc +2025-12-12 15:49:41,443 [INFO] [server:70] 收到创建任务请求: 多模型道路监控 +2025-12-12 15:49:41,443 [INFO] [server:84] 开始创建任务前的模型验证... +2025-12-12 15:49:41,523 [INFO] [mandatory_model_crypto:124] 模型解密验证成功: encrypted_models\d568ab8378383793.enc +2025-12-12 15:49:41,524 [ERROR] [server:102] 模型验证失败: 模型 1 密钥强度不足: 密钥长度至少16位 +2025-12-12 15:49:49,345 [INFO] [server:70] 收到创建任务请求: 多模型道路监控 +2025-12-12 15:49:49,345 [INFO] [server:84] 开始创建任务前的模型验证... +2025-12-12 15:49:49,409 [INFO] [mandatory_model_crypto:124] 模型解密验证成功: encrypted_models\d568ab8378383793.enc +2025-12-12 15:49:49,472 [INFO] [mandatory_model_crypto:124] 模型解密验证成功: encrypted_models\d568ab8378383793.enc +2025-12-12 15:49:49,473 [INFO] [server:120] 模型验证通过: 2/2 个模型有效 +2025-12-12 15:49:49,473 [INFO] [server:172] 添加已验证的加密模型 0: encrypted_models/d568ab8378383793.enc +2025-12-12 15:49:49,473 [INFO] [server:172] 添加已验证的加密模型 1: encrypted_models/d568ab8378383793.enc +2025-12-12 15:49:49,473 [INFO] [server:175] 创建任务前清理已停止的任务... +2025-12-12 15:49:49,473 [INFO] [task_manager:527] 开始清理已停止的任务... +2025-12-12 15:49:49,473 [INFO] [task_manager:544] 清理已停止任务完成: 清理了 0 个 +2025-12-12 15:49:49,473 [INFO] [server:208] 开始创建任务,包含 2 个已验证的加密模型... +2025-12-12 15:49:49,473 [INFO] [task_manager:77] 当前活动任务: 0/5 +2025-12-12 15:49:49,474 [INFO] [task_manager:188] 创建加密任务成功: 5109ecb2-3e1d-474a-9c21-a2dcc90bee31, 加密模型数: 2, 密钥已验证 +2025-12-12 15:49:49,474 [INFO] [server:212] 任务创建成功,ID: 5109ecb2-3e1d-474a-9c21-a2dcc90bee31 +2025-12-12 15:49:49,474 [INFO] [server:221] 启动任务 5109ecb2-3e1d-474a-9c21-a2dcc90bee31... +2025-12-12 15:49:50,435 [INFO] [task_stream_manager_windows:61] 找到FFmpeg: ffmpeg +2025-12-12 15:49:50,435 [INFO] [windows_utils:497] 检测到Windows系统,进行系统检测和配置... +2025-12-12 15:49:50,443 [INFO] [windows_utils:515] Windows系统: Windows 10/11 (Build 22621) +2025-12-12 15:49:50,537 [INFO] [windows_utils:530] FFmpeg版本: ffmpeg version N-117451-g0f5592cfc7-20241010 Copyright (c) 2000-2024 the FFmpeg developers +2025-12-12 15:49:50,537 [INFO] [windows_utils:531] FFmpeg路径: D:\ffmpeg-master-latest-win64-gpl\bin\ffmpeg.exe +2025-12-12 15:49:50,537 [INFO] [windows_utils:534] 运行FFmpeg功能测试... +2025-12-12 15:49:50,645 [INFO] [windows_utils:545] FFmpeg功能测试成功! +2025-12-12 15:49:50,647 [INFO] [windows_utils:551] 检测到 1 个GPU: +2025-12-12 15:49:50,647 [INFO] [windows_utils:553] GPU0: NVIDIA GeForce RTX 3060 +2025-12-12 15:49:50,708 [INFO] [windows_utils:565] 系统优化建议: +2025-12-12 15:49:50,708 [INFO] [windows_utils:572] power_scheme: 电源方案 GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (高性能) +2025-12-12 15:49:50,708 [INFO] [windows_utils:572] power_recommendation: For best streaming performance, use High Performance power plan. Run: powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c +2025-12-12 15:49:50,708 [INFO] [windows_utils:572] firewall: Consider adding firewall rules for RTMP ports (1935, 1936) +2025-12-12 15:49:50,708 [INFO] [windows_utils:568] network_optimizations: +2025-12-12 15:49:50,708 [INFO] [windows_utils:570] - Increase TCP buffer size: netsh int tcp set global autotuninglevel=normal +2025-12-12 15:49:50,708 [INFO] [windows_utils:570] - Disable TCP auto-tuning (if unstable): netsh int tcp set global autotuninglevel=disabled +2025-12-12 15:49:50,708 [INFO] [windows_utils:570] - Enable TCP fast open: netsh int tcp set global fastopen=enabled +2025-12-12 15:49:50,708 [INFO] [windows_utils:570] - Set TCP keepalive: netsh int tcp set global keepalivetime=30000 +2025-12-12 15:49:50,708 [INFO] [windows_utils:568] gpu_recommendations: +2025-12-12 15:49:50,708 [INFO] [windows_utils:570] - Update graphics drivers to latest version +2025-12-12 15:49:50,708 [INFO] [windows_utils:570] - In NVIDIA Control Panel: Set Power Management Mode to "Prefer Maximum Performance" +2025-12-12 15:49:50,708 [INFO] [windows_utils:570] - In Windows Graphics Settings: Add ffmpeg.exe and set to "High Performance" +2025-12-12 15:49:50,829 [INFO] [windows_utils:578] 系统资源: CPU 6.4%, 内存 26.7% +2025-12-12 15:49:50,829 [INFO] [windows_utils:623] Windows系统检测完成,状态正常 +2025-12-12 15:49:50,829 [INFO] [detectionThread:294] Windows系统检测完成: ready +2025-12-12 15:49:50,829 [INFO] [detectionThread:312] 检测线程初始化完成: 多模型道路监控 +2025-12-12 15:49:50,830 [INFO] [detectionThread:1135] 启动检测线程,任务ID: 5109ecb2-3e1d-474a-9c21-a2dcc90bee31 +2025-12-12 15:49:50,830 [INFO] [detectionThread:327] 开始从本地加载 2 个模型 +2025-12-12 15:49:50,830 [INFO] [detectionThread:342] 加载模型 0: d568ab8378383793 +2025-12-12 15:49:50,900 [INFO] [mandatory_model_crypto:124] 模型解密验证成功: encrypted_models\d568ab8378383793.enc +2025-12-12 15:49:50,901 [ERROR] [detectionThread:128] 加密模型处理失败: name 'tempfile' is not defined +2025-12-12 15:49:50,901 [ERROR] [detectionThread:352] 加载模型 0 失败: d568ab8378383793 +2025-12-12 15:49:50,901 [INFO] [detectionThread:342] 加载模型 1: d568ab8378383793 +2025-12-12 15:49:50,974 [INFO] [mandatory_model_crypto:124] 模型解密验证成功: encrypted_models\d568ab8378383793.enc +2025-12-12 15:49:50,974 [ERROR] [detectionThread:128] 加密模型处理失败: name 'tempfile' is not defined +2025-12-12 15:49:50,974 [ERROR] [detectionThread:352] 加载模型 1 失败: d568ab8378383793 +2025-12-12 15:49:50,974 [ERROR] [detectionThread:387] 所有模型加载失败 +2025-12-12 15:49:50,974 [ERROR] [detectionThread:396] 模型加载失败详情: +2025-12-12 15:49:50,975 [ERROR] [detectionThread:398] 模型 0: name 'tempfile' is not defined +2025-12-12 15:49:50,975 [ERROR] [detectionThread:398] 模型 1: name 'tempfile' is not defined +2025-12-12 15:49:50,975 [ERROR] [detectionThread:1142] 加密模型加载失败,线程退出 +2025-12-12 15:49:50,975 [INFO] [task_manager:487] 更新任务状态: 5109ecb2-3e1d-474a-9c21-a2dcc90bee31 starting -> failed +2025-12-12 15:49:50,975 [INFO] [detectionThread:1347] 开始清理资源,任务ID: 5109ecb2-3e1d-474a-9c21-a2dcc90bee31 +2025-12-12 15:49:50,975 [INFO] [detectionThread:1400] 释放所有模型,共 0 个 +2025-12-12 15:49:50,975 [INFO] [detectionThread:1427] 清理GPU缓存... +2025-12-12 15:49:51,027 [INFO] [detectionThread:1432] GPU缓存已清理 +2025-12-12 15:49:51,028 [INFO] [detectionThread:1437] 清理其他资源... +2025-12-12 15:49:51,028 [INFO] [detectionThread:1451] 其他资源已清理 +2025-12-12 15:49:51,028 [INFO] [detectionThread:1455] 资源清理完成 +2025-12-12 15:49:51,028 [INFO] [detectionThread:1300] 检测线程已安全停止 +2025-12-12 15:49:51,028 [INFO] [task_manager:487] 更新任务状态: 5109ecb2-3e1d-474a-9c21-a2dcc90bee31 failed -> stopped +2025-12-12 15:49:51,830 [INFO] [task_manager:247] 任务启动成功: 5109ecb2-3e1d-474a-9c21-a2dcc90bee31 +2025-12-12 15:49:51,830 [INFO] [server:225] 任务启动成功: 5109ecb2-3e1d-474a-9c21-a2dcc90bee31 +2025-12-12 15:50:34,569 [INFO] [main:120] 收到退出信号,停止所有服务... +2025-12-12 15:50:34,569 [INFO] [task_stream_manager:234] 清理所有任务推流器 +2025-12-12 15:50:37,607 [INFO] [main:23] 任务管理器初始化... +2025-12-12 15:50:37,607 [INFO] [main:24] 任务管理器实例: +2025-12-12 15:50:37,607 [INFO] [main:102] 启动多任务版YOLOv8服务 +2025-12-12 15:50:37,624 [INFO] [main:103] PyTorch版本: 2.9.1+cu126, CUDA可用: True +2025-12-12 15:50:37,625 [INFO] [main:77] 定时清理调度器已启动 +2025-12-12 15:50:37,686 [INFO] [task_stream_manager:202] 任务推流健康监控启动 +2025-12-12 15:50:37,687 [INFO] [main:113] 任务推流管理器初始化完成 +2025-12-12 15:50:42,726 [INFO] [server:40] 任务管理器初始化完成 +2025-12-12 15:50:42,726 [INFO] [server:70] 收到创建任务请求: 多模型道路监控 +2025-12-12 15:50:42,726 [INFO] [server:84] 开始创建任务前的模型验证... +2025-12-12 15:50:42,818 [INFO] [mandatory_model_crypto:124] 模型解密验证成功: encrypted_models\d568ab8378383793.enc +2025-12-12 15:50:42,881 [INFO] [mandatory_model_crypto:124] 模型解密验证成功: encrypted_models\d568ab8378383793.enc +2025-12-12 15:50:42,882 [INFO] [server:120] 模型验证通过: 2/2 个模型有效 +2025-12-12 15:50:42,882 [INFO] [server:172] 添加已验证的加密模型 0: encrypted_models/d568ab8378383793.enc +2025-12-12 15:50:42,882 [INFO] [server:172] 添加已验证的加密模型 1: encrypted_models/d568ab8378383793.enc +2025-12-12 15:50:42,882 [INFO] [server:175] 创建任务前清理已停止的任务... +2025-12-12 15:50:42,882 [INFO] [task_manager:527] 开始清理已停止的任务... +2025-12-12 15:50:42,883 [INFO] [task_manager:544] 清理已停止任务完成: 清理了 0 个 +2025-12-12 15:50:42,883 [INFO] [server:208] 开始创建任务,包含 2 个已验证的加密模型... +2025-12-12 15:50:42,883 [INFO] [task_manager:77] 当前活动任务: 0/5 +2025-12-12 15:50:42,883 [INFO] [task_manager:188] 创建加密任务成功: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3, 加密模型数: 2, 密钥已验证 +2025-12-12 15:50:42,883 [INFO] [server:212] 任务创建成功,ID: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:50:42,883 [INFO] [server:221] 启动任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3... +2025-12-12 15:50:43,929 [INFO] [task_stream_manager_windows:61] 找到FFmpeg: ffmpeg +2025-12-12 15:50:43,929 [INFO] [windows_utils:497] 检测到Windows系统,进行系统检测和配置... +2025-12-12 15:50:43,937 [INFO] [windows_utils:515] Windows系统: Windows 10/11 (Build 22621) +2025-12-12 15:50:44,037 [INFO] [windows_utils:530] FFmpeg版本: ffmpeg version N-117451-g0f5592cfc7-20241010 Copyright (c) 2000-2024 the FFmpeg developers +2025-12-12 15:50:44,037 [INFO] [windows_utils:531] FFmpeg路径: D:\ffmpeg-master-latest-win64-gpl\bin\ffmpeg.exe +2025-12-12 15:50:44,037 [INFO] [windows_utils:534] 运行FFmpeg功能测试... +2025-12-12 15:50:44,162 [INFO] [windows_utils:545] FFmpeg功能测试成功! +2025-12-12 15:50:44,165 [INFO] [windows_utils:551] 检测到 1 个GPU: +2025-12-12 15:50:44,165 [INFO] [windows_utils:553] GPU0: NVIDIA GeForce RTX 3060 +2025-12-12 15:50:44,226 [INFO] [windows_utils:565] 系统优化建议: +2025-12-12 15:50:44,226 [INFO] [windows_utils:572] power_scheme: 电源方案 GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (高性能) +2025-12-12 15:50:44,226 [INFO] [windows_utils:572] power_recommendation: For best streaming performance, use High Performance power plan. Run: powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c +2025-12-12 15:50:44,226 [INFO] [windows_utils:572] firewall: Consider adding firewall rules for RTMP ports (1935, 1936) +2025-12-12 15:50:44,226 [INFO] [windows_utils:568] network_optimizations: +2025-12-12 15:50:44,226 [INFO] [windows_utils:570] - Increase TCP buffer size: netsh int tcp set global autotuninglevel=normal +2025-12-12 15:50:44,226 [INFO] [windows_utils:570] - Disable TCP auto-tuning (if unstable): netsh int tcp set global autotuninglevel=disabled +2025-12-12 15:50:44,226 [INFO] [windows_utils:570] - Enable TCP fast open: netsh int tcp set global fastopen=enabled +2025-12-12 15:50:44,226 [INFO] [windows_utils:570] - Set TCP keepalive: netsh int tcp set global keepalivetime=30000 +2025-12-12 15:50:44,226 [INFO] [windows_utils:568] gpu_recommendations: +2025-12-12 15:50:44,226 [INFO] [windows_utils:570] - Update graphics drivers to latest version +2025-12-12 15:50:44,227 [INFO] [windows_utils:570] - In NVIDIA Control Panel: Set Power Management Mode to "Prefer Maximum Performance" +2025-12-12 15:50:44,227 [INFO] [windows_utils:570] - In Windows Graphics Settings: Add ffmpeg.exe and set to "High Performance" +2025-12-12 15:50:44,350 [INFO] [windows_utils:578] 系统资源: CPU 12.6%, 内存 26.6% +2025-12-12 15:50:44,350 [INFO] [windows_utils:623] Windows系统检测完成,状态正常 +2025-12-12 15:50:44,350 [INFO] [detectionThread:295] Windows系统检测完成: ready +2025-12-12 15:50:44,350 [INFO] [detectionThread:313] 检测线程初始化完成: 多模型道路监控 +2025-12-12 15:50:44,351 [INFO] [detectionThread:1136] 启动检测线程,任务ID: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:50:44,351 [INFO] [detectionThread:328] 开始从本地加载 2 个模型 +2025-12-12 15:50:44,351 [INFO] [detectionThread:343] 加载模型 0: d568ab8378383793 +2025-12-12 15:50:44,419 [INFO] [mandatory_model_crypto:124] 模型解密验证成功: encrypted_models\d568ab8378383793.enc +2025-12-12 15:50:44,955 [INFO] [detectionThread:123] 加密模型解密加载成功: encrypted_models/d568ab8378383793.enc +2025-12-12 15:50:45,289 [INFO] [detectionThread:155] 启用半精度推理: encrypted_models/d568ab8378383793.enc +2025-12-12 15:50:45,289 [INFO] [detectionThread:166] 模型加载成功: encrypted_models/d568ab8378383793.enc -> cuda:0 +2025-12-12 15:50:45,289 [INFO] [detectionThread:383] 模型加载成功: d568ab8378383793, 颜色: [0, 255, 0], 设备: cuda:0, 密钥验证: True +2025-12-12 15:50:45,290 [INFO] [detectionThread:343] 加载模型 1: d568ab8378383793 +2025-12-12 15:50:45,290 [INFO] [detectionThread:79] 使用缓存的模型: encrypted_models/d568ab8378383793.enc +2025-12-12 15:50:45,290 [INFO] [detectionThread:383] 模型加载成功: d568ab8378383793, 颜色: [0, 255, 0], 设备: cuda:0, 密钥验证: True +2025-12-12 15:50:45,290 [INFO] [detectionThread:406] 成功加载 2/2 个模型 +2025-12-12 15:50:45,290 [INFO] [detectionThread:411] 密钥验证统计: 2个有效, 0个无效 +2025-12-12 15:50:45,290 [INFO] [detectionThread:1147] 加密密钥验证结果: 2/2 个模型加载成功 +2025-12-12 15:50:45,290 [INFO] [detectionThread:447] 连接RTMP: rtmp://175.27.168.120:6019/live/8UUXN5400A079H +2025-12-12 15:50:45,340 [INFO] [detectionThread:459] 启用硬件加速解码 +2025-12-12 15:50:45,352 [INFO] [task_manager:247] 任务启动成功: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:50:45,352 [INFO] [server:225] 任务启动成功: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:50:51,169 [INFO] [detectionThread:479] 视频属性: 1280x720 @ 30.303030303030305fps +2025-12-12 15:50:51,170 [INFO] [detectionThread:493] 初始化任务推流器: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:50:53,222 [ERROR] [detectionThread:503] RTMP服务器不可达: Connection refused (服务器拒绝连接) +2025-12-12 15:50:53,222 [WARNING] [detectionThread:504] 推流可能失败,请检查网络和服务器状态 +2025-12-12 15:50:53,222 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:50:53,223 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 30.303030303030305 +2025-12-12 15:50:53,223 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:50:53,223 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 30.303030303030305 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:50:53,237 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 22840 +2025-12-12 15:50:54,224 [INFO] [task_stream_manager_windows:110] Windows任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器创建成功 +2025-12-12 15:50:54,225 [INFO] [detectionThread:516] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器初始化成功 +2025-12-12 15:50:54,225 [INFO] [task_stream_manager_windows:436] Windows推流健康监控启动 +2025-12-12 15:50:54,225 [INFO] [detectionThread:1165] 推流健康监控已启动 +2025-12-12 15:50:54,226 [INFO] [detectionThread:950] 启动MQTT客户端... +2025-12-12 15:50:54,238 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:50:54,238 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:50:54,257 [INFO] [detectionThread:968] MQTT客户端已启动 +2025-12-12 15:50:54,257 [INFO] [detectionThread:859] 上传工作线程启动 +2025-12-12 15:50:54,258 [INFO] [detectionThread:1177] 图片上传线程已启动 +2025-12-12 15:50:54,258 [INFO] [detectionThread:710] 预热所有模型... +2025-12-12 15:51:09,794 [INFO] [detectionThread:730] 模型 d568ab8378383793 预热完成 +2025-12-12 15:51:09,823 [INFO] [detectionThread:730] 模型 d568ab8378383793 预热完成 +2025-12-12 15:51:09,823 [INFO] [detectionThread:734] 所有模型预热完成 +2025-12-12 15:51:09,823 [INFO] [task_manager:487] 更新任务状态: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 running -> running +2025-12-12 15:51:09,823 [INFO] [detectionThread:1185] 资源初始化完成 +2025-12-12 15:51:12,447 [INFO] [detectionThread:1271] 帧处理耗时: 50.55ms | 平均FPS: 19.78 +2025-12-12 15:51:12,447 [INFO] [detectionThread:1281] 推流统计: 49帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:51:15,053 [INFO] [detectionThread:1271] 帧处理耗时: 52.10ms | 平均FPS: 19.19 +2025-12-12 15:51:15,053 [INFO] [detectionThread:1281] 推流统计: 99帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:51:15,106 [INFO] [task_stream_manager_windows:348] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已推流 100 帧 +2025-12-12 15:51:15,107 [INFO] [detectionThread:615] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已成功推流 100 帧,成功率: 100.00% +2025-12-12 15:51:15,982 [WARNING] [ffmpegStreamer:302] FFmpeg错误: [p @ 0000020Sng[tcp @ 0000020eee5ec440] Connection attempt to ::1 port 1935 failed: Error number -138 occure[tcp @ 0000020eee5ec440] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:51:15,988 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:51:15,988 [WARNING] [ffmpegStreamer:441] 管道破裂状态 +2025-12-12 15:51:15,994 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:51:15,994 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:51:16,000 [WARNING] [ffmpegStreamer:178] 连续写入失败 10 次 +2025-12-12 15:51:16,001 [WARNING] [ffmpegStreamer:182] 连续失败 10 次,尝试恢复 +2025-12-12 15:51:16,001 [INFO] [ffmpegStreamer:458] 尝试恢复推流进程... +2025-12-12 15:51:16,001 [INFO] [ffmpegStreamer:489] 问题较严重,尝试重启FFmpeg +2025-12-12 15:51:16,001 [INFO] [ffmpegStreamer:540] 准备重启FFmpeg (1/10), 2.0秒后执行... +2025-12-12 15:51:16,017 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:51:16,017 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (1/5) +2025-12-12 15:51:16,052 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:51:16,052 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (2/5) +2025-12-12 15:51:16,083 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [tcp @ 0000020eee5ec440] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:51:16,088 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:51:16,088 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (3/5) +2025-12-12 15:51:16,088 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:51:16,088 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:51:16,088 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:51:16,088 [INFO] [detectionThread:650] 最近输出: [tcp @ 0000020eee5ec440] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:51:16,088 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:51:16,088 [INFO] [detectionThread:657] Input #0, rawvideo, from 'fd:: Duration: N/A, start: 0.000000, bitrate: 670254 kb/s +2025-12-12 15:51:16,089 [INFO] [detectionThread:657] tceee5ec440] tarti connection attempt to 127.0.0.1 port 1935 +2025-12-12 15:51:16,089 [INFO] [detectionThread:657] rd +2025-12-12 15:51:16,089 [INFO] [detectionThread:657] [tcp @ 0000020eee5ec440] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:51:16,184 [ERROR] [task_stream_manager_windows:271] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3] 关键错误: [rtmp @ 0000020eee5cf000] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:51:16,184 [INFO] [task_stream_manager_windows:289] 安全重启推流器: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:51:16,185 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:51:16,185 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 22840... +2025-12-12 15:51:16,185 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 22840 已停止 +2025-12-12 15:51:16,502 [INFO] [ffmpegStreamer:546] 收到停止信号,取消重启 +2025-12-12 15:51:16,502 [ERROR] [ffmpegStreamer:184] 恢复失败,停止推流 +2025-12-12 15:51:16,502 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 23.3秒 + 总帧数: 50 + 成功发送: 1 + 丢弃帧数: 49 + 丢帧率: 98.0% + 平均FPS: 0.0 + 重启次数: 1 +2025-12-12 15:51:16,502 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:51:16,502 [INFO] [ffmpegStreamer:1020] 推流线程已完全停止 +2025-12-12 15:51:16,503 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:51:17,504 [WARNING] [task_stream_manager_windows:71] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已有推流器,先清理 +2025-12-12 15:51:17,504 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:51:17,504 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:51:17,505 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 30.303030303030305 +2025-12-12 15:51:17,505 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:51:17,505 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 30.303030303030305 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:51:17,522 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 17748 +2025-12-12 15:51:18,505 [INFO] [task_stream_manager_windows:110] Windows任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器创建成功 +2025-12-12 15:51:18,506 [INFO] [task_stream_manager_windows:310] 推流器重启成功: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:51:18,506 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [rtmp @ 0000020eee5cf000] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:51:18,523 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:51:18,523 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:51:19,526 [INFO] [detectionThread:1271] 帧处理耗时: 89.47ms | 平均FPS: 11.18 +2025-12-12 15:51:19,527 [INFO] [detectionThread:1281] 推流统计: 149帧, 成功率: 97.99%, 重启: 0次 +2025-12-12 15:51:21,638 [INFO] [detectionThread:1271] 帧处理耗时: 42.22ms | 平均FPS: 23.69 +2025-12-12 15:51:21,638 [INFO] [detectionThread:1281] 推流统计: 199帧, 成功率: 98.49%, 重启: 0次 +2025-12-12 15:51:21,674 [INFO] [detectionThread:615] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已成功推流 200 帧,成功率: 98.50% +2025-12-12 15:51:22,652 [INFO] [task_stream_manager_windows:348] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已推流 100 帧 +2025-12-12 15:51:23,806 [INFO] [detectionThread:1271] 帧处理耗时: 43.34ms | 平均FPS: 23.07 +2025-12-12 15:51:23,806 [INFO] [detectionThread:1281] 推流统计: 249帧, 成功率: 98.80%, 重启: 0次 +2025-12-12 15:51:24,062 [WARNING] [ffmpegStreamer:302] FFmpeg错误: tp@ 001f0]Cn attempt to :: 1ledError number -138 occurred +2025-12-12 15:51:24,063 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: t00001b4[c 000b4dadcb0 onnectio1 port935 fai: [tcp @ 000001b4dadfcb00] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:51:24,067 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:51:24,068 [WARNING] [ffmpegStreamer:441] 管道破裂状态 +2025-12-12 15:51:24,073 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:51:24,073 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:51:24,080 [WARNING] [ffmpegStreamer:178] 连续写入失败 10 次 +2025-12-12 15:51:24,081 [WARNING] [ffmpegStreamer:182] 连续失败 10 次,尝试恢复 +2025-12-12 15:51:24,081 [INFO] [ffmpegStreamer:458] 尝试恢复推流进程... +2025-12-12 15:51:24,081 [INFO] [ffmpegStreamer:489] 问题较严重,尝试重启FFmpeg +2025-12-12 15:51:24,081 [INFO] [ffmpegStreamer:540] 准备重启FFmpeg (1/10), 2.0秒后执行... +2025-12-12 15:51:24,092 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:51:24,092 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (1/5) +2025-12-12 15:51:24,129 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:51:24,129 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (2/5) +2025-12-12 15:51:24,164 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [tcp @ 000001b4dadfcb00] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:51:24,166 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:51:24,166 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (3/5) +2025-12-12 15:51:24,166 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:51:24,166 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:51:24,166 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:51:24,166 [INFO] [detectionThread:650] 最近输出: [tcp @ 000001b4dadfcb00] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:51:24,166 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:51:24,166 [INFO] [detectionThread:657] Input#0, rawvideo, from: +2025-12-12 15:51:24,166 [INFO] [detectionThread:657] t00001b4[c 000b4dadcb0 onnectio1 port935 fai: [tcp @ 000001b4dadfcb00] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:51:24,166 [INFO] [detectionThread:657] [tcp @ 000001b4dadfcb00] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:51:24,265 [ERROR] [task_stream_manager_windows:271] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3] 关键错误: [rtmp @ 000001b4dadb5e00] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:51:24,265 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [rtmp @ 000001b4dadb5e00] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:51:24,344 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:51:24,344 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (4/5) +2025-12-12 15:51:24,344 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:51:24,344 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:51:24,344 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:51:24,345 [INFO] [detectionThread:650] 最近输出: [rtmp @ 000001b4dadb5e00] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:51:24,345 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:51:24,345 [INFO] [detectionThread:657] Input#0, rawvideo, from: +2025-12-12 15:51:24,345 [INFO] [detectionThread:657] t00001b4[c 000b4dadcb0 onnectio1 port935 fai: [tcp @ 000001b4dadfcb00] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:51:24,345 [INFO] [detectionThread:657] [tcp @ 000001b4dadfcb00] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:51:24,345 [INFO] [detectionThread:657] [rtmp @ 000001b4dadb5e00] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:51:24,366 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [out#0/flv @ 000001b4dadb4000] Error opening output rtmp://localhost:1935/live/15: Error number -138 occurred +2025-12-12 15:51:24,480 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: Error opening output file rtmp://localhost:1935/live/15. +2025-12-12 15:51:24,511 [WARNING] [task_stream_manager_windows:458] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 FFmpeg进程已退出 +2025-12-12 15:51:24,522 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:51:24,523 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (5/5) +2025-12-12 15:51:24,523 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:51:24,523 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:51:24,523 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:51:24,523 [INFO] [detectionThread:650] 最近输出: Error opening output file rtmp://localhost:1935/live/15. +2025-12-12 15:51:24,523 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:51:24,523 [INFO] [detectionThread:657] t00001b4[c 000b4dadcb0 onnectio1 port935 fai: [tcp @ 000001b4dadfcb00] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:51:24,523 [INFO] [detectionThread:657] [tcp @ 000001b4dadfcb00] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:51:24,523 [INFO] [detectionThread:657] [rtmp @ 000001b4dadb5e00] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:51:24,523 [INFO] [detectionThread:657] [out#0/flv @ 000001b4dadb4000] Error opening output rtmp://localhost:1935/live/15: Error number -138 occurred +2025-12-12 15:51:24,524 [INFO] [detectionThread:657] Error opening output file rtmp://localhost:1935/live/15. +2025-12-12 15:51:24,581 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: Error opening output files: Error number -138 occurred +2025-12-12 15:51:24,665 [ERROR] [detectionThread:629] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流连续失败,尝试恢复 +2025-12-12 15:51:24,665 [INFO] [detectionThread:674] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 尝试恢复推流器 +2025-12-12 15:51:24,665 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:51:24,666 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 17748... +2025-12-12 15:51:24,666 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 17748 已停止 +2025-12-12 15:51:25,082 [INFO] [ffmpegStreamer:546] 收到停止信号,取消重启 +2025-12-12 15:51:25,082 [ERROR] [ffmpegStreamer:184] 恢复失败,停止推流 +2025-12-12 15:51:25,082 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 7.6秒 + 总帧数: 56 + 成功发送: 1 + 丢弃帧数: 55 + 丢帧率: 98.2% + 平均FPS: 0.1 + 重启次数: 1 +2025-12-12 15:51:25,083 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:51:25,083 [INFO] [ffmpegStreamer:1020] 推流线程已完全停止 +2025-12-12 15:51:25,083 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:51:25,083 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:51:25,083 [INFO] [detectionThread:703] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器已清理 +2025-12-12 15:51:27,084 [INFO] [detectionThread:493] 初始化任务推流器: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:51:29,126 [ERROR] [detectionThread:503] RTMP服务器不可达: Connection refused (服务器拒绝连接) +2025-12-12 15:51:29,126 [WARNING] [detectionThread:504] 推流可能失败,请检查网络和服务器状态 +2025-12-12 15:51:29,126 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:51:29,127 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 20.061300062110462 +2025-12-12 15:51:29,127 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:51:29,127 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 20.061300062110462 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:51:29,142 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 22816 +2025-12-12 15:51:30,127 [INFO] [task_stream_manager_windows:110] Windows任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器创建成功 +2025-12-12 15:51:30,128 [INFO] [detectionThread:516] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器初始化成功 +2025-12-12 15:51:30,129 [INFO] [detectionThread:686] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器恢复成功 (第1次重启) +2025-12-12 15:51:30,144 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:51:30,144 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:51:31,229 [INFO] [detectionThread:1271] 帧处理耗时: 148.45ms | 平均FPS: 6.74 +2025-12-12 15:51:31,229 [INFO] [detectionThread:1281] 推流统计: 299帧, 成功率: 97.32%, 重启: 1次 +2025-12-12 15:51:31,250 [INFO] [detectionThread:615] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已成功推流 300 帧,成功率: 97.33% +2025-12-12 15:51:32,584 [INFO] [detectionThread:1271] 帧处理耗时: 27.10ms | 平均FPS: 36.91 +2025-12-12 15:51:32,584 [INFO] [detectionThread:1281] 推流统计: 349帧, 成功率: 97.71%, 重启: 1次 +2025-12-12 15:51:32,862 [INFO] [task_stream_manager_windows:348] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已推流 100 帧 +2025-12-12 15:51:33,897 [INFO] [detectionThread:1271] 帧处理耗时: 26.27ms | 平均FPS: 38.07 +2025-12-12 15:51:33,898 [INFO] [detectionThread:1281] 推流统计: 399帧, 成功率: 97.99%, 重启: 1次 +2025-12-12 15:51:33,918 [INFO] [detectionThread:615] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已成功推流 400 帧,成功率: 98.00% +2025-12-12 15:51:35,227 [INFO] [detectionThread:1271] 帧处理耗时: 26.56ms | 平均FPS: 37.64 +2025-12-12 15:51:35,227 [INFO] [detectionThread:1281] 推流统计: 449帧, 成功率: 98.22%, 重启: 1次 +2025-12-12 15:51:35,488 [INFO] [task_stream_manager_windows:348] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已推流 200 帧 +2025-12-12 15:51:35,716 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: t 000001dfc0eaa000]onnectmptt 19led: E8 occurr[tcp @ 000001dfc0eaa000] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:51:35,721 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:51:35,722 [WARNING] [ffmpegStreamer:441] 管道破裂状态 +2025-12-12 15:51:35,725 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:51:35,728 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:51:35,742 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:51:35,742 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (1/5) +2025-12-12 15:51:35,761 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:51:35,761 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (2/5) +2025-12-12 15:51:35,781 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:51:35,781 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (3/5) +2025-12-12 15:51:35,781 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:51:35,781 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:51:35,781 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:51:35,781 [INFO] [detectionThread:650] 最近输出: t 000001dfc0eaa000]onnectmptt 19led: E8 occurr[tcp @ 000001dfc0eaa000] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:51:35,781 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:51:35,781 [INFO] [detectionThread:657] Ip#ra, from 'fd:': Duration: N/A, start: 0.000000, bitrate: 443723 kb/s +2025-12-12 15:51:35,781 [INFO] [detectionThread:657] t0001fc0eaa000] Startingnection a +2025-12-12 15:51:35,781 [INFO] [detectionThread:657] t 000001dfc0eaa000]onnectmptt 19led: E8 occurr[tcp @ 000001dfc0eaa000] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:51:35,817 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [tcp @ 000001dfc0eaa000] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:51:35,918 [ERROR] [task_stream_manager_windows:271] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3] 关键错误: [rtmp @ 000001dfc0ea9ac0] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:51:35,918 [INFO] [task_stream_manager_windows:289] 安全重启推流器: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:51:35,918 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:51:35,918 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 22816... +2025-12-12 15:51:35,918 [INFO] [ffmpegStreamer:145] 接收到停止信号 +2025-12-12 15:51:35,918 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 22816 已停止 +2025-12-12 15:51:35,919 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 6.8秒 + 总帧数: 79 + 成功发送: 1 + 丢弃帧数: 78 + 丢帧率: 98.7% + 平均FPS: 0.1 + 重启次数: 0 +2025-12-12 15:51:35,919 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:51:36,220 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:51:37,221 [WARNING] [task_stream_manager_windows:71] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已有推流器,先清理 +2025-12-12 15:51:37,221 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:51:37,221 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:51:37,222 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 20.061300062110462 +2025-12-12 15:51:37,222 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:51:37,222 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 20.061300062110462 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:51:37,237 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 21312 +2025-12-12 15:51:38,222 [INFO] [task_stream_manager_windows:110] Windows任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器创建成功 +2025-12-12 15:51:38,222 [INFO] [task_stream_manager_windows:310] 推流器重启成功: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:51:38,222 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [rtmp @ 000001dfc0ea9ac0] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:51:38,239 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:51:38,239 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:51:38,895 [INFO] [detectionThread:1271] 帧处理耗时: 73.37ms | 平均FPS: 13.63 +2025-12-12 15:51:38,895 [INFO] [detectionThread:1281] 推流统计: 499帧, 成功率: 97.80%, 重启: 1次 +2025-12-12 15:51:38,915 [INFO] [detectionThread:615] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已成功推流 500 帧,成功率: 97.80% +2025-12-12 15:51:40,229 [INFO] [detectionThread:1271] 帧处理耗时: 26.67ms | 平均FPS: 37.49 +2025-12-12 15:51:40,229 [INFO] [detectionThread:1281] 推流统计: 549帧, 成功率: 98.00%, 重启: 1次 +2025-12-12 15:51:40,784 [INFO] [task_stream_manager_windows:348] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已推流 100 帧 +2025-12-12 15:51:41,544 [INFO] [detectionThread:1271] 帧处理耗时: 26.28ms | 平均FPS: 38.05 +2025-12-12 15:51:41,544 [INFO] [detectionThread:1281] 推流统计: 599帧, 成功率: 98.16%, 重启: 1次 +2025-12-12 15:51:41,578 [INFO] [detectionThread:615] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已成功推流 600 帧,成功率: 98.17% +2025-12-12 15:51:42,912 [INFO] [detectionThread:1271] 帧处理耗时: 27.36ms | 平均FPS: 36.55 +2025-12-12 15:51:42,912 [INFO] [detectionThread:1281] 推流统计: 649帧, 成功率: 98.31%, 重启: 1次 +2025-12-12 15:51:43,539 [INFO] [task_stream_manager_windows:348] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已推流 200 帧 +2025-12-12 15:51:43,784 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: tcp @ 000002505ff48340]onetion atempt to ::1 port 195fie:Errnumber -1[tcp @ 000002505ff48340] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:51:43,791 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:51:43,791 [WARNING] [ffmpegStreamer:441] 管道破裂状态 +2025-12-12 15:51:43,794 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:51:43,795 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:51:43,799 [WARNING] [ffmpegStreamer:178] 连续写入失败 10 次 +2025-12-12 15:51:43,799 [WARNING] [ffmpegStreamer:182] 连续失败 10 次,尝试恢复 +2025-12-12 15:51:43,799 [INFO] [ffmpegStreamer:458] 尝试恢复推流进程... +2025-12-12 15:51:43,799 [INFO] [ffmpegStreamer:489] 问题较严重,尝试重启FFmpeg +2025-12-12 15:51:43,799 [INFO] [ffmpegStreamer:540] 准备重启FFmpeg (1/10), 2.0秒后执行... +2025-12-12 15:51:43,802 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:51:43,802 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (1/5) +2025-12-12 15:51:43,823 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:51:43,823 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (2/5) +2025-12-12 15:51:43,844 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:51:43,844 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (3/5) +2025-12-12 15:51:43,844 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:51:43,844 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:51:43,844 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:51:43,844 [INFO] [detectionThread:650] 最近输出: tcp @ 000002505ff48340]onetion atempt to ::1 port 195fie:Errnumber -1[tcp @ 000002505ff48340] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:51:43,844 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:51:43,844 [INFO] [detectionThread:657] Ip, raw, fro Duration: N/A, start: 0.000000, bitrate: 443723 kb/s +2025-12-12 15:51:43,844 [INFO] [detectionThread:657] tcf4830 taigcneto tep o17001pr 95 +2025-12-12 15:51:43,844 [INFO] [detectionThread:657] tcp @ 000002505ff48340]onetion atempt to ::1 port 195fie:Errnumber -1[tcp @ 000002505ff48340] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:51:43,885 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [tcp @ 000002505ff48340] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:51:43,986 [ERROR] [task_stream_manager_windows:271] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3] 关键错误: [rtmp @ 000002505ff01700] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:51:43,986 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [rtmp @ 000002505ff01700] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:51:43,990 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:51:43,991 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (4/5) +2025-12-12 15:51:43,991 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:51:43,991 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:51:43,991 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:51:43,991 [INFO] [detectionThread:650] 最近输出: [rtmp @ 000002505ff01700] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:51:43,991 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:51:43,991 [INFO] [detectionThread:657] Ip, raw, fro Duration: N/A, start: 0.000000, bitrate: 443723 kb/s +2025-12-12 15:51:43,991 [INFO] [detectionThread:657] tcf4830 taigcneto tep o17001pr 95 +2025-12-12 15:51:43,991 [INFO] [detectionThread:657] tcp @ 000002505ff48340]onetion atempt to ::1 port 195fie:Errnumber -1[tcp @ 000002505ff48340] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:51:43,991 [INFO] [detectionThread:657] [tcp @ 000002505ff48340] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:51:43,991 [INFO] [detectionThread:657] [rtmp @ 000002505ff01700] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:51:44,086 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [out#0/flv @ 000002505feff800] Error opening output rtmp://localhost:1935/live/15: Error number -138 occurred +2025-12-12 15:51:44,134 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:51:44,134 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (5/5) +2025-12-12 15:51:44,134 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:51:44,134 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:51:44,134 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:51:44,134 [INFO] [detectionThread:650] 最近输出: [out#0/flv @ 000002505feff800] Error opening output rtmp://localhost:1935/live/15: Error number -138 occurred +2025-12-12 15:51:44,134 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:51:44,134 [INFO] [detectionThread:657] tcf4830 taigcneto tep o17001pr 95 +2025-12-12 15:51:44,134 [INFO] [detectionThread:657] tcp @ 000002505ff48340]onetion atempt to ::1 port 195fie:Errnumber -1[tcp @ 000002505ff48340] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:51:44,134 [INFO] [detectionThread:657] [tcp @ 000002505ff48340] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:51:44,134 [INFO] [detectionThread:657] [rtmp @ 000002505ff01700] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:51:44,134 [INFO] [detectionThread:657] [out#0/flv @ 000002505feff800] Error opening output rtmp://localhost:1935/live/15: Error number -138 occurred +2025-12-12 15:51:44,187 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: Error opening output file rtmp://localhost:1935/live/15. +2025-12-12 15:51:44,224 [WARNING] [task_stream_manager_windows:458] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 FFmpeg进程已退出 +2025-12-12 15:51:44,255 [ERROR] [detectionThread:629] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流连续失败,尝试恢复 +2025-12-12 15:51:44,255 [INFO] [detectionThread:674] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 尝试恢复推流器 +2025-12-12 15:51:44,255 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:51:44,256 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 21312... +2025-12-12 15:51:44,256 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 21312 已停止 +2025-12-12 15:51:44,301 [INFO] [ffmpegStreamer:546] 收到停止信号,取消重启 +2025-12-12 15:51:44,301 [ERROR] [ffmpegStreamer:184] 恢复失败,停止推流 +2025-12-12 15:51:44,301 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 7.1秒 + 总帧数: 82 + 成功发送: 1 + 丢弃帧数: 81 + 丢帧率: 98.8% + 平均FPS: 0.1 + 重启次数: 1 +2025-12-12 15:51:44,301 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:51:44,557 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:51:44,557 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:51:44,557 [INFO] [detectionThread:703] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器已清理 +2025-12-12 15:51:46,558 [INFO] [detectionThread:493] 初始化任务推流器: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:51:48,587 [ERROR] [detectionThread:503] RTMP服务器不可达: Connection refused (服务器拒绝连接) +2025-12-12 15:51:48,587 [WARNING] [detectionThread:504] 推流可能失败,请检查网络和服务器状态 +2025-12-12 15:51:48,587 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:51:48,588 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 34.54969600588528 +2025-12-12 15:51:48,588 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:51:48,588 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 34.54969600588528 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:51:48,607 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 23048 +2025-12-12 15:51:49,588 [INFO] [task_stream_manager_windows:110] Windows任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器创建成功 +2025-12-12 15:51:49,589 [INFO] [detectionThread:516] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器初始化成功 +2025-12-12 15:51:49,589 [INFO] [detectionThread:686] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器恢复成功 (第2次重启) +2025-12-12 15:51:49,608 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:51:49,608 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:51:49,985 [INFO] [detectionThread:1271] 帧处理耗时: 141.45ms | 平均FPS: 7.07 +2025-12-12 15:51:49,985 [INFO] [detectionThread:1281] 推流统计: 699帧, 成功率: 97.71%, 重启: 2次 +2025-12-12 15:51:50,023 [INFO] [detectionThread:615] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已成功推流 700 帧,成功率: 97.71% +2025-12-12 15:51:51,316 [INFO] [detectionThread:1271] 帧处理耗时: 26.60ms | 平均FPS: 37.59 +2025-12-12 15:51:51,316 [INFO] [detectionThread:1281] 推流统计: 749帧, 成功率: 97.86%, 重启: 2次 +2025-12-12 15:51:52,320 [INFO] [task_stream_manager_windows:348] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已推流 100 帧 +2025-12-12 15:51:52,719 [INFO] [detectionThread:1271] 帧处理耗时: 28.07ms | 平均FPS: 35.63 +2025-12-12 15:51:52,719 [INFO] [detectionThread:1281] 推流统计: 799帧, 成功率: 98.00%, 重启: 2次 +2025-12-12 15:51:52,740 [INFO] [detectionThread:615] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已成功推流 800 帧,成功率: 98.00% +2025-12-12 15:51:54,025 [INFO] [detectionThread:1271] 帧处理耗时: 26.12ms | 平均FPS: 38.28 +2025-12-12 15:51:54,025 [INFO] [detectionThread:1281] 推流统计: 849帧, 成功率: 98.12%, 重启: 2次 +2025-12-12 15:51:54,942 [INFO] [task_stream_manager_windows:348] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已推流 200 帧 +2025-12-12 15:51:55,173 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: tp @ 00 onnection attempt to ::1 port 1935 failed: Error number -138 occurred +2025-12-12 15:51:55,173 [WARNING] [ffmpegStreamer:302] FFmpeg错误: [c@001381 Startiction attempt toport 5 [c0001381de5a700]C[tcp @ 000001381de5a700] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:51:55,178 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:51:55,178 [WARNING] [ffmpegStreamer:441] 管道破裂状态 +2025-12-12 15:51:55,182 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:51:55,186 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:51:55,187 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:51:55,187 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (1/5) +2025-12-12 15:51:55,207 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:51:55,207 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (2/5) +2025-12-12 15:51:55,228 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:51:55,228 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (3/5) +2025-12-12 15:51:55,228 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:51:55,228 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:51:55,228 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:51:55,228 [INFO] [detectionThread:650] 最近输出: tp @ 00 onnection attempt to ::1 port 1935 failed: Error number -138 occurred +2025-12-12 15:51:55,228 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:51:55,228 [INFO] [detectionThread:657] I Duration: N/A, start: 0.000000, bitrate: 764183 kb/s +2025-12-12 15:51:55,228 [INFO] [detectionThread:657] tp 000de5a700]ng conne 127.0.0.1 193 +2025-12-12 15:51:55,228 [INFO] [detectionThread:657] tp @ 00 onnection attempt to ::1 port 1935 failed: Error number -138 occurred +2025-12-12 15:51:55,274 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [tcp @ 000001381de5a700] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:51:55,367 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:51:55,368 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (4/5) +2025-12-12 15:51:55,368 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:51:55,368 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:51:55,368 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:51:55,368 [INFO] [detectionThread:650] 最近输出: [tcp @ 000001381de5a700] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:51:55,368 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:51:55,368 [INFO] [detectionThread:657] I Duration: N/A, start: 0.000000, bitrate: 764183 kb/s +2025-12-12 15:51:55,368 [INFO] [detectionThread:657] tp 000de5a700]ng conne 127.0.0.1 193 +2025-12-12 15:51:55,368 [INFO] [detectionThread:657] tp @ 00 onnection attempt to ::1 port 1935 failed: Error number -138 occurred +2025-12-12 15:51:55,368 [INFO] [detectionThread:657] [tcp @ 000001381de5a700] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:51:55,375 [ERROR] [task_stream_manager_windows:271] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3] 关键错误: [rtmp @ 000001381de5a1c0] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:51:55,375 [INFO] [task_stream_manager_windows:289] 安全重启推流器: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:51:55,375 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:51:55,375 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 23048... +2025-12-12 15:51:55,375 [INFO] [ffmpegStreamer:145] 接收到停止信号 +2025-12-12 15:51:55,375 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 23048 已停止 +2025-12-12 15:51:55,375 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 6.8秒 + 总帧数: 80 + 成功发送: 1 + 丢弃帧数: 79 + 丢帧率: 98.8% + 平均FPS: 0.1 + 重启次数: 0 +2025-12-12 15:51:55,375 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:51:55,689 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:51:56,689 [WARNING] [task_stream_manager_windows:71] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已有推流器,先清理 +2025-12-12 15:51:56,689 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:51:56,689 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:51:56,690 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 34.54969600588528 +2025-12-12 15:51:56,691 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:51:56,691 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 34.54969600588528 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:51:56,709 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 3696 +2025-12-12 15:51:57,691 [INFO] [task_stream_manager_windows:110] Windows任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器创建成功 +2025-12-12 15:51:57,692 [INFO] [task_stream_manager_windows:310] 推流器重启成功: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:51:57,692 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [rtmp @ 000001381de5a1c0] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:51:57,710 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:51:57,710 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:51:57,733 [INFO] [detectionThread:1271] 帧处理耗时: 74.16ms | 平均FPS: 13.48 +2025-12-12 15:51:57,733 [INFO] [detectionThread:1281] 推流统计: 899帧, 成功率: 97.78%, 重启: 2次 +2025-12-12 15:51:57,753 [INFO] [detectionThread:615] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已成功推流 900 帧,成功率: 97.78% +2025-12-12 15:51:58,989 [INFO] [detectionThread:1271] 帧处理耗时: 25.11ms | 平均FPS: 39.82 +2025-12-12 15:51:58,990 [INFO] [detectionThread:1281] 推流统计: 949帧, 成功率: 97.89%, 重启: 2次 +2025-12-12 15:52:00,241 [INFO] [task_stream_manager_windows:348] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已推流 100 帧 +2025-12-12 15:52:00,320 [INFO] [detectionThread:1271] 帧处理耗时: 26.61ms | 平均FPS: 37.58 +2025-12-12 15:52:00,320 [INFO] [detectionThread:1281] 推流统计: 999帧, 成功率: 98.00%, 重启: 2次 +2025-12-12 15:52:00,341 [INFO] [detectionThread:615] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已成功推流 1000 帧,成功率: 98.00% +2025-12-12 15:52:01,642 [INFO] [detectionThread:1271] 帧处理耗时: 26.44ms | 平均FPS: 37.82 +2025-12-12 15:52:01,643 [INFO] [detectionThread:1281] 推流统计: 1049帧, 成功率: 98.09%, 重启: 2次 +2025-12-12 15:52:02,937 [INFO] [task_stream_manager_windows:348] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已推流 200 帧 +2025-12-12 15:52:03,015 [INFO] [detectionThread:1271] 帧处理耗时: 27.45ms | 平均FPS: 36.43 +2025-12-12 15:52:03,015 [INFO] [detectionThread:1281] 推流统计: 1099帧, 成功率: 98.18%, 重启: 2次 +2025-12-12 15:52:03,037 [INFO] [detectionThread:615] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已成功推流 1100 帧,成功率: 98.18% +2025-12-12 15:52:03,250 [WARNING] [ffmpegStreamer:302] FFmpeg错误: t@ 000001ad65a79b00] Connection attempt to ::1 port 1935 failed: Error number -138 occurred +2025-12-12 15:52:03,251 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: t9b00] Stone[cp [tcp @ 000001ad65a79b00] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:52:03,255 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:52:03,256 [WARNING] [ffmpegStreamer:441] 管道破裂状态 +2025-12-12 15:52:03,260 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:52:03,261 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:52:03,278 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:03,278 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (1/5) +2025-12-12 15:52:03,299 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:03,299 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (2/5) +2025-12-12 15:52:03,320 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:03,320 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (3/5) +2025-12-12 15:52:03,320 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:52:03,320 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:52:03,320 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:52:03,320 [INFO] [detectionThread:650] 最近输出: t9b00] Stone[cp [tcp @ 000001ad65a79b00] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:52:03,320 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:52:03,320 [INFO] [detectionThread:657] Input #0, rawvdo, from 'fd:' Duration: N/A, start: 0.000000, bitrate: 764183 kb/s +2025-12-12 15:52:03,320 [INFO] [detectionThread:657] t9b00] Stone[cp [tcp @ 000001ad65a79b00] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:52:03,351 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [tcp @ 000001ad65a79b00] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:52:03,452 [ERROR] [task_stream_manager_windows:271] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3] 关键错误: [rtmp @ 000001ad65a32e40] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:52:03,452 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [rtmp @ 000001ad65a32e40] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:52:03,461 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:03,461 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (4/5) +2025-12-12 15:52:03,462 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:52:03,462 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:52:03,462 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:52:03,462 [INFO] [detectionThread:650] 最近输出: [rtmp @ 000001ad65a32e40] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:52:03,462 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:52:03,462 [INFO] [detectionThread:657] Input #0, rawvdo, from 'fd:' Duration: N/A, start: 0.000000, bitrate: 764183 kb/s +2025-12-12 15:52:03,462 [INFO] [detectionThread:657] t9b00] Stone[cp [tcp @ 000001ad65a79b00] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:52:03,462 [INFO] [detectionThread:657] [tcp @ 000001ad65a79b00] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:52:03,462 [INFO] [detectionThread:657] [rtmp @ 000001ad65a32e40] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:52:03,553 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [out#0/flv @ 000001ad65a30d00] Error opening output rtmp://localhost:1935/live/15: Error number -138 occurred +2025-12-12 15:52:03,599 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:03,599 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (5/5) +2025-12-12 15:52:03,599 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:52:03,599 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:52:03,599 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:52:03,599 [INFO] [detectionThread:650] 最近输出: [out#0/flv @ 000001ad65a30d00] Error opening output rtmp://localhost:1935/live/15: Error number -138 occurred +2025-12-12 15:52:03,599 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:52:03,599 [INFO] [detectionThread:657] Input #0, rawvdo, from 'fd:' Duration: N/A, start: 0.000000, bitrate: 764183 kb/s +2025-12-12 15:52:03,599 [INFO] [detectionThread:657] t9b00] Stone[cp [tcp @ 000001ad65a79b00] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:52:03,599 [INFO] [detectionThread:657] [tcp @ 000001ad65a79b00] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:52:03,599 [INFO] [detectionThread:657] [rtmp @ 000001ad65a32e40] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:52:03,599 [INFO] [detectionThread:657] [out#0/flv @ 000001ad65a30d00] Error opening output rtmp://localhost:1935/live/15: Error number -138 occurred +2025-12-12 15:52:03,653 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: Error opening output file rtmp://localhost:1935/live/15. +2025-12-12 15:52:03,693 [WARNING] [task_stream_manager_windows:458] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 FFmpeg进程已退出 +2025-12-12 15:52:03,723 [ERROR] [detectionThread:629] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流连续失败,尝试恢复 +2025-12-12 15:52:03,724 [INFO] [detectionThread:674] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 尝试恢复推流器 +2025-12-12 15:52:03,724 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:52:03,724 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 3696... +2025-12-12 15:52:03,724 [INFO] [ffmpegStreamer:145] 接收到停止信号 +2025-12-12 15:52:03,724 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 3696 已停止 +2025-12-12 15:52:03,724 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 7.0秒 + 总帧数: 82 + 成功发送: 1 + 丢弃帧数: 81 + 丢帧率: 98.8% + 平均FPS: 0.1 + 重启次数: 0 +2025-12-12 15:52:03,725 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:52:04,025 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:52:04,025 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:52:04,025 [INFO] [detectionThread:703] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器已清理 +2025-12-12 15:52:06,026 [INFO] [detectionThread:493] 初始化任务推流器: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:52:08,076 [ERROR] [detectionThread:503] RTMP服务器不可达: Connection refused (服务器拒绝连接) +2025-12-12 15:52:08,076 [WARNING] [detectionThread:504] 推流可能失败,请检查网络和服务器状态 +2025-12-12 15:52:08,076 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:52:08,077 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 32.654380917140415 +2025-12-12 15:52:08,077 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:52:08,077 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 32.654380917140415 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:52:08,090 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 22636 +2025-12-12 15:52:09,077 [INFO] [task_stream_manager_windows:110] Windows任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器创建成功 +2025-12-12 15:52:09,077 [INFO] [detectionThread:516] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器初始化成功 +2025-12-12 15:52:09,077 [INFO] [detectionThread:686] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器恢复成功 (第3次重启) +2025-12-12 15:52:09,090 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:52:09,090 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:52:09,974 [INFO] [detectionThread:1271] 帧处理耗时: 139.18ms | 平均FPS: 7.19 +2025-12-12 15:52:09,974 [INFO] [detectionThread:1281] 推流统计: 1149帧, 成功率: 97.82%, 重启: 3次 +2025-12-12 15:52:11,277 [INFO] [detectionThread:1271] 帧处理耗时: 26.05ms | 平均FPS: 38.38 +2025-12-12 15:52:11,277 [INFO] [detectionThread:1281] 推流统计: 1199帧, 成功率: 97.91%, 重启: 3次 +2025-12-12 15:52:11,319 [INFO] [detectionThread:615] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已成功推流 1200 帧,成功率: 97.92% +2025-12-12 15:52:11,634 [INFO] [task_stream_manager_windows:348] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已推流 100 帧 +2025-12-12 15:52:12,621 [INFO] [detectionThread:1271] 帧处理耗时: 26.86ms | 平均FPS: 37.23 +2025-12-12 15:52:12,621 [INFO] [detectionThread:1281] 推流统计: 1249帧, 成功率: 98.00%, 重启: 3次 +2025-12-12 15:52:13,945 [INFO] [detectionThread:1271] 帧处理耗时: 26.47ms | 平均FPS: 37.77 +2025-12-12 15:52:13,945 [INFO] [detectionThread:1281] 推流统计: 1299帧, 成功率: 98.08%, 重启: 3次 +2025-12-12 15:52:13,964 [INFO] [detectionThread:615] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已成功推流 1300 帧,成功率: 98.08% +2025-12-12 15:52:14,281 [INFO] [task_stream_manager_windows:348] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已推流 200 帧 +2025-12-12 15:52:14,643 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: tp @ 0002804ac]Cneto tep o:1pr 95fie:Errnme 18ocre [tcp @ 000002804ac890c0] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:52:14,647 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:52:14,647 [WARNING] [ffmpegStreamer:441] 管道破裂状态 +2025-12-12 15:52:14,650 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:52:14,653 [WARNING] [ffmpegStreamer:178] 连续写入失败 10 次 +2025-12-12 15:52:14,654 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:52:14,654 [WARNING] [ffmpegStreamer:182] 连续失败 10 次,尝试恢复 +2025-12-12 15:52:14,654 [INFO] [ffmpegStreamer:458] 尝试恢复推流进程... +2025-12-12 15:52:14,654 [INFO] [ffmpegStreamer:489] 问题较严重,尝试重启FFmpeg +2025-12-12 15:52:14,654 [ERROR] [ffmpegStreamer:517] 全局重启频率过高,等待60秒 +2025-12-12 15:52:14,654 [ERROR] [ffmpegStreamer:184] 恢复失败,停止推流 +2025-12-12 15:52:14,654 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 22636... +2025-12-12 15:52:14,654 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 22636 已停止 +2025-12-12 15:52:14,654 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 6.6秒 + 总帧数: 78 + 成功发送: 1 + 丢弃帧数: 77 + 丢帧率: 98.7% + 平均FPS: 0.2 + 重启次数: 0 +2025-12-12 15:52:14,654 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:52:14,672 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:14,672 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (1/5) +2025-12-12 15:52:14,691 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:14,691 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (2/5) +2025-12-12 15:52:14,710 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:14,710 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (3/5) +2025-12-12 15:52:14,710 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:52:14,710 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:52:14,710 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:52:14,710 [INFO] [detectionThread:650] 最近输出: tp @ 0002804ac]Cneto tep o:1pr 95fie:Errnme 18ocre [tcp @ 000002804ac890c0] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:52:14,710 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:52:14,710 [INFO] [detectionThread:657] Input #0, rawvideo, from 'fd:': +2025-12-12 15:52:14,710 [INFO] [detectionThread:657] t002890c0]Startigcneto tept to 127.0.0.1 port 1935 +2025-12-12 15:52:14,710 [INFO] [detectionThread:657] tp @ 0002804ac]Cneto tep o:1pr 95fie:Errnme 18ocre [tcp @ 000002804ac890c0] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:52:14,848 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:14,848 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (4/5) +2025-12-12 15:52:14,848 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:52:14,849 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:52:14,849 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:52:14,849 [INFO] [detectionThread:650] 最近输出: tp @ 0002804ac]Cneto tep o:1pr 95fie:Errnme 18ocre [tcp @ 000002804ac890c0] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:52:14,849 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:52:14,849 [INFO] [detectionThread:657] Input #0, rawvideo, from 'fd:': +2025-12-12 15:52:14,849 [INFO] [detectionThread:657] t002890c0]Startigcneto tept to 127.0.0.1 port 1935 +2025-12-12 15:52:14,849 [INFO] [detectionThread:657] tp @ 0002804ac]Cneto tep o:1pr 95fie:Errnme 18ocre [tcp @ 000002804ac890c0] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:52:14,986 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:14,986 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (5/5) +2025-12-12 15:52:14,986 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:52:14,986 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:52:14,986 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:52:14,986 [INFO] [detectionThread:650] 最近输出: tp @ 0002804ac]Cneto tep o:1pr 95fie:Errnme 18ocre [tcp @ 000002804ac890c0] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:52:14,986 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:52:14,986 [INFO] [detectionThread:657] Input #0, rawvideo, from 'fd:': +2025-12-12 15:52:14,986 [INFO] [detectionThread:657] t002890c0]Startigcneto tept to 127.0.0.1 port 1935 +2025-12-12 15:52:14,986 [INFO] [detectionThread:657] tp @ 0002804ac]Cneto tep o:1pr 95fie:Errnme 18ocre [tcp @ 000002804ac890c0] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:52:15,106 [ERROR] [detectionThread:629] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流连续失败,尝试恢复 +2025-12-12 15:52:15,106 [INFO] [detectionThread:674] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 尝试恢复推流器 +2025-12-12 15:52:15,106 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:52:15,407 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:52:15,407 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:52:15,407 [INFO] [detectionThread:703] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器已清理 +2025-12-12 15:52:17,408 [INFO] [detectionThread:493] 初始化任务推流器: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:52:19,438 [ERROR] [detectionThread:503] RTMP服务器不可达: Connection refused (服务器拒绝连接) +2025-12-12 15:52:19,438 [WARNING] [detectionThread:504] 推流可能失败,请检查网络和服务器状态 +2025-12-12 15:52:19,438 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:52:19,439 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 36.85509495653597 +2025-12-12 15:52:19,439 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:52:19,439 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 36.85509495653597 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:52:19,452 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 15084 +2025-12-12 15:52:20,439 [INFO] [task_stream_manager_windows:110] Windows任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器创建成功 +2025-12-12 15:52:20,439 [INFO] [detectionThread:516] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器初始化成功 +2025-12-12 15:52:20,439 [INFO] [detectionThread:686] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器恢复成功 (第4次重启) +2025-12-12 15:52:20,452 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:52:20,452 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:52:20,825 [INFO] [detectionThread:1271] 帧处理耗时: 137.60ms | 平均FPS: 7.27 +2025-12-12 15:52:20,825 [INFO] [detectionThread:1281] 推流统计: 1349帧, 成功率: 97.78%, 重启: 4次 +2025-12-12 15:52:22,188 [INFO] [detectionThread:1271] 帧处理耗时: 27.25ms | 平均FPS: 36.70 +2025-12-12 15:52:22,188 [INFO] [detectionThread:1281] 推流统计: 1399帧, 成功率: 97.86%, 重启: 4次 +2025-12-12 15:52:22,207 [INFO] [detectionThread:615] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已成功推流 1400 帧,成功率: 97.86% +2025-12-12 15:52:23,035 [INFO] [task_stream_manager_windows:348] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已推流 100 帧 +2025-12-12 15:52:23,528 [INFO] [detectionThread:1271] 帧处理耗时: 26.80ms | 平均FPS: 37.32 +2025-12-12 15:52:23,528 [INFO] [detectionThread:1281] 推流统计: 1449帧, 成功率: 97.93%, 重启: 4次 +2025-12-12 15:52:24,841 [INFO] [detectionThread:1271] 帧处理耗时: 26.24ms | 平均FPS: 38.11 +2025-12-12 15:52:24,841 [INFO] [detectionThread:1281] 推流统计: 1499帧, 成功率: 98.00%, 重启: 4次 +2025-12-12 15:52:24,882 [INFO] [detectionThread:615] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已成功推流 1500 帧,成功率: 98.00% +2025-12-12 15:52:25,694 [INFO] [task_stream_manager_windows:348] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已推流 200 帧 +2025-12-12 15:52:26,024 [WARNING] [ffmpegStreamer:302] FFmpeg错误: tcp @ 000001800a] on atte::1 poailedr numb8 occurred [tcp @ 0000018e100a8100] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:52:26,031 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:52:26,031 [WARNING] [ffmpegStreamer:441] 管道破裂状态 +2025-12-12 15:52:26,034 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:52:26,038 [WARNING] [ffmpegStreamer:178] 连续写入失败 10 次 +2025-12-12 15:52:26,038 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:52:26,038 [WARNING] [ffmpegStreamer:182] 连续失败 10 次,尝试恢复 +2025-12-12 15:52:26,038 [INFO] [ffmpegStreamer:458] 尝试恢复推流进程... +2025-12-12 15:52:26,038 [INFO] [ffmpegStreamer:489] 问题较严重,尝试重启FFmpeg +2025-12-12 15:52:26,039 [INFO] [ffmpegStreamer:540] 准备重启FFmpeg (1/10), 2.0秒后执行... +2025-12-12 15:52:26,040 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:26,040 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (1/5) +2025-12-12 15:52:26,059 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:26,059 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (2/5) +2025-12-12 15:52:26,078 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:26,078 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (3/5) +2025-12-12 15:52:26,078 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:52:26,078 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:52:26,078 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:52:26,078 [INFO] [detectionThread:650] 最近输出: t00001Startingconnection atp o17.0.0.1 prt 1935 [e18100Cnnectiompt to rt 1935 f: Erroer -13 +2025-12-12 15:52:26,078 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:52:26,078 [INFO] [detectionThread:657] Input #0, rawvideo, from 'fd:': +2025-12-12 15:52:26,078 [INFO] [detectionThread:657] t00001Startingconnection atp o17.0.0.1 prt 1935 [e18100Cnnectiompt to rt 1935 f: Erroer -13 +2025-12-12 15:52:26,125 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [tcp @ 0000018e100a8100] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:52:26,215 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:26,216 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (4/5) +2025-12-12 15:52:26,216 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:52:26,216 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:52:26,216 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:52:26,216 [INFO] [detectionThread:650] 最近输出: [tcp @ 0000018e100a8100] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:52:26,216 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:52:26,216 [INFO] [detectionThread:657] Input #0, rawvideo, from 'fd:': +2025-12-12 15:52:26,216 [INFO] [detectionThread:657] t00001Startingconnection atp o17.0.0.1 prt 1935 [e18100Cnnectiompt to rt 1935 f: Erroer -13 +2025-12-12 15:52:26,216 [INFO] [detectionThread:657] [tcp @ 0000018e100a8100] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:52:26,225 [ERROR] [task_stream_manager_windows:271] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3] 关键错误: [rtmp @ 0000018e10064c00] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:52:26,225 [INFO] [task_stream_manager_windows:289] 安全重启推流器: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:52:26,225 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:52:26,225 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 15084... +2025-12-12 15:52:26,226 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 15084 已停止 +2025-12-12 15:52:26,540 [INFO] [ffmpegStreamer:546] 收到停止信号,取消重启 +2025-12-12 15:52:26,540 [ERROR] [ffmpegStreamer:184] 恢复失败,停止推流 +2025-12-12 15:52:26,540 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 7.1秒 + 总帧数: 82 + 成功发送: 1 + 丢弃帧数: 81 + 丢帧率: 98.8% + 平均FPS: 0.1 + 重启次数: 1 +2025-12-12 15:52:26,540 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:52:26,540 [INFO] [ffmpegStreamer:1020] 推流线程已完全停止 +2025-12-12 15:52:26,540 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:52:27,541 [WARNING] [task_stream_manager_windows:71] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已有推流器,先清理 +2025-12-12 15:52:27,541 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:52:27,541 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:52:27,542 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 36.85509495653597 +2025-12-12 15:52:27,542 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:52:27,542 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 36.85509495653597 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:52:27,558 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 21940 +2025-12-12 15:52:28,543 [INFO] [task_stream_manager_windows:110] Windows任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器创建成功 +2025-12-12 15:52:28,543 [INFO] [task_stream_manager_windows:310] 推流器重启成功: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:52:28,544 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [rtmp @ 0000018e10064c00] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:52:28,559 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:52:28,559 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:52:28,564 [INFO] [detectionThread:1271] 帧处理耗时: 74.46ms | 平均FPS: 13.43 +2025-12-12 15:52:28,564 [INFO] [detectionThread:1281] 推流统计: 1549帧, 成功率: 97.81%, 重启: 4次 +2025-12-12 15:52:29,839 [INFO] [detectionThread:1271] 帧处理耗时: 25.50ms | 平均FPS: 39.22 +2025-12-12 15:52:29,839 [INFO] [detectionThread:1281] 推流统计: 1599帧, 成功率: 97.87%, 重启: 4次 +2025-12-12 15:52:29,860 [INFO] [detectionThread:615] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已成功推流 1600 帧,成功率: 97.88% +2025-12-12 15:52:31,106 [INFO] [task_stream_manager_windows:348] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已推流 100 帧 +2025-12-12 15:52:31,147 [INFO] [detectionThread:1271] 帧处理耗时: 26.14ms | 平均FPS: 38.26 +2025-12-12 15:52:31,147 [INFO] [detectionThread:1281] 推流统计: 1649帧, 成功率: 97.94%, 重启: 4次 +2025-12-12 15:52:32,471 [INFO] [detectionThread:1271] 帧处理耗时: 26.48ms | 平均FPS: 37.76 +2025-12-12 15:52:32,471 [INFO] [detectionThread:1281] 推流统计: 1699帧, 成功率: 98.00%, 重启: 4次 +2025-12-12 15:52:32,489 [INFO] [detectionThread:615] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已成功推流 1700 帧,成功率: 98.00% +2025-12-12 15:52:33,741 [INFO] [task_stream_manager_windows:348] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已推流 200 帧 +2025-12-12 15:52:33,803 [INFO] [detectionThread:1271] 帧处理耗时: 26.65ms | 平均FPS: 37.53 +2025-12-12 15:52:33,804 [INFO] [detectionThread:1281] 推流统计: 1749帧, 成功率: 98.06%, 重启: 4次 +2025-12-12 15:52:34,119 [WARNING] [ffmpegStreamer:302] FFmpeg错误: [cp @ 000001aec0] St to127.0.0.1 port 1935[cp @ec0onnection atte portfailed:r number -138 o +2025-12-12 15:52:34,119 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: t 000001aec1100] Cmpt to ::1 1935 Erroccurred[tcp @ 000001aec1100ec0] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:52:34,125 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:52:34,125 [WARNING] [ffmpegStreamer:441] 管道破裂状态 +2025-12-12 15:52:34,129 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:52:34,132 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:52:34,146 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:34,146 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (1/5) +2025-12-12 15:52:34,166 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:34,166 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (2/5) +2025-12-12 15:52:34,187 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:34,187 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (3/5) +2025-12-12 15:52:34,187 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:52:34,187 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:52:34,187 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:52:34,187 [INFO] [detectionThread:650] 最近输出: t 000001aec1100] Cmpt to ::1 1935 Erroccurred[tcp @ 000001aec1100ec0] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:52:34,187 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:52:34,187 [INFO] [detectionThread:657] Ipt, rawvide from 'fd:': +2025-12-12 15:52:34,187 [INFO] [detectionThread:657] tc1100etarting connection attemp +2025-12-12 15:52:34,187 [INFO] [detectionThread:657] t 000001aec1100] Cmpt to ::1 1935 Erroccurred[tcp @ 000001aec1100ec0] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:52:34,220 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [tcp @ 000001aec1100ec0] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:52:34,321 [ERROR] [task_stream_manager_windows:271] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3] 关键错误: [rtmp @ 000001aec111dbc0] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:52:34,321 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [rtmp @ 000001aec111dbc0] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:52:34,326 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:34,326 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (4/5) +2025-12-12 15:52:34,326 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:52:34,326 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:52:34,326 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:52:34,326 [INFO] [detectionThread:650] 最近输出: [rtmp @ 000001aec111dbc0] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:52:34,326 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:52:34,326 [INFO] [detectionThread:657] Ipt, rawvide from 'fd:': +2025-12-12 15:52:34,327 [INFO] [detectionThread:657] tc1100etarting connection attemp +2025-12-12 15:52:34,327 [INFO] [detectionThread:657] t 000001aec1100] Cmpt to ::1 1935 Erroccurred[tcp @ 000001aec1100ec0] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:52:34,327 [INFO] [detectionThread:657] [tcp @ 000001aec1100ec0] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:52:34,327 [INFO] [detectionThread:657] [rtmp @ 000001aec111dbc0] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:52:34,422 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [out#0/flv @ 000001aec10d4b80] Error opening output rtmp://localhost:1935/live/15: Error number -138 occurred +2025-12-12 15:52:34,466 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:34,466 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (5/5) +2025-12-12 15:52:34,466 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:52:34,466 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:52:34,466 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:52:34,466 [INFO] [detectionThread:650] 最近输出: [out#0/flv @ 000001aec10d4b80] Error opening output rtmp://localhost:1935/live/15: Error number -138 occurred +2025-12-12 15:52:34,466 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:52:34,467 [INFO] [detectionThread:657] tc1100etarting connection attemp +2025-12-12 15:52:34,467 [INFO] [detectionThread:657] t 000001aec1100] Cmpt to ::1 1935 Erroccurred[tcp @ 000001aec1100ec0] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:52:34,467 [INFO] [detectionThread:657] [tcp @ 000001aec1100ec0] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:52:34,467 [INFO] [detectionThread:657] [rtmp @ 000001aec111dbc0] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:52:34,467 [INFO] [detectionThread:657] [out#0/flv @ 000001aec10d4b80] Error opening output rtmp://localhost:1935/live/15: Error number -138 occurred +2025-12-12 15:52:34,522 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: Error opening output file rtmp://localhost:1935/live/15. +2025-12-12 15:52:34,544 [WARNING] [task_stream_manager_windows:458] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 FFmpeg进程已退出 +2025-12-12 15:52:34,589 [ERROR] [detectionThread:629] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流连续失败,尝试恢复 +2025-12-12 15:52:34,589 [INFO] [detectionThread:674] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 尝试恢复推流器 +2025-12-12 15:52:34,589 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:52:34,589 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 21940... +2025-12-12 15:52:34,589 [INFO] [ffmpegStreamer:145] 接收到停止信号 +2025-12-12 15:52:34,590 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 21940 已停止 +2025-12-12 15:52:34,590 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 7.0秒 + 总帧数: 83 + 成功发送: 1 + 丢弃帧数: 82 + 丢帧率: 98.8% + 平均FPS: 0.1 + 重启次数: 0 +2025-12-12 15:52:34,590 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:52:34,891 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:52:34,891 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:52:34,891 [INFO] [detectionThread:703] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器已清理 +2025-12-12 15:52:36,892 [INFO] [detectionThread:493] 初始化任务推流器: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:52:38,921 [ERROR] [detectionThread:503] RTMP服务器不可达: Connection refused (服务器拒绝连接) +2025-12-12 15:52:38,921 [WARNING] [detectionThread:504] 推流可能失败,请检查网络和服务器状态 +2025-12-12 15:52:38,921 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:52:38,922 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 35.30429833185527 +2025-12-12 15:52:38,922 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:52:38,922 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 35.30429833185527 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:52:38,938 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 21588 +2025-12-12 15:52:39,922 [INFO] [task_stream_manager_windows:110] Windows任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器创建成功 +2025-12-12 15:52:39,923 [INFO] [detectionThread:516] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器初始化成功 +2025-12-12 15:52:39,923 [INFO] [detectionThread:686] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器恢复成功 (第5次重启) +2025-12-12 15:52:39,939 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:52:39,939 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:52:40,758 [INFO] [detectionThread:1271] 帧处理耗时: 139.08ms | 平均FPS: 7.19 +2025-12-12 15:52:40,758 [INFO] [detectionThread:1281] 推流统计: 1799帧, 成功率: 97.83%, 重启: 5次 +2025-12-12 15:52:40,793 [INFO] [detectionThread:615] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已成功推流 1800 帧,成功率: 97.83% +2025-12-12 15:52:42,073 [INFO] [detectionThread:1271] 帧处理耗时: 26.29ms | 平均FPS: 38.03 +2025-12-12 15:52:42,073 [INFO] [detectionThread:1281] 推流统计: 1849帧, 成功率: 97.89%, 重启: 5次 +2025-12-12 15:52:42,549 [INFO] [task_stream_manager_windows:348] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已推流 100 帧 +2025-12-12 15:52:43,419 [INFO] [detectionThread:1271] 帧处理耗时: 26.92ms | 平均FPS: 37.15 +2025-12-12 15:52:43,419 [INFO] [detectionThread:1281] 推流统计: 1899帧, 成功率: 97.95%, 重启: 5次 +2025-12-12 15:52:43,439 [INFO] [detectionThread:615] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已成功推流 1900 帧,成功率: 97.95% +2025-12-12 15:52:44,756 [INFO] [detectionThread:1271] 帧处理耗时: 26.74ms | 平均FPS: 37.40 +2025-12-12 15:52:44,756 [INFO] [detectionThread:1281] 推流统计: 1949帧, 成功率: 98.00%, 重启: 5次 +2025-12-12 15:52:45,213 [INFO] [task_stream_manager_windows:348] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已推流 200 帧 +2025-12-12 15:52:45,480 [WARNING] [ffmpegStreamer:302] FFmpeg错误: [c00254e3999e80]trtinonnection270.1 port [c4e39e8onttemrt5 failErrrred [tcp @ 00000254e3999e80] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:52:45,485 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:52:45,485 [WARNING] [ffmpegStreamer:441] 管道破裂状态 +2025-12-12 15:52:45,489 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:52:45,493 [WARNING] [ffmpegStreamer:178] 连续写入失败 10 次 +2025-12-12 15:52:45,493 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:52:45,493 [WARNING] [ffmpegStreamer:182] 连续失败 10 次,尝试恢复 +2025-12-12 15:52:45,494 [INFO] [ffmpegStreamer:458] 尝试恢复推流进程... +2025-12-12 15:52:45,494 [INFO] [ffmpegStreamer:489] 问题较严重,尝试重启FFmpeg +2025-12-12 15:52:45,494 [INFO] [ffmpegStreamer:540] 准备重启FFmpeg (1/10), 2.0秒后执行... +2025-12-12 15:52:45,501 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:45,501 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (1/5) +2025-12-12 15:52:45,530 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:45,530 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (2/5) +2025-12-12 15:52:45,550 [WARNING] [task_stream_manager_windows:351] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 +2025-12-12 15:52:45,550 [WARNING] [detectionThread:621] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流失败 (3/5) +2025-12-12 15:52:45,550 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:52:45,550 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:52:45,550 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:52:45,550 [INFO] [detectionThread:650] 最近输出: tp @ 0000025990] Cnection apt to ::1 po 193ed: ro number -138 occu +2025-12-12 15:52:45,550 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:52:45,550 [INFO] [detectionThread:657] Ip0 avdo rm'd' Duration: N/A, start: 0.000000, bitrate: 780874 kb/s +2025-12-12 15:52:45,551 [INFO] [detectionThread:657] tp @ 000 Sag c attempt to 1.0.1935 +2025-12-12 15:52:45,551 [INFO] [detectionThread:657] tp @ 0000025990] Cnection apt to ::1 po 193ed: ro number -138 occu +2025-12-12 15:52:45,580 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [tcp @ 00000254e3999e80] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:52:45,683 [ERROR] [task_stream_manager_windows:271] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3] 关键错误: [rtmp @ 00000254e3995540] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:52:45,683 [INFO] [task_stream_manager_windows:289] 安全重启推流器: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:52:45,683 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:52:45,683 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 21588... +2025-12-12 15:52:45,683 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 21588 已停止 +2025-12-12 15:52:45,995 [INFO] [ffmpegStreamer:546] 收到停止信号,取消重启 +2025-12-12 15:52:45,995 [ERROR] [ffmpegStreamer:184] 恢复失败,停止推流 +2025-12-12 15:52:45,995 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 7.1秒 + 总帧数: 80 + 成功发送: 1 + 丢弃帧数: 79 + 丢帧率: 98.8% + 平均FPS: 0.1 + 重启次数: 1 +2025-12-12 15:52:45,995 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:52:45,995 [INFO] [ffmpegStreamer:1020] 推流线程已完全停止 +2025-12-12 15:52:45,995 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:52:46,996 [WARNING] [task_stream_manager_windows:71] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已有推流器,先清理 +2025-12-12 15:52:46,996 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:52:46,996 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:52:46,997 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 35.30429833185527 +2025-12-12 15:52:46,997 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:52:46,997 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 35.30429833185527 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:52:47,011 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 21900 +2025-12-12 15:52:47,997 [INFO] [task_stream_manager_windows:110] Windows任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器创建成功 +2025-12-12 15:52:47,997 [INFO] [task_stream_manager_windows:310] 推流器重启成功: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:52:47,998 [ERROR] [task_stream_manager_windows:226] FFmpeg[2ff62e98-c2a9-4b02-8b37-5808ed5609d3]: [rtmp @ 00000254e3995540] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:52:48,012 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:52:48,012 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:52:48,437 [INFO] [detectionThread:1271] 帧处理耗时: 73.60ms | 平均FPS: 13.59 +2025-12-12 15:52:48,437 [INFO] [detectionThread:1281] 推流统计: 1999帧, 成功率: 97.90%, 重启: 5次 +2025-12-12 15:52:48,455 [INFO] [detectionThread:615] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 已成功推流 2000 帧,成功率: 97.90% +2025-12-12 15:52:49,767 [INFO] [detectionThread:1271] 帧处理耗时: 26.59ms | 平均FPS: 37.60 +2025-12-12 15:52:49,767 [INFO] [detectionThread:1281] 推流统计: 2049帧, 成功率: 97.95%, 重启: 5次 +2025-12-12 15:52:50,454 [INFO] [task_manager:412] 开始清理任务: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3, 状态: running +2025-12-12 15:52:50,454 [INFO] [task_manager:275] 正在停止任务: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3, 当前状态: running +2025-12-12 15:52:50,454 [INFO] [detectionThread:1307] 收到停止请求,任务ID: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:52:50,457 [INFO] [detectionThread:1294] 检测线程主循环结束 +2025-12-12 15:52:50,457 [INFO] [detectionThread:1348] 开始清理资源,任务ID: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:52:50,478 [INFO] [detectionThread:1324] 已强制释放视频流 +2025-12-12 15:52:50,482 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:52:50,483 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:52:50,485 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:52:50,492 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:52:50,492 [INFO] [ffmpegStreamer:228] 监控线程已停止 +2025-12-12 15:52:50,492 [INFO] [ffmpegStreamer:228] 监控线程已停止 +2025-12-12 15:52:50,492 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 21900... +2025-12-12 15:52:50,493 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 21900 已停止 +2025-12-12 15:52:50,493 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 3.5秒 + 总帧数: 34 + 成功发送: 1 + 丢弃帧数: 33 + 丢帧率: 97.1% + 平均FPS: 0.3 + 重启次数: 0 +2025-12-12 15:52:50,493 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:52:50,794 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:52:50,794 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:52:50,794 [INFO] [detectionThread:703] 任务 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 推流器已清理 +2025-12-12 15:52:51,018 [INFO] [detectionThread:980] MQTT客户端已停止 +2025-12-12 15:52:51,018 [INFO] [detectionThread:980] MQTT客户端已停止 +2025-12-12 15:52:51,018 [INFO] [detectionThread:1344] 停止信号已发送,任务ID: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:52:51,018 [INFO] [detectionThread:922] 上传工作线程已停止 +2025-12-12 15:52:51,018 [INFO] [task_manager:288] 已调用线程停止方法: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:52:51,018 [INFO] [detectionThread:1392] 释放视频流... +2025-12-12 15:52:51,038 [INFO] [detectionThread:1401] 释放所有模型,共 2 个 +2025-12-12 15:52:51,038 [INFO] [detectionThread:1421] 模型 d568ab8378383793 已释放 +2025-12-12 15:52:51,038 [ERROR] [detectionThread:1423] 释放模型 1 异常: 'model' +2025-12-12 15:52:51,038 [INFO] [detectionThread:1428] 清理GPU缓存... +2025-12-12 15:52:51,120 [INFO] [detectionThread:1433] GPU缓存已清理 +2025-12-12 15:52:51,120 [INFO] [detectionThread:1438] 清理其他资源... +2025-12-12 15:52:51,120 [INFO] [detectionThread:1452] 其他资源已清理 +2025-12-12 15:52:51,120 [INFO] [detectionThread:1456] 资源清理完成 +2025-12-12 15:52:51,120 [INFO] [detectionThread:1301] 检测线程已安全停止 +2025-12-12 15:53:01,030 [WARNING] [task_manager:296] 强制停止任务线程超时: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:53:01,030 [INFO] [detectionThread:1348] 开始清理资源,任务ID: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:53:01,030 [INFO] [detectionThread:1401] 释放所有模型,共 0 个 +2025-12-12 15:53:01,030 [INFO] [detectionThread:1428] 清理GPU缓存... +2025-12-12 15:53:01,106 [INFO] [detectionThread:1433] GPU缓存已清理 +2025-12-12 15:53:01,107 [INFO] [detectionThread:1438] 清理其他资源... +2025-12-12 15:53:01,107 [INFO] [detectionThread:1452] 其他资源已清理 +2025-12-12 15:53:01,107 [INFO] [detectionThread:1456] 资源清理完成 +2025-12-12 15:53:01,107 [INFO] [task_manager:321] 任务停止成功: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:53:01,107 [INFO] [task_manager:487] 更新任务状态: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 stopped -> stopped +2025-12-12 15:53:02,196 [INFO] [task_manager:470] 任务清理完成: 2ff62e98-c2a9-4b02-8b37-5808ed5609d3 +2025-12-12 15:54:08,775 [INFO] [model_upload_manager:88] 创建上传会话: f02039fc5c43b3594daa66143f0888f0, 文件: car.pt, 总分片: 10 +2025-12-12 15:54:10,683 [INFO] [model_upload_manager:158] 开始合并分片: f02039fc5c43b3594daa66143f0888f0, 文件: car.pt +2025-12-12 15:54:10,722 [INFO] [model_upload_manager:172] 分片合并完成: f02039fc5c43b3594daa66143f0888f0, 开始加密 +2025-12-12 15:54:11,996 [INFO] [model_upload_manager:193] 文件加密完成: f02039fc5c43b3594daa66143f0888f0, 加密文件: encrypted_models\c9cd25d454e06595.enc +2025-12-12 15:55:33,307 [INFO] [server:70] 收到创建任务请求: 多模型道路监控 +2025-12-12 15:55:33,307 [INFO] [server:84] 开始创建任务前的模型验证... +2025-12-12 15:55:33,369 [INFO] [mandatory_model_crypto:124] 模型解密验证成功: encrypted_models\d568ab8378383793.enc +2025-12-12 15:55:33,683 [INFO] [mandatory_model_crypto:124] 模型解密验证成功: encrypted_models\c9cd25d454e06595.enc +2025-12-12 15:55:33,687 [INFO] [server:120] 模型验证通过: 2/2 个模型有效 +2025-12-12 15:55:33,687 [INFO] [server:172] 添加已验证的加密模型 0: encrypted_models/d568ab8378383793.enc +2025-12-12 15:55:33,687 [INFO] [server:172] 添加已验证的加密模型 1: encrypted_models/c9cd25d454e06595.enc +2025-12-12 15:55:33,687 [INFO] [server:175] 创建任务前清理已停止的任务... +2025-12-12 15:55:33,687 [INFO] [task_manager:527] 开始清理已停止的任务... +2025-12-12 15:55:33,687 [INFO] [task_manager:544] 清理已停止任务完成: 清理了 0 个 +2025-12-12 15:55:33,688 [INFO] [server:208] 开始创建任务,包含 2 个已验证的加密模型... +2025-12-12 15:55:33,688 [INFO] [task_manager:77] 当前活动任务: 0/5 +2025-12-12 15:55:33,688 [INFO] [task_manager:188] 创建加密任务成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7, 加密模型数: 2, 密钥已验证 +2025-12-12 15:55:33,688 [INFO] [server:212] 任务创建成功,ID: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:55:33,688 [INFO] [server:221] 启动任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7... +2025-12-12 15:55:33,778 [INFO] [windows_utils:497] 检测到Windows系统,进行系统检测和配置... +2025-12-12 15:55:33,778 [INFO] [windows_utils:515] Windows系统: Windows 10/11 (Build 22621) +2025-12-12 15:55:33,896 [INFO] [windows_utils:530] FFmpeg版本: ffmpeg version N-117451-g0f5592cfc7-20241010 Copyright (c) 2000-2024 the FFmpeg developers +2025-12-12 15:55:33,896 [INFO] [windows_utils:531] FFmpeg路径: D:\ffmpeg-master-latest-win64-gpl\bin\ffmpeg.exe +2025-12-12 15:55:33,896 [INFO] [windows_utils:534] 运行FFmpeg功能测试... +2025-12-12 15:55:34,025 [INFO] [windows_utils:545] FFmpeg功能测试成功! +2025-12-12 15:55:34,026 [INFO] [windows_utils:551] 检测到 1 个GPU: +2025-12-12 15:55:34,026 [INFO] [windows_utils:553] GPU0: NVIDIA GeForce RTX 3060 +2025-12-12 15:55:34,076 [INFO] [windows_utils:565] 系统优化建议: +2025-12-12 15:55:34,076 [INFO] [windows_utils:572] power_scheme: 电源方案 GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (高性能) +2025-12-12 15:55:34,076 [INFO] [windows_utils:572] power_recommendation: For best streaming performance, use High Performance power plan. Run: powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c +2025-12-12 15:55:34,076 [INFO] [windows_utils:572] firewall: Consider adding firewall rules for RTMP ports (1935, 1936) +2025-12-12 15:55:34,076 [INFO] [windows_utils:568] network_optimizations: +2025-12-12 15:55:34,076 [INFO] [windows_utils:570] - Increase TCP buffer size: netsh int tcp set global autotuninglevel=normal +2025-12-12 15:55:34,076 [INFO] [windows_utils:570] - Disable TCP auto-tuning (if unstable): netsh int tcp set global autotuninglevel=disabled +2025-12-12 15:55:34,076 [INFO] [windows_utils:570] - Enable TCP fast open: netsh int tcp set global fastopen=enabled +2025-12-12 15:55:34,076 [INFO] [windows_utils:570] - Set TCP keepalive: netsh int tcp set global keepalivetime=30000 +2025-12-12 15:55:34,077 [INFO] [windows_utils:568] gpu_recommendations: +2025-12-12 15:55:34,077 [INFO] [windows_utils:570] - Update graphics drivers to latest version +2025-12-12 15:55:34,077 [INFO] [windows_utils:570] - In NVIDIA Control Panel: Set Power Management Mode to "Prefer Maximum Performance" +2025-12-12 15:55:34,077 [INFO] [windows_utils:570] - In Windows Graphics Settings: Add ffmpeg.exe and set to "High Performance" +2025-12-12 15:55:34,205 [INFO] [windows_utils:578] 系统资源: CPU 9.1%, 内存 28.2% +2025-12-12 15:55:34,206 [INFO] [windows_utils:623] Windows系统检测完成,状态正常 +2025-12-12 15:55:34,206 [INFO] [detectionThread:295] Windows系统检测完成: ready +2025-12-12 15:55:34,206 [INFO] [detectionThread:313] 检测线程初始化完成: 多模型道路监控 +2025-12-12 15:55:34,206 [INFO] [detectionThread:1136] 启动检测线程,任务ID: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:55:34,207 [INFO] [detectionThread:328] 开始从本地加载 2 个模型 +2025-12-12 15:55:34,207 [INFO] [detectionThread:343] 加载模型 0: d568ab8378383793 +2025-12-12 15:55:34,272 [INFO] [mandatory_model_crypto:124] 模型解密验证成功: encrypted_models\d568ab8378383793.enc +2025-12-12 15:55:34,299 [INFO] [detectionThread:123] 加密模型解密加载成功: encrypted_models/d568ab8378383793.enc +2025-12-12 15:55:34,318 [INFO] [detectionThread:155] 启用半精度推理: encrypted_models/d568ab8378383793.enc +2025-12-12 15:55:34,318 [INFO] [detectionThread:166] 模型加载成功: encrypted_models/d568ab8378383793.enc -> cuda:0 +2025-12-12 15:55:34,318 [INFO] [detectionThread:383] 模型加载成功: d568ab8378383793, 颜色: [0, 255, 0], 设备: cuda:0, 密钥验证: True +2025-12-12 15:55:34,318 [INFO] [detectionThread:343] 加载模型 1: c9cd25d454e06595 +2025-12-12 15:55:34,666 [INFO] [mandatory_model_crypto:124] 模型解密验证成功: encrypted_models\c9cd25d454e06595.enc +2025-12-12 15:55:34,788 [INFO] [detectionThread:123] 加密模型解密加载成功: encrypted_models/c9cd25d454e06595.enc +2025-12-12 15:55:34,832 [INFO] [detectionThread:155] 启用半精度推理: encrypted_models/c9cd25d454e06595.enc +2025-12-12 15:55:34,832 [INFO] [detectionThread:166] 模型加载成功: encrypted_models/c9cd25d454e06595.enc -> cuda:0 +2025-12-12 15:55:34,834 [INFO] [detectionThread:383] 模型加载成功: c9cd25d454e06595, 颜色: [0, 255, 0], 设备: cuda:0, 密钥验证: True +2025-12-12 15:55:34,834 [INFO] [detectionThread:406] 成功加载 2/2 个模型 +2025-12-12 15:55:34,834 [INFO] [detectionThread:411] 密钥验证统计: 2个有效, 0个无效 +2025-12-12 15:55:34,834 [INFO] [detectionThread:1147] 加密密钥验证结果: 2/2 个模型加载成功 +2025-12-12 15:55:34,834 [INFO] [detectionThread:447] 连接RTMP: rtmp://175.27.168.120:6019/live/8UUXN5400A079H +2025-12-12 15:55:34,834 [INFO] [detectionThread:459] 启用硬件加速解码 +2025-12-12 15:55:35,207 [INFO] [task_manager:247] 任务启动成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:55:35,207 [INFO] [server:225] 任务启动成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:55:40,456 [INFO] [detectionThread:479] 视频属性: 1280x720 @ 30.303030303030305fps +2025-12-12 15:55:40,456 [INFO] [detectionThread:493] 初始化任务推流器: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:55:42,495 [ERROR] [detectionThread:503] RTMP服务器不可达: Connection refused (服务器拒绝连接) +2025-12-12 15:55:42,495 [WARNING] [detectionThread:504] 推流可能失败,请检查网络和服务器状态 +2025-12-12 15:55:42,495 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:55:42,496 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 30.303030303030305 +2025-12-12 15:55:42,496 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:55:42,496 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 30.303030303030305 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:55:42,509 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 22144 +2025-12-12 15:55:43,496 [INFO] [task_stream_manager_windows:110] Windows任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器创建成功 +2025-12-12 15:55:43,496 [INFO] [detectionThread:516] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器初始化成功 +2025-12-12 15:55:43,497 [INFO] [task_stream_manager_windows:436] Windows推流健康监控启动 +2025-12-12 15:55:43,497 [INFO] [detectionThread:1165] 推流健康监控已启动 +2025-12-12 15:55:43,497 [INFO] [detectionThread:950] 启动MQTT客户端... +2025-12-12 15:55:43,510 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:55:43,510 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:55:43,544 [INFO] [detectionThread:968] MQTT客户端已启动 +2025-12-12 15:55:43,545 [INFO] [detectionThread:859] 上传工作线程启动 +2025-12-12 15:55:43,545 [INFO] [detectionThread:1177] 图片上传线程已启动 +2025-12-12 15:55:43,545 [INFO] [detectionThread:710] 预热所有模型... +2025-12-12 15:55:43,689 [INFO] [detectionThread:730] 模型 d568ab8378383793 预热完成 +2025-12-12 15:55:44,107 [INFO] [detectionThread:730] 模型 c9cd25d454e06595 预热完成 +2025-12-12 15:55:44,107 [INFO] [detectionThread:734] 所有模型预热完成 +2025-12-12 15:55:44,107 [INFO] [task_manager:487] 更新任务状态: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 running -> running +2025-12-12 15:55:44,108 [INFO] [detectionThread:1185] 资源初始化完成 +2025-12-12 15:55:45,617 [INFO] [detectionThread:1271] 帧处理耗时: 30.19ms | 平均FPS: 33.13 +2025-12-12 15:55:45,617 [INFO] [detectionThread:1281] 推流统计: 50帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:55:47,059 [INFO] [task_stream_manager_windows:348] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已推流 100 帧 +2025-12-12 15:55:47,059 [INFO] [detectionThread:615] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已成功推流 100 帧,成功率: 100.00% +2025-12-12 15:55:47,059 [INFO] [detectionThread:1271] 帧处理耗时: 28.84ms | 平均FPS: 34.67 +2025-12-12 15:55:47,059 [INFO] [detectionThread:1281] 推流统计: 100帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:55:48,485 [INFO] [detectionThread:1271] 帧处理耗时: 28.51ms | 平均FPS: 35.08 +2025-12-12 15:55:48,485 [INFO] [detectionThread:1281] 推流统计: 150帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:55:49,788 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: tp @ 00000adc9e00] rctiona[cp @ 0000021adc9e00] Connection attempt to ::1 port 1935 failed: Error number -138 occurred +2025-12-12 15:55:49,788 [WARNING] [ffmpegStreamer:302] FFmpeg错误: tf0[tcp @ 0000021f0adc9e00] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:55:49,792 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:55:49,793 [WARNING] [ffmpegStreamer:441] 管道破裂状态 +2025-12-12 15:55:49,796 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:55:49,800 [WARNING] [ffmpegStreamer:178] 连续写入失败 10 次 +2025-12-12 15:55:49,800 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:55:49,800 [WARNING] [ffmpegStreamer:182] 连续失败 10 次,尝试恢复 +2025-12-12 15:55:49,801 [INFO] [ffmpegStreamer:458] 尝试恢复推流进程... +2025-12-12 15:55:49,801 [INFO] [ffmpegStreamer:489] 问题较严重,尝试重启FFmpeg +2025-12-12 15:55:49,801 [INFO] [ffmpegStreamer:540] 准备重启FFmpeg (1/10), 2.0秒后执行... +2025-12-12 15:55:49,814 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:55:49,814 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (1/5) +2025-12-12 15:55:49,837 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:55:49,837 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (2/5) +2025-12-12 15:55:49,860 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:55:49,860 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (3/5) +2025-12-12 15:55:49,861 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:55:49,861 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:55:49,861 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:55:49,861 [INFO] [detectionThread:650] 最近输出: tp @ 00000adc9e00] rctiona[cp @ 0000021adc9e00] Connection attempt to ::1 port 1935 failed: Error number -138 occurred +2025-12-12 15:55:49,861 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:55:49,861 [INFO] [detectionThread:657] It ideo, fd:': Duration: N/A, start: 0.000000, bitrate: 670254 kb/s +2025-12-12 15:55:49,861 [INFO] [detectionThread:657] tp @ 00000adc9e00] rctiona[cp @ 0000021adc9e00] Connection attempt to ::1 port 1935 failed: Error number -138 occurred +2025-12-12 15:55:49,890 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: [tcp @ 0000021f0adc9e00] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:55:49,990 [ERROR] [task_stream_manager_windows:271] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7] 关键错误: [rtmp @ 0000021f0add4b80] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:55:49,990 [INFO] [task_stream_manager_windows:289] 安全重启推流器: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:55:49,990 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:55:49,990 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 22144... +2025-12-12 15:55:49,990 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 22144 已停止 +2025-12-12 15:55:50,302 [INFO] [ffmpegStreamer:546] 收到停止信号,取消重启 +2025-12-12 15:55:50,302 [ERROR] [ffmpegStreamer:184] 恢复失败,停止推流 +2025-12-12 15:55:50,302 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 7.8秒 + 总帧数: 75 + 成功发送: 1 + 丢弃帧数: 74 + 丢帧率: 98.7% + 平均FPS: 0.1 + 重启次数: 1 +2025-12-12 15:55:50,302 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:55:50,302 [INFO] [ffmpegStreamer:1020] 推流线程已完全停止 +2025-12-12 15:55:50,302 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:55:51,303 [WARNING] [task_stream_manager_windows:71] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已有推流器,先清理 +2025-12-12 15:55:51,303 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:55:51,303 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:55:51,303 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 30.303030303030305 +2025-12-12 15:55:51,303 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:55:51,303 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 30.303030303030305 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:55:51,317 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 13592 +2025-12-12 15:55:52,304 [INFO] [task_stream_manager_windows:110] Windows任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器创建成功 +2025-12-12 15:55:52,304 [INFO] [task_stream_manager_windows:310] 推流器重启成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:55:52,304 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: [rtmp @ 0000021f0add4b80] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:55:52,318 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:55:52,318 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:55:52,327 [INFO] [detectionThread:615] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已成功推流 200 帧,成功率: 98.50% +2025-12-12 15:55:52,329 [INFO] [detectionThread:1271] 帧处理耗时: 76.87ms | 平均FPS: 13.01 +2025-12-12 15:55:52,329 [INFO] [detectionThread:1281] 推流统计: 200帧, 成功率: 98.50%, 重启: 0次 +2025-12-12 15:55:53,734 [INFO] [detectionThread:1271] 帧处理耗时: 28.10ms | 平均FPS: 35.59 +2025-12-12 15:55:53,734 [INFO] [detectionThread:1281] 推流统计: 250帧, 成功率: 98.80%, 重启: 0次 +2025-12-12 15:55:55,181 [INFO] [task_stream_manager_windows:348] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已推流 100 帧 +2025-12-12 15:55:55,227 [INFO] [detectionThread:615] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已成功推流 300 帧,成功率: 99.00% +2025-12-12 15:55:55,227 [INFO] [detectionThread:1271] 帧处理耗时: 29.87ms | 平均FPS: 33.48 +2025-12-12 15:55:55,227 [INFO] [detectionThread:1281] 推流统计: 300帧, 成功率: 99.00%, 重启: 0次 +2025-12-12 15:55:56,722 [INFO] [detectionThread:1271] 帧处理耗时: 29.88ms | 平均FPS: 33.46 +2025-12-12 15:55:56,722 [INFO] [detectionThread:1281] 推流统计: 350帧, 成功率: 99.14%, 重启: 0次 +2025-12-12 15:55:57,870 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: tp @ 00009099 St connon attto 121 p935 [tp 0000020009099740] Connection attempt to 193d: Error number -138 occurred +2025-12-12 15:55:57,870 [WARNING] [ffmpegStreamer:302] FFmpeg错误: c@ ::1 port5 faile[tcp @ 0000020009099740] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:55:57,874 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:55:57,874 [WARNING] [ffmpegStreamer:441] 管道破裂状态 +2025-12-12 15:55:57,878 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:55:57,882 [WARNING] [ffmpegStreamer:178] 连续写入失败 10 次 +2025-12-12 15:55:57,882 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:55:57,882 [WARNING] [ffmpegStreamer:182] 连续失败 10 次,尝试恢复 +2025-12-12 15:55:57,882 [INFO] [ffmpegStreamer:458] 尝试恢复推流进程... +2025-12-12 15:55:57,882 [INFO] [ffmpegStreamer:489] 问题较严重,尝试重启FFmpeg +2025-12-12 15:55:57,882 [INFO] [ffmpegStreamer:540] 准备重启FFmpeg (1/10), 2.0秒后执行... +2025-12-12 15:55:57,894 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:55:57,894 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (1/5) +2025-12-12 15:55:57,917 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:55:57,917 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (2/5) +2025-12-12 15:55:57,939 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:55:57,939 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (3/5) +2025-12-12 15:55:57,939 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:55:57,939 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:55:57,939 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:55:57,939 [INFO] [detectionThread:650] 最近输出: tp @ 00009099 St connon attto 121 p935 [tp 0000020009099740] Connection attempt to 193d: Error number -138 occurred +2025-12-12 15:55:57,939 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:55:57,940 [INFO] [detectionThread:657] Input #0, rawvideo, from 'fd:': +2025-12-12 15:55:57,940 [INFO] [detectionThread:657] tp @ 00009099 St connon attto 121 p935 [tp 0000020009099740] Connection attempt to 193d: Error number -138 occurred +2025-12-12 15:55:57,971 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: [tcp @ 0000020009099740] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:55:58,072 [ERROR] [task_stream_manager_windows:271] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7] 关键错误: [rtmp @ 0000020009094dc0] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:55:58,072 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: [rtmp @ 0000020009094dc0] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:55:58,084 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:55:58,084 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (4/5) +2025-12-12 15:55:58,084 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:55:58,084 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:55:58,084 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:55:58,084 [INFO] [detectionThread:650] 最近输出: [rtmp @ 0000020009094dc0] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:55:58,085 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:55:58,085 [INFO] [detectionThread:657] Input #0, rawvideo, from 'fd:': +2025-12-12 15:55:58,085 [INFO] [detectionThread:657] tp @ 00009099 St connon attto 121 p935 [tp 0000020009099740] Connection attempt to 193d: Error number -138 occurred +2025-12-12 15:55:58,085 [INFO] [detectionThread:657] [tcp @ 0000020009099740] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:55:58,085 [INFO] [detectionThread:657] [rtmp @ 0000020009094dc0] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:55:58,173 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: [out#0/flv @ 0000020009052580] Error opening output rtmp://localhost:1935/live/15: Error number -138 occurred +2025-12-12 15:55:58,237 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:55:58,237 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (5/5) +2025-12-12 15:55:58,237 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:55:58,237 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:55:58,237 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:55:58,237 [INFO] [detectionThread:650] 最近输出: [out#0/flv @ 0000020009052580] Error opening output rtmp://localhost:1935/live/15: Error number -138 occurred +2025-12-12 15:55:58,237 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:55:58,237 [INFO] [detectionThread:657] Input #0, rawvideo, from 'fd:': +2025-12-12 15:55:58,237 [INFO] [detectionThread:657] tp @ 00009099 St connon attto 121 p935 [tp 0000020009099740] Connection attempt to 193d: Error number -138 occurred +2025-12-12 15:55:58,237 [INFO] [detectionThread:657] [tcp @ 0000020009099740] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:55:58,237 [INFO] [detectionThread:657] [rtmp @ 0000020009094dc0] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:55:58,237 [INFO] [detectionThread:657] [out#0/flv @ 0000020009052580] Error opening output rtmp://localhost:1935/live/15: Error number -138 occurred +2025-12-12 15:55:58,273 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: Error opening output file rtmp://localhost:1935/live/15. +2025-12-12 15:55:58,306 [WARNING] [task_stream_manager_windows:458] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 FFmpeg进程已退出 +2025-12-12 15:55:58,354 [ERROR] [detectionThread:629] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流连续失败,尝试恢复 +2025-12-12 15:55:58,355 [INFO] [detectionThread:674] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 尝试恢复推流器 +2025-12-12 15:55:58,355 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:55:58,355 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 13592... +2025-12-12 15:55:58,355 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 13592 已停止 +2025-12-12 15:55:58,383 [INFO] [ffmpegStreamer:546] 收到停止信号,取消重启 +2025-12-12 15:55:58,383 [ERROR] [ffmpegStreamer:184] 恢复失败,停止推流 +2025-12-12 15:55:58,383 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 7.1秒 + 总帧数: 76 + 成功发送: 1 + 丢弃帧数: 75 + 丢帧率: 98.7% + 平均FPS: 0.1 + 重启次数: 1 +2025-12-12 15:55:58,383 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:55:58,657 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:55:58,657 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:55:58,657 [INFO] [detectionThread:703] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器已清理 +2025-12-12 15:56:00,657 [INFO] [detectionThread:493] 初始化任务推流器: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:56:02,693 [ERROR] [detectionThread:503] RTMP服务器不可达: Connection refused (服务器拒绝连接) +2025-12-12 15:56:02,693 [WARNING] [detectionThread:504] 推流可能失败,请检查网络和服务器状态 +2025-12-12 15:56:02,693 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:56:02,694 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 31.95041320442516 +2025-12-12 15:56:02,694 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:56:02,694 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 31.95041320442516 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:56:02,709 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 23244 +2025-12-12 15:56:03,695 [INFO] [task_stream_manager_windows:110] Windows任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器创建成功 +2025-12-12 15:56:03,696 [INFO] [detectionThread:516] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器初始化成功 +2025-12-12 15:56:03,696 [INFO] [detectionThread:686] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器恢复成功 (第1次重启) +2025-12-12 15:56:03,711 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:56:03,711 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:56:03,865 [INFO] [detectionThread:615] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已成功推流 400 帧,成功率: 98.00% +2025-12-12 15:56:03,866 [INFO] [detectionThread:1271] 帧处理耗时: 142.87ms | 平均FPS: 7.00 +2025-12-12 15:56:03,866 [INFO] [detectionThread:1281] 推流统计: 400帧, 成功率: 98.00%, 重启: 1次 +2025-12-12 15:56:05,255 [INFO] [detectionThread:1271] 帧处理耗时: 27.79ms | 平均FPS: 35.98 +2025-12-12 15:56:05,255 [INFO] [detectionThread:1281] 推流统计: 450帧, 成功率: 98.22%, 重启: 1次 +2025-12-12 15:56:06,762 [INFO] [task_stream_manager_windows:348] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已推流 100 帧 +2025-12-12 15:56:06,954 [INFO] [detectionThread:615] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已成功推流 500 帧,成功率: 98.40% +2025-12-12 15:56:06,954 [INFO] [detectionThread:1271] 帧处理耗时: 33.96ms | 平均FPS: 29.44 +2025-12-12 15:56:06,954 [INFO] [detectionThread:1281] 推流统计: 500帧, 成功率: 98.40%, 重启: 1次 +2025-12-12 15:56:08,691 [INFO] [detectionThread:1271] 帧处理耗时: 34.74ms | 平均FPS: 28.79 +2025-12-12 15:56:08,691 [INFO] [detectionThread:1281] 推流统计: 550帧, 成功率: 98.55%, 重启: 1次 +2025-12-12 15:56:09,295 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: tcp @ 000002b380][cp @ 000e80]n attempt to ::1 port faed: Error-138 occurred +2025-12-12 15:56:09,295 [WARNING] [ffmpegStreamer:302] FFmpeg错误: t002b33fe97 Connectio1935 il number [tcp @ 000002b33fe97e80] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:09,300 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:56:09,300 [WARNING] [ffmpegStreamer:441] 管道破裂状态 +2025-12-12 15:56:09,305 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:56:09,307 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:56:09,309 [WARNING] [ffmpegStreamer:178] 连续写入失败 10 次 +2025-12-12 15:56:09,310 [WARNING] [ffmpegStreamer:182] 连续失败 10 次,尝试恢复 +2025-12-12 15:56:09,310 [INFO] [ffmpegStreamer:458] 尝试恢复推流进程... +2025-12-12 15:56:09,310 [INFO] [ffmpegStreamer:489] 问题较严重,尝试重启FFmpeg +2025-12-12 15:56:09,310 [INFO] [ffmpegStreamer:540] 准备重启FFmpeg (1/10), 2.0秒后执行... +2025-12-12 15:56:09,311 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:09,311 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (1/5) +2025-12-12 15:56:09,335 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:09,335 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (2/5) +2025-12-12 15:56:09,359 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:09,359 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (3/5) +2025-12-12 15:56:09,359 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:56:09,359 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:56:09,359 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:56:09,359 [INFO] [detectionThread:650] 最近输出: tcp @ 000002b380][cp @ 000e80]n attempt to ::1 port faed: Error-138 occurred +2025-12-12 15:56:09,359 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:56:09,359 [INFO] [detectionThread:657] Ipudeo, from 'fd:': +2025-12-12 15:56:09,359 [INFO] [detectionThread:657] tcp @ 000002b380][cp @ 000e80]n attempt to ::1 port faed: Error-138 occurred +2025-12-12 15:56:09,396 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: [tcp @ 000002b33fe97e80] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:56:09,497 [ERROR] [task_stream_manager_windows:271] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7] 关键错误: [rtmp @ 000002b33fe51480] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:56:09,497 [INFO] [task_stream_manager_windows:289] 安全重启推流器: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:56:09,497 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:56:09,497 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 23244... +2025-12-12 15:56:09,497 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 23244 已停止 +2025-12-12 15:56:09,811 [INFO] [ffmpegStreamer:546] 收到停止信号,取消重启 +2025-12-12 15:56:09,811 [ERROR] [ffmpegStreamer:184] 恢复失败,停止推流 +2025-12-12 15:56:09,811 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 7.1秒 + 总帧数: 68 + 成功发送: 1 + 丢弃帧数: 67 + 丢帧率: 98.5% + 平均FPS: 0.1 + 重启次数: 1 +2025-12-12 15:56:09,811 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:56:09,811 [INFO] [ffmpegStreamer:1020] 推流线程已完全停止 +2025-12-12 15:56:09,811 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:56:10,812 [WARNING] [task_stream_manager_windows:71] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已有推流器,先清理 +2025-12-12 15:56:10,812 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:56:10,812 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:56:10,813 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 31.95041320442516 +2025-12-12 15:56:10,813 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:56:10,813 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 31.95041320442516 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:56:10,828 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 22572 +2025-12-12 15:56:11,813 [INFO] [task_stream_manager_windows:110] Windows任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器创建成功 +2025-12-12 15:56:11,813 [INFO] [task_stream_manager_windows:310] 推流器重启成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:56:11,814 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: [rtmp @ 000002b33fe51480] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:56:11,828 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:56:11,828 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:56:12,581 [INFO] [detectionThread:615] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已成功推流 600 帧,成功率: 98.17% +2025-12-12 15:56:12,581 [INFO] [detectionThread:1271] 帧处理耗时: 77.80ms | 平均FPS: 12.85 +2025-12-12 15:56:12,581 [INFO] [detectionThread:1281] 推流统计: 600帧, 成功率: 98.17%, 重启: 1次 +2025-12-12 15:56:14,064 [INFO] [detectionThread:1271] 帧处理耗时: 29.66ms | 平均FPS: 33.72 +2025-12-12 15:56:14,064 [INFO] [detectionThread:1281] 推流统计: 650帧, 成功率: 98.31%, 重启: 1次 +2025-12-12 15:56:14,683 [INFO] [task_stream_manager_windows:348] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已推流 100 帧 +2025-12-12 15:56:15,555 [INFO] [detectionThread:615] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已成功推流 700 帧,成功率: 98.43% +2025-12-12 15:56:15,555 [INFO] [detectionThread:1271] 帧处理耗时: 29.82ms | 平均FPS: 33.53 +2025-12-12 15:56:15,556 [INFO] [detectionThread:1281] 推流统计: 700帧, 成功率: 98.43%, 重启: 1次 +2025-12-12 15:56:16,987 [INFO] [detectionThread:1271] 帧处理耗时: 28.61ms | 平均FPS: 34.95 +2025-12-12 15:56:16,987 [INFO] [detectionThread:1281] 推流统计: 750帧, 成功率: 98.53%, 重启: 1次 +2025-12-12 15:56:17,378 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: [ctempt :1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:17,378 [WARNING] [ffmpegStreamer:302] FFmpeg错误: tp @ 000001f17e89e280] Connection atto :[tcp @ 000001f17e89e280] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:17,382 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:56:17,383 [WARNING] [ffmpegStreamer:441] 管道破裂状态 +2025-12-12 15:56:17,386 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:56:17,390 [WARNING] [ffmpegStreamer:178] 连续写入失败 10 次 +2025-12-12 15:56:17,390 [WARNING] [ffmpegStreamer:182] 连续失败 10 次,尝试恢复 +2025-12-12 15:56:17,390 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:56:17,390 [INFO] [ffmpegStreamer:458] 尝试恢复推流进程... +2025-12-12 15:56:17,390 [INFO] [ffmpegStreamer:489] 问题较严重,尝试重启FFmpeg +2025-12-12 15:56:17,390 [ERROR] [ffmpegStreamer:517] 全局重启频率过高,等待60秒 +2025-12-12 15:56:17,390 [ERROR] [ffmpegStreamer:184] 恢复失败,停止推流 +2025-12-12 15:56:17,390 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 22572... +2025-12-12 15:56:17,390 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 22572 已停止 +2025-12-12 15:56:17,391 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 6.6秒 + 总帧数: 71 + 成功发送: 1 + 丢弃帧数: 70 + 丢帧率: 98.6% + 平均FPS: 0.2 + 重启次数: 0 +2025-12-12 15:56:17,391 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:56:17,406 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:17,406 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (1/5) +2025-12-12 15:56:17,430 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:17,430 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (2/5) +2025-12-12 15:56:17,453 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:17,453 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (3/5) +2025-12-12 15:56:17,453 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:56:17,453 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:56:17,453 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:56:17,453 [INFO] [detectionThread:650] 最近输出: [ctempt :1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:17,453 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:56:17,453 [INFO] [detectionThread:657] Input #0, rawvideo, from 'fd:': +2025-12-12 15:56:17,453 [INFO] [detectionThread:657] [ctempt :1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:17,595 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:17,595 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (4/5) +2025-12-12 15:56:17,595 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:56:17,595 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:56:17,595 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:56:17,595 [INFO] [detectionThread:650] 最近输出: [ctempt :1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:17,595 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:56:17,595 [INFO] [detectionThread:657] Input #0, rawvideo, from 'fd:': +2025-12-12 15:56:17,595 [INFO] [detectionThread:657] [ctempt :1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:17,734 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:17,734 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (5/5) +2025-12-12 15:56:17,734 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:56:17,734 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:56:17,734 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:56:17,734 [INFO] [detectionThread:650] 最近输出: [ctempt :1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:17,734 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:56:17,734 [INFO] [detectionThread:657] Input #0, rawvideo, from 'fd:': +2025-12-12 15:56:17,734 [INFO] [detectionThread:657] [ctempt :1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:17,856 [ERROR] [detectionThread:629] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流连续失败,尝试恢复 +2025-12-12 15:56:17,856 [INFO] [detectionThread:674] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 尝试恢复推流器 +2025-12-12 15:56:17,856 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:56:18,158 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:56:18,158 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:56:18,158 [INFO] [detectionThread:703] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器已清理 +2025-12-12 15:56:20,159 [INFO] [detectionThread:493] 初始化任务推流器: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:56:22,184 [ERROR] [detectionThread:503] RTMP服务器不可达: Connection refused (服务器拒绝连接) +2025-12-12 15:56:22,184 [WARNING] [detectionThread:504] 推流可能失败,请检查网络和服务器状态 +2025-12-12 15:56:22,184 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:56:22,185 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 31.93986968335634 +2025-12-12 15:56:22,185 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:56:22,185 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 31.93986968335634 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:56:22,198 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 19608 +2025-12-12 15:56:23,186 [INFO] [task_stream_manager_windows:110] Windows任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器创建成功 +2025-12-12 15:56:23,186 [INFO] [detectionThread:516] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器初始化成功 +2025-12-12 15:56:23,186 [INFO] [detectionThread:686] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器恢复成功 (第2次重启) +2025-12-12 15:56:23,199 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:56:23,199 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:56:24,077 [INFO] [detectionThread:615] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已成功推流 800 帧,成功率: 98.00% +2025-12-12 15:56:24,077 [INFO] [detectionThread:1271] 帧处理耗时: 141.80ms | 平均FPS: 7.05 +2025-12-12 15:56:24,077 [INFO] [detectionThread:1281] 推流统计: 800帧, 成功率: 98.00%, 重启: 2次 +2025-12-12 15:56:25,572 [INFO] [detectionThread:1271] 帧处理耗时: 29.90ms | 平均FPS: 33.44 +2025-12-12 15:56:25,572 [INFO] [detectionThread:1281] 推流统计: 850帧, 成功率: 98.12%, 重启: 2次 +2025-12-12 15:56:26,144 [INFO] [task_stream_manager_windows:348] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已推流 100 帧 +2025-12-12 15:56:27,097 [INFO] [detectionThread:615] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已成功推流 900 帧,成功率: 98.22% +2025-12-12 15:56:27,098 [INFO] [detectionThread:1271] 帧处理耗时: 30.51ms | 平均FPS: 32.78 +2025-12-12 15:56:27,098 [INFO] [detectionThread:1281] 推流统计: 900帧, 成功率: 98.22%, 重启: 2次 +2025-12-12 15:56:28,639 [INFO] [detectionThread:1271] 帧处理耗时: 30.80ms | 平均FPS: 32.46 +2025-12-12 15:56:28,639 [INFO] [detectionThread:1281] 推流统计: 950帧, 成功率: 98.32%, 重启: 2次 +2025-12-12 15:56:28,760 [WARNING] [ffmpegStreamer:302] FFmpeg错误: t798640]nnectiott : ot13 aile:Eronumber18ocre [tcp @ 000002d94e798640] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:28,764 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:56:28,764 [WARNING] [ffmpegStreamer:441] 管道破裂状态 +2025-12-12 15:56:28,768 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:56:28,771 [WARNING] [ffmpegStreamer:178] 连续写入失败 10 次 +2025-12-12 15:56:28,772 [WARNING] [ffmpegStreamer:182] 连续失败 10 次,尝试恢复 +2025-12-12 15:56:28,772 [INFO] [ffmpegStreamer:458] 尝试恢复推流进程... +2025-12-12 15:56:28,772 [INFO] [ffmpegStreamer:489] 问题较严重,尝试重启FFmpeg +2025-12-12 15:56:28,772 [ERROR] [ffmpegStreamer:517] 全局重启频率过高,等待60秒 +2025-12-12 15:56:28,772 [ERROR] [ffmpegStreamer:184] 恢复失败,停止推流 +2025-12-12 15:56:28,772 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:56:28,772 [INFO] [ffmpegStreamer:228] 监控线程已停止 +2025-12-12 15:56:28,772 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 19608... +2025-12-12 15:56:28,772 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 19608 已停止 +2025-12-12 15:56:28,772 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 6.6秒 + 总帧数: 69 + 成功发送: 1 + 丢弃帧数: 68 + 丢帧率: 98.6% + 平均FPS: 0.2 + 重启次数: 0 +2025-12-12 15:56:28,773 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:56:28,794 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:28,794 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (1/5) +2025-12-12 15:56:28,818 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:28,818 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (2/5) +2025-12-12 15:56:28,842 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:28,842 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (3/5) +2025-12-12 15:56:28,842 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:56:28,842 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:56:28,842 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:56:28,842 [INFO] [detectionThread:650] 最近输出: t@ 2d94e]arting con[cp @ 000002d94e Con attemp o:1pr 95fd rr -3 curd +2025-12-12 15:56:28,842 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:56:28,842 [INFO] [detectionThread:657] Input #0, rwvi Duration: N/A, start: 0.000000, bitrate: 706458 kb/s +2025-12-12 15:56:28,842 [INFO] [detectionThread:657] t@ 2d94e]arting con[cp @ 000002d94e Con attemp o:1pr 95fd rr -3 curd +2025-12-12 15:56:28,987 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:28,987 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (4/5) +2025-12-12 15:56:28,987 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:56:28,987 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:56:28,987 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:56:28,987 [INFO] [detectionThread:650] 最近输出: t@ 2d94e]arting con[cp @ 000002d94e Con attemp o:1pr 95fd rr -3 curd +2025-12-12 15:56:28,987 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:56:28,987 [INFO] [detectionThread:657] Input #0, rwvi Duration: N/A, start: 0.000000, bitrate: 706458 kb/s +2025-12-12 15:56:28,987 [INFO] [detectionThread:657] t@ 2d94e]arting con[cp @ 000002d94e Con attemp o:1pr 95fd rr -3 curd +2025-12-12 15:56:29,140 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:29,140 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (5/5) +2025-12-12 15:56:29,140 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:56:29,140 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:56:29,141 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:56:29,141 [INFO] [detectionThread:650] 最近输出: t@ 2d94e]arting con[cp @ 000002d94e Con attemp o:1pr 95fd rr -3 curd +2025-12-12 15:56:29,141 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:56:29,141 [INFO] [detectionThread:657] Input #0, rwvi Duration: N/A, start: 0.000000, bitrate: 706458 kb/s +2025-12-12 15:56:29,141 [INFO] [detectionThread:657] t@ 2d94e]arting con[cp @ 000002d94e Con attemp o:1pr 95fd rr -3 curd +2025-12-12 15:56:29,259 [ERROR] [detectionThread:629] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流连续失败,尝试恢复 +2025-12-12 15:56:29,259 [INFO] [detectionThread:674] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 尝试恢复推流器 +2025-12-12 15:56:29,259 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:56:29,561 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:56:29,561 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:56:29,561 [INFO] [detectionThread:703] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器已清理 +2025-12-12 15:56:31,561 [INFO] [detectionThread:493] 初始化任务推流器: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:56:33,615 [ERROR] [detectionThread:503] RTMP服务器不可达: Connection refused (服务器拒绝连接) +2025-12-12 15:56:33,615 [WARNING] [detectionThread:504] 推流可能失败,请检查网络和服务器状态 +2025-12-12 15:56:33,615 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:56:33,616 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 32.455561808609936 +2025-12-12 15:56:33,616 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:56:33,616 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 32.455561808609936 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:56:33,629 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 19760 +2025-12-12 15:56:34,617 [INFO] [task_stream_manager_windows:110] Windows任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器创建成功 +2025-12-12 15:56:34,617 [INFO] [detectionThread:516] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器初始化成功 +2025-12-12 15:56:34,617 [INFO] [detectionThread:686] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器恢复成功 (第3次重启) +2025-12-12 15:56:34,630 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:56:34,630 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:56:35,757 [INFO] [detectionThread:615] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已成功推流 1000 帧,成功率: 97.90% +2025-12-12 15:56:35,757 [INFO] [detectionThread:1271] 帧处理耗时: 142.37ms | 平均FPS: 7.02 +2025-12-12 15:56:35,757 [INFO] [detectionThread:1281] 推流统计: 1000帧, 成功率: 97.90%, 重启: 3次 +2025-12-12 15:56:37,241 [INFO] [detectionThread:1271] 帧处理耗时: 29.67ms | 平均FPS: 33.70 +2025-12-12 15:56:37,241 [INFO] [detectionThread:1281] 推流统计: 1050帧, 成功率: 98.00%, 重启: 3次 +2025-12-12 15:56:37,529 [INFO] [task_stream_manager_windows:348] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已推流 100 帧 +2025-12-12 15:56:38,697 [INFO] [detectionThread:615] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已成功推流 1100 帧,成功率: 98.09% +2025-12-12 15:56:38,697 [INFO] [detectionThread:1271] 帧处理耗时: 29.13ms | 平均FPS: 34.32 +2025-12-12 15:56:38,697 [INFO] [detectionThread:1281] 推流统计: 1100帧, 成功率: 98.09%, 重启: 3次 +2025-12-12 15:56:40,189 [INFO] [detectionThread:1271] 帧处理耗时: 29.82ms | 平均FPS: 33.53 +2025-12-12 15:56:40,189 [INFO] [detectionThread:1281] 推流统计: 1150帧, 成功率: 98.17%, 重启: 3次 +2025-12-12 15:56:40,221 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: tp @ 0b740 tring port1935 [cneto tep o:1pr 95fie:Errnme 18ocre [tcp @ 00000233dbd79440] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:40,225 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:56:40,225 [WARNING] [ffmpegStreamer:441] 管道破裂状态 +2025-12-12 15:56:40,229 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:56:40,234 [WARNING] [ffmpegStreamer:178] 连续写入失败 10 次 +2025-12-12 15:56:40,234 [WARNING] [ffmpegStreamer:182] 连续失败 10 次,尝试恢复 +2025-12-12 15:56:40,234 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:56:40,234 [INFO] [ffmpegStreamer:458] 尝试恢复推流进程... +2025-12-12 15:56:40,234 [INFO] [ffmpegStreamer:489] 问题较严重,尝试重启FFmpeg +2025-12-12 15:56:40,234 [ERROR] [ffmpegStreamer:517] 全局重启频率过高,等待60秒 +2025-12-12 15:56:40,234 [ERROR] [ffmpegStreamer:184] 恢复失败,停止推流 +2025-12-12 15:56:40,234 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 19760... +2025-12-12 15:56:40,235 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 19760 已停止 +2025-12-12 15:56:40,235 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 6.6秒 + 总帧数: 71 + 成功发送: 1 + 丢弃帧数: 70 + 丢帧率: 98.6% + 平均FPS: 0.2 + 重启次数: 0 +2025-12-12 15:56:40,235 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:56:40,246 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:40,246 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (1/5) +2025-12-12 15:56:40,269 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:40,269 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (2/5) +2025-12-12 15:56:40,293 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:40,293 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (3/5) +2025-12-12 15:56:40,293 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:56:40,293 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:56:40,293 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:56:40,293 [INFO] [detectionThread:650] 最近输出: tp @ 0b740 tring port1935 [cneto tep o:1pr 95fie:Errnme 18ocre [tcp @ 00000233dbd79440] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:40,293 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:56:40,293 [INFO] [detectionThread:657] Input #0, rawvideo, from 'fd:': +2025-12-12 15:56:40,293 [INFO] [detectionThread:657] tp @ 0b740 tring port1935 [cneto tep o:1pr 95fie:Errnme 18ocre [tcp @ 00000233dbd79440] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:40,449 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:40,449 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (4/5) +2025-12-12 15:56:40,449 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:56:40,449 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:56:40,449 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:56:40,449 [INFO] [detectionThread:650] 最近输出: tp @ 0b740 tring port1935 [cneto tep o:1pr 95fie:Errnme 18ocre [tcp @ 00000233dbd79440] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:40,449 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:56:40,449 [INFO] [detectionThread:657] Input #0, rawvideo, from 'fd:': +2025-12-12 15:56:40,449 [INFO] [detectionThread:657] tp @ 0b740 tring port1935 [cneto tep o:1pr 95fie:Errnme 18ocre [tcp @ 00000233dbd79440] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:40,594 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:40,594 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (5/5) +2025-12-12 15:56:40,594 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:56:40,594 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:56:40,594 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:56:40,594 [INFO] [detectionThread:650] 最近输出: tp @ 0b740 tring port1935 [cneto tep o:1pr 95fie:Errnme 18ocre [tcp @ 00000233dbd79440] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:40,594 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:56:40,594 [INFO] [detectionThread:657] Input #0, rawvideo, from 'fd:': +2025-12-12 15:56:40,594 [INFO] [detectionThread:657] tp @ 0b740 tring port1935 [cneto tep o:1pr 95fie:Errnme 18ocre [tcp @ 00000233dbd79440] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:40,722 [ERROR] [detectionThread:629] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流连续失败,尝试恢复 +2025-12-12 15:56:40,722 [INFO] [detectionThread:674] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 尝试恢复推流器 +2025-12-12 15:56:40,722 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:56:41,024 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:56:41,024 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:56:41,024 [INFO] [detectionThread:703] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器已清理 +2025-12-12 15:56:43,024 [INFO] [detectionThread:493] 初始化任务推流器: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:56:45,045 [ERROR] [detectionThread:503] RTMP服务器不可达: Connection refused (服务器拒绝连接) +2025-12-12 15:56:45,045 [WARNING] [detectionThread:504] 推流可能失败,请检查网络和服务器状态 +2025-12-12 15:56:45,045 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:56:45,046 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 30.820034028897755 +2025-12-12 15:56:45,046 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:56:45,046 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 30.820034028897755 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:56:45,061 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 22936 +2025-12-12 15:56:46,047 [INFO] [task_stream_manager_windows:110] Windows任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器创建成功 +2025-12-12 15:56:46,047 [INFO] [detectionThread:516] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器初始化成功 +2025-12-12 15:56:46,048 [INFO] [detectionThread:686] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器恢复成功 (第4次重启) +2025-12-12 15:56:46,062 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:56:46,062 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:56:47,367 [INFO] [detectionThread:615] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已成功推流 1200 帧,成功率: 97.83% +2025-12-12 15:56:47,367 [INFO] [detectionThread:1271] 帧处理耗时: 143.56ms | 平均FPS: 6.97 +2025-12-12 15:56:47,367 [INFO] [detectionThread:1281] 推流统计: 1200帧, 成功率: 97.83%, 重启: 4次 +2025-12-12 15:56:48,965 [INFO] [detectionThread:1271] 帧处理耗时: 31.95ms | 平均FPS: 31.30 +2025-12-12 15:56:48,965 [INFO] [detectionThread:1281] 推流统计: 1250帧, 成功率: 97.92%, 重启: 4次 +2025-12-12 15:56:49,155 [INFO] [task_stream_manager_windows:348] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已推流 100 帧 +2025-12-12 15:56:50,523 [INFO] [detectionThread:615] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已成功推流 1300 帧,成功率: 98.00% +2025-12-12 15:56:50,523 [INFO] [detectionThread:1271] 帧处理耗时: 31.17ms | 平均FPS: 32.09 +2025-12-12 15:56:50,523 [INFO] [detectionThread:1281] 推流统计: 1300帧, 成功率: 98.00%, 重启: 4次 +2025-12-12 15:56:51,623 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: tp @ 0000b749938fc0] npt to ::935 failed:r numberoccurred +2025-12-12 15:56:51,624 [WARNING] [ffmpegStreamer:302] FFmpeg错误: [c9938fc0] inect attempt to 101 port 1935[c01Conection attem1 port 1 Erro -138 [tcp @ 000001b749938fc0] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:51,629 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:56:51,629 [WARNING] [ffmpegStreamer:441] 管道破裂状态 +2025-12-12 15:56:51,632 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:56:51,637 [WARNING] [ffmpegStreamer:178] 连续写入失败 10 次 +2025-12-12 15:56:51,637 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:56:51,637 [WARNING] [ffmpegStreamer:182] 连续失败 10 次,尝试恢复 +2025-12-12 15:56:51,637 [INFO] [ffmpegStreamer:458] 尝试恢复推流进程... +2025-12-12 15:56:51,637 [INFO] [ffmpegStreamer:489] 问题较严重,尝试重启FFmpeg +2025-12-12 15:56:51,638 [INFO] [ffmpegStreamer:540] 准备重启FFmpeg (1/10), 2.0秒后执行... +2025-12-12 15:56:51,646 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:51,646 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (1/5) +2025-12-12 15:56:51,669 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:51,670 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (2/5) +2025-12-12 15:56:51,693 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:51,694 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (3/5) +2025-12-12 15:56:51,694 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:56:51,694 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:56:51,694 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:56:51,694 [INFO] [detectionThread:650] 最近输出: tp @ 0000b749938fc0] npt to ::935 failed:r numberoccurred +2025-12-12 15:56:51,694 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:56:51,694 [INFO] [detectionThread:657] Ip rawvi, from ' Duration: N/A, start: 0.000000, bitrate: 681689 kb/s +2025-12-12 15:56:51,694 [INFO] [detectionThread:657] tp @ 000001b74Startg connion27.0.. +2025-12-12 15:56:51,694 [INFO] [detectionThread:657] tp @ 0000b749938fc0] npt to ::935 failed:r numberoccurred +2025-12-12 15:56:51,725 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: [tcp @ 000001b749938fc0] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:56:51,825 [ERROR] [task_stream_manager_windows:271] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7] 关键错误: [rtmp @ 000001b7498d7a00] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:56:51,825 [INFO] [task_stream_manager_windows:289] 安全重启推流器: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:56:51,825 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:56:51,825 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 22936... +2025-12-12 15:56:51,826 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 22936 已停止 +2025-12-12 15:56:52,138 [INFO] [ffmpegStreamer:546] 收到停止信号,取消重启 +2025-12-12 15:56:52,138 [ERROR] [ffmpegStreamer:184] 恢复失败,停止推流 +2025-12-12 15:56:52,138 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 7.1秒 + 总帧数: 70 + 成功发送: 1 + 丢弃帧数: 69 + 丢帧率: 98.6% + 平均FPS: 0.1 + 重启次数: 1 +2025-12-12 15:56:52,138 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:56:52,138 [INFO] [ffmpegStreamer:1020] 推流线程已完全停止 +2025-12-12 15:56:52,138 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:56:53,139 [WARNING] [task_stream_manager_windows:71] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已有推流器,先清理 +2025-12-12 15:56:53,139 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:56:53,139 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:56:53,139 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 30.820034028897755 +2025-12-12 15:56:53,140 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:56:53,140 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 30.820034028897755 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:56:53,154 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 7340 +2025-12-12 15:56:54,140 [INFO] [task_stream_manager_windows:110] Windows任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器创建成功 +2025-12-12 15:56:54,140 [INFO] [task_stream_manager_windows:310] 推流器重启成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:56:54,140 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: [rtmp @ 000001b7498d7a00] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:56:54,155 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:56:54,155 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:56:54,417 [INFO] [detectionThread:1271] 帧处理耗时: 77.87ms | 平均FPS: 12.84 +2025-12-12 15:56:54,418 [INFO] [detectionThread:1281] 推流统计: 1350帧, 成功率: 97.85%, 重启: 4次 +2025-12-12 15:56:55,942 [INFO] [detectionThread:615] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已成功推流 1400 帧,成功率: 97.93% +2025-12-12 15:56:55,942 [INFO] [detectionThread:1271] 帧处理耗时: 30.49ms | 平均FPS: 32.79 +2025-12-12 15:56:55,942 [INFO] [detectionThread:1281] 推流统计: 1400帧, 成功率: 97.93%, 重启: 4次 +2025-12-12 15:56:57,155 [INFO] [task_stream_manager_windows:348] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已推流 100 帧 +2025-12-12 15:56:57,535 [INFO] [detectionThread:1271] 帧处理耗时: 31.85ms | 平均FPS: 31.40 +2025-12-12 15:56:57,535 [INFO] [detectionThread:1281] 推流统计: 1450帧, 成功率: 98.00%, 重启: 4次 +2025-12-12 15:56:58,995 [INFO] [detectionThread:615] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已成功推流 1500 帧,成功率: 98.07% +2025-12-12 15:56:58,996 [INFO] [detectionThread:1271] 帧处理耗时: 29.22ms | 平均FPS: 34.23 +2025-12-12 15:56:58,996 [INFO] [detectionThread:1281] 推流统计: 1500帧, 成功率: 98.07%, 重启: 4次 +2025-12-12 15:56:59,706 [WARNING] [ffmpegStreamer:302] FFmpeg错误: [c0000277c6607cc0] connecn attemp0..rt 1935[tcp @ 00000277c6607cc0] Connecion attempt to ::1 port 1935 failed:Error number 1 +2025-12-12 15:56:59,707 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: t -38 occurred [tcp @ 00000277c6607cc0] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:59,717 [WARNING] [ffmpegStreamer:302] FFmpeg错误: [tcp @ 00000277c6607cc0] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:56:59,718 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:56:59,718 [WARNING] [ffmpegStreamer:441] 管道破裂状态 +2025-12-12 15:56:59,723 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:56:59,729 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:56:59,742 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:59,742 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (1/5) +2025-12-12 15:56:59,777 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:59,777 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (2/5) +2025-12-12 15:56:59,814 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:59,814 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (3/5) +2025-12-12 15:56:59,815 [ERROR] [task_stream_manager_windows:271] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7] 关键错误: [rtmp @ 00000277c65c3c80] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:56:59,815 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:56:59,815 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: [rtmp @ 00000277c65c3c80] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:56:59,815 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:56:59,815 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:56:59,815 [INFO] [detectionThread:650] 最近输出: [rtmp @ 00000277c65c3c80] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:56:59,815 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:56:59,815 [INFO] [detectionThread:657] Ip , raweorom ': +2025-12-12 15:56:59,816 [INFO] [detectionThread:657] tp @ 0 Startingtiot to 127.01 po +2025-12-12 15:56:59,816 [INFO] [detectionThread:657] t -38 occurred [tcp @ 00000277c6607cc0] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:59,816 [INFO] [detectionThread:657] [rtmp @ 00000277c65c3c80] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:56:59,916 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: [out#0/flv @ 00000277c6592200] Error opening output rtmp://localhost:1935/live/15: Error number -138 occurred +2025-12-12 15:56:59,984 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:56:59,985 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (4/5) +2025-12-12 15:56:59,985 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:56:59,985 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:56:59,985 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:56:59,985 [INFO] [detectionThread:650] 最近输出: [out#0/flv @ 00000277c6592200] Error opening output rtmp://localhost:1935/live/15: Error number -138 occurred +2025-12-12 15:56:59,985 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:56:59,985 [INFO] [detectionThread:657] Ip , raweorom ': +2025-12-12 15:56:59,985 [INFO] [detectionThread:657] tp @ 0 Startingtiot to 127.01 po +2025-12-12 15:56:59,985 [INFO] [detectionThread:657] t -38 occurred [tcp @ 00000277c6607cc0] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:56:59,985 [INFO] [detectionThread:657] [rtmp @ 00000277c65c3c80] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:56:59,986 [INFO] [detectionThread:657] [out#0/flv @ 00000277c6592200] Error opening output rtmp://localhost:1935/live/15: Error number -138 occurred +2025-12-12 15:57:00,017 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: Error opening output file rtmp://localhost:1935/live/15. +2025-12-12 15:57:00,117 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: Error opening output files: Error number -138 occurred +2025-12-12 15:57:00,148 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:57:00,148 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (5/5) +2025-12-12 15:57:00,149 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:57:00,149 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:57:00,149 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:57:00,149 [INFO] [detectionThread:650] 最近输出: Error opening output files: Error number -138 occurred +2025-12-12 15:57:00,149 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:57:00,149 [INFO] [detectionThread:657] t -38 occurred [tcp @ 00000277c6607cc0] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:57:00,149 [INFO] [detectionThread:657] [rtmp @ 00000277c65c3c80] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:57:00,149 [INFO] [detectionThread:657] [out#0/flv @ 00000277c6592200] Error opening output rtmp://localhost:1935/live/15: Error number -138 occurred +2025-12-12 15:57:00,149 [INFO] [detectionThread:657] Error opening output file rtmp://localhost:1935/live/15. +2025-12-12 15:57:00,149 [INFO] [detectionThread:657] Error opening output files: Error number -138 occurred +2025-12-12 15:57:00,155 [WARNING] [task_stream_manager_windows:458] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 FFmpeg进程已退出 +2025-12-12 15:57:00,155 [WARNING] [task_stream_manager_windows:458] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 FFmpeg进程已退出 +2025-12-12 15:57:00,244 [INFO] [ffmpegStreamer:458] 尝试恢复推流进程... +2025-12-12 15:57:00,244 [INFO] [ffmpegStreamer:489] 问题较严重,尝试重启FFmpeg +2025-12-12 15:57:00,244 [INFO] [ffmpegStreamer:540] 准备重启FFmpeg (1/10), 2.0秒后执行... +2025-12-12 15:57:00,280 [ERROR] [detectionThread:629] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流连续失败,尝试恢复 +2025-12-12 15:57:00,281 [INFO] [detectionThread:674] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 尝试恢复推流器 +2025-12-12 15:57:00,281 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:57:00,281 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 7340... +2025-12-12 15:57:00,281 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 7340 已停止 +2025-12-12 15:57:00,745 [INFO] [ffmpegStreamer:546] 收到停止信号,取消重启 +2025-12-12 15:57:00,745 [ERROR] [ffmpegStreamer:613] 心跳检测恢复失败 +2025-12-12 15:57:00,745 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 7.6秒 + 总帧数: 72 + 成功发送: 1 + 丢弃帧数: 71 + 丢帧率: 98.6% + 平均FPS: 0.1 + 重启次数: 1 +2025-12-12 15:57:00,745 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:57:00,745 [INFO] [ffmpegStreamer:1020] 推流线程已完全停止 +2025-12-12 15:57:00,746 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:57:00,746 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:57:00,746 [INFO] [detectionThread:703] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器已清理 +2025-12-12 15:57:02,746 [INFO] [detectionThread:493] 初始化任务推流器: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:57:04,811 [ERROR] [detectionThread:503] RTMP服务器不可达: Connection refused (服务器拒绝连接) +2025-12-12 15:57:04,811 [WARNING] [detectionThread:504] 推流可能失败,请检查网络和服务器状态 +2025-12-12 15:57:04,811 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:57:04,812 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 23.794682016379497 +2025-12-12 15:57:04,812 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:57:04,812 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 23.794682016379497 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:57:04,828 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 21920 +2025-12-12 15:57:05,813 [INFO] [task_stream_manager_windows:110] Windows任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器创建成功 +2025-12-12 15:57:05,814 [INFO] [detectionThread:516] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器初始化成功 +2025-12-12 15:57:05,814 [INFO] [detectionThread:686] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器恢复成功 (第5次重启) +2025-12-12 15:57:05,830 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:57:05,831 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:57:06,780 [INFO] [detectionThread:1271] 帧处理耗时: 155.69ms | 平均FPS: 6.42 +2025-12-12 15:57:06,780 [INFO] [detectionThread:1281] 推流统计: 1550帧, 成功率: 97.81%, 重启: 5次 +2025-12-12 15:57:08,770 [INFO] [detectionThread:615] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已成功推流 1600 帧,成功率: 97.88% +2025-12-12 15:57:08,770 [INFO] [detectionThread:1271] 帧处理耗时: 39.78ms | 平均FPS: 25.14 +2025-12-12 15:57:08,771 [INFO] [detectionThread:1281] 推流统计: 1600帧, 成功率: 97.88%, 重启: 5次 +2025-12-12 15:57:09,757 [INFO] [task_stream_manager_windows:348] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已推流 100 帧 +2025-12-12 15:57:10,768 [INFO] [detectionThread:1271] 帧处理耗时: 39.94ms | 平均FPS: 25.04 +2025-12-12 15:57:10,768 [INFO] [detectionThread:1281] 推流统计: 1650帧, 成功率: 97.94%, 重启: 5次 +2025-12-12 15:57:11,436 [WARNING] [ffmpegStreamer:302] FFmpeg错误: [c @ 00001b726aca[tp 000001b7ection attempt to ::1 port 1935 failed: Error number -138occurred[tcp @ 000001bb726aca80] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:57:11,440 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:57:11,441 [WARNING] [ffmpegStreamer:441] 管道破裂状态 +2025-12-12 15:57:11,446 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:57:11,451 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:57:11,465 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:57:11,465 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (1/5) +2025-12-12 15:57:11,498 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:57:11,499 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (2/5) +2025-12-12 15:57:11,537 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:57:11,537 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (3/5) +2025-12-12 15:57:11,537 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:57:11,537 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:57:11,537 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:57:11,537 [INFO] [detectionThread:650] 最近输出: c@ b26aca80] Conn +2025-12-12 15:57:11,537 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:57:11,537 [INFO] [detectionThread:657] Input #0, rawvideo, from 'fd:': +2025-12-12 15:57:11,537 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: [tcp @ 000001bb726aca80] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:57:11,538 [INFO] [detectionThread:657] tp0b80] Starting connection attempt to 127.0.0.1 port 1935 +2025-12-12 15:57:11,538 [INFO] [detectionThread:657] c@ b26aca80] Conn +2025-12-12 15:57:11,667 [ERROR] [task_stream_manager_windows:271] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7] 关键错误: [rtmp @ 000001bb72663440] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:57:11,667 [INFO] [task_stream_manager_windows:289] 安全重启推流器: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:57:11,668 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:57:11,668 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 21920... +2025-12-12 15:57:11,668 [INFO] [ffmpegStreamer:145] 接收到停止信号 +2025-12-12 15:57:11,668 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 21920 已停止 +2025-12-12 15:57:11,669 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 6.9秒 + 总帧数: 57 + 成功发送: 1 + 丢弃帧数: 56 + 丢帧率: 98.2% + 平均FPS: 0.1 + 重启次数: 0 +2025-12-12 15:57:11,669 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:57:11,971 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:57:12,972 [WARNING] [task_stream_manager_windows:71] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已有推流器,先清理 +2025-12-12 15:57:12,972 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:57:12,972 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:57:12,973 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 23.794682016379497 +2025-12-12 15:57:12,973 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:57:12,973 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 23.794682016379497 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:57:12,990 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 14636 +2025-12-12 15:57:13,973 [INFO] [task_stream_manager_windows:110] Windows任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器创建成功 +2025-12-12 15:57:13,974 [INFO] [task_stream_manager_windows:310] 推流器重启成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:57:13,974 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: [rtmp @ 000001bb72663440] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:57:13,991 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:57:13,992 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:57:15,076 [INFO] [detectionThread:615] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已成功推流 1700 帧,成功率: 97.82% +2025-12-12 15:57:15,076 [INFO] [detectionThread:1271] 帧处理耗时: 86.17ms | 平均FPS: 11.60 +2025-12-12 15:57:15,076 [INFO] [detectionThread:1281] 推流统计: 1700帧, 成功率: 97.82%, 重启: 5次 +2025-12-12 15:57:17,104 [INFO] [detectionThread:1271] 帧处理耗时: 40.53ms | 平均FPS: 24.67 +2025-12-12 15:57:17,104 [INFO] [detectionThread:1281] 推流统计: 1750帧, 成功率: 97.89%, 重启: 5次 +2025-12-12 15:57:17,901 [INFO] [task_stream_manager_windows:348] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已推流 100 帧 +2025-12-12 15:57:19,110 [INFO] [detectionThread:615] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已成功推流 1800 帧,成功率: 97.94% +2025-12-12 15:57:19,111 [INFO] [detectionThread:1271] 帧处理耗时: 40.13ms | 平均FPS: 24.92 +2025-12-12 15:57:19,111 [INFO] [detectionThread:1281] 推流统计: 1800帧, 成功率: 97.94%, 重启: 5次 +2025-12-12 15:57:19,553 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: tp@ 0000017edfdd Strtionttempt to 1ort 1935 [p @ 07ed9f4 necn a ::o93iEr nu -138 ur [tcp @ 0000017edfdd9f40] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:57:19,557 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:57:19,557 [WARNING] [ffmpegStreamer:441] 管道破裂状态 +2025-12-12 15:57:19,561 [WARNING] [ffmpegStreamer:178] 连续写入失败 5 次 +2025-12-12 15:57:19,566 [WARNING] [ffmpegStreamer:178] 连续写入失败 10 次 +2025-12-12 15:57:19,566 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:57:19,566 [WARNING] [ffmpegStreamer:182] 连续失败 10 次,尝试恢复 +2025-12-12 15:57:19,566 [INFO] [ffmpegStreamer:458] 尝试恢复推流进程... +2025-12-12 15:57:19,566 [INFO] [ffmpegStreamer:489] 问题较严重,尝试重启FFmpeg +2025-12-12 15:57:19,566 [INFO] [ffmpegStreamer:540] 准备重启FFmpeg (1/10), 2.0秒后执行... +2025-12-12 15:57:19,586 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:57:19,587 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (1/5) +2025-12-12 15:57:19,626 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:57:19,626 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (2/5) +2025-12-12 15:57:19,654 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: [tcp @ 0000017edfdd9f40] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:57:19,662 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:57:19,662 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (3/5) +2025-12-12 15:57:19,662 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:57:19,663 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:57:19,663 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:57:19,663 [INFO] [detectionThread:650] 最近输出: [tcp @ 0000017edfdd9f40] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:57:19,663 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:57:19,663 [INFO] [detectionThread:657] Ipawvidm ':': +2025-12-12 15:57:19,663 [INFO] [detectionThread:657] tp@ 0000017edfdd Strtionttempt to 1ort 1935 [p @ 07ed9f4 necn a ::o93iEr nu -138 ur [tcp @ 0000017edfdd9f40] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:57:19,663 [INFO] [detectionThread:657] [tcp @ 0000017edfdd9f40] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:57:19,755 [ERROR] [task_stream_manager_windows:271] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7] 关键错误: [rtmp @ 0000017edfdd9a00] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:57:19,755 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: [rtmp @ 0000017edfdd9a00] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:57:19,828 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:57:19,828 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (4/5) +2025-12-12 15:57:19,828 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:57:19,828 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:57:19,828 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:57:19,828 [INFO] [detectionThread:650] 最近输出: [rtmp @ 0000017edfdd9a00] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:57:19,828 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:57:19,829 [INFO] [detectionThread:657] Ipawvidm ':': +2025-12-12 15:57:19,829 [INFO] [detectionThread:657] tp@ 0000017edfdd Strtionttempt to 1ort 1935 [p @ 07ed9f4 necn a ::o93iEr nu -138 ur [tcp @ 0000017edfdd9f40] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:57:19,829 [INFO] [detectionThread:657] [tcp @ 0000017edfdd9f40] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:57:19,829 [INFO] [detectionThread:657] [rtmp @ 0000017edfdd9a00] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:57:19,856 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: [out#0/flv @ 0000017edfd90580] Error opening output rtmp://localhost:1935/live/15: Error number -138 occurred +2025-12-12 15:57:19,959 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: Error opening output file rtmp://localhost:1935/live/15. +2025-12-12 15:57:19,979 [WARNING] [task_stream_manager_windows:458] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 FFmpeg进程已退出 +2025-12-12 15:57:19,979 [WARNING] [task_stream_manager_windows:458] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 FFmpeg进程已退出 +2025-12-12 15:57:19,992 [WARNING] [task_stream_manager_windows:351] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 +2025-12-12 15:57:19,992 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (5/5) +2025-12-12 15:57:19,992 [INFO] [detectionThread:643] 诊断Windows推流问题... +2025-12-12 15:57:19,992 [INFO] [detectionThread:648] 推流状态: error +2025-12-12 15:57:19,993 [INFO] [detectionThread:649] FFmpeg进程: 已停止 +2025-12-12 15:57:19,993 [INFO] [detectionThread:650] 最近输出: Error opening output file rtmp://localhost:1935/live/15. +2025-12-12 15:57:19,993 [INFO] [detectionThread:655] 最近FFmpeg输出: +2025-12-12 15:57:19,993 [INFO] [detectionThread:657] tp@ 0000017edfdd Strtionttempt to 1ort 1935 [p @ 07ed9f4 necn a ::o93iEr nu -138 ur [tcp @ 0000017edfdd9f40] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:57:19,993 [INFO] [detectionThread:657] [tcp @ 0000017edfdd9f40] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Error number -138 occurred +2025-12-12 15:57:19,993 [INFO] [detectionThread:657] [rtmp @ 0000017edfdd9a00] Cannot open connection tcp://localhost:1935?tcp_nodelay=0 +2025-12-12 15:57:19,993 [INFO] [detectionThread:657] [out#0/flv @ 0000017edfd90580] Error opening output rtmp://localhost:1935/live/15: Error number -138 occurred +2025-12-12 15:57:19,993 [INFO] [detectionThread:657] Error opening output file rtmp://localhost:1935/live/15. +2025-12-12 15:57:20,060 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: Error opening output files: Error number -138 occurred +2025-12-12 15:57:20,123 [ERROR] [detectionThread:629] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流连续失败,尝试恢复 +2025-12-12 15:57:20,123 [INFO] [detectionThread:674] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 尝试恢复推流器 +2025-12-12 15:57:20,123 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:57:20,123 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 14636... +2025-12-12 15:57:20,123 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 14636 已停止 +2025-12-12 15:57:20,568 [INFO] [ffmpegStreamer:546] 收到停止信号,取消重启 +2025-12-12 15:57:20,568 [ERROR] [ffmpegStreamer:184] 恢复失败,停止推流 +2025-12-12 15:57:20,568 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 7.6秒 + 总帧数: 59 + 成功发送: 1 + 丢弃帧数: 58 + 丢帧率: 98.3% + 平均FPS: 0.1 + 重启次数: 1 +2025-12-12 15:57:20,569 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:57:20,569 [INFO] [ffmpegStreamer:1020] 推流线程已完全停止 +2025-12-12 15:57:20,569 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:57:20,569 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:57:20,569 [INFO] [detectionThread:703] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器已清理 +2025-12-12 15:57:22,570 [INFO] [detectionThread:493] 初始化任务推流器: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:57:24,612 [ERROR] [detectionThread:503] RTMP服务器不可达: Connection refused (服务器拒绝连接) +2025-12-12 15:57:24,612 [WARNING] [detectionThread:504] 推流可能失败,请检查网络和服务器状态 +2025-12-12 15:57:24,612 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:57:24,613 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 21.734815069954433 +2025-12-12 15:57:24,613 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:57:24,614 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 21.734815069954433 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:57:24,631 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 4212 +2025-12-12 15:57:25,614 [INFO] [task_stream_manager_windows:110] Windows任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器创建成功 +2025-12-12 15:57:25,615 [INFO] [detectionThread:516] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器初始化成功 +2025-12-12 15:57:25,615 [INFO] [detectionThread:686] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器恢复成功 (第6次重启) +2025-12-12 15:57:25,649 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:57:25,649 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:57:26,974 [INFO] [detectionThread:1271] 帧处理耗时: 157.26ms | 平均FPS: 6.36 +2025-12-12 15:57:26,975 [INFO] [detectionThread:1281] 推流统计: 1850帧, 成功率: 97.73%, 重启: 6次 +2025-12-12 15:57:28,965 [INFO] [detectionThread:615] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已成功推流 1900 帧,成功率: 97.79% +2025-12-12 15:57:28,965 [INFO] [detectionThread:1271] 帧处理耗时: 39.80ms | 平均FPS: 25.12 +2025-12-12 15:57:28,965 [INFO] [detectionThread:1281] 推流统计: 1900帧, 成功率: 97.79%, 重启: 6次 +2025-12-12 15:57:29,601 [INFO] [task_stream_manager_windows:348] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已推流 100 帧 +2025-12-12 15:57:30,680 [INFO] [task_manager:498] 开始清理所有任务... +2025-12-12 15:57:30,680 [INFO] [task_manager:412] 开始清理任务: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7, 状态: running +2025-12-12 15:57:30,680 [INFO] [task_manager:275] 正在停止任务: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7, 当前状态: running +2025-12-12 15:57:30,680 [INFO] [detectionThread:1307] 收到停止请求,任务ID: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:57:30,692 [INFO] [detectionThread:1324] 已强制释放视频流 +2025-12-12 15:57:30,692 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:57:30,697 [WARNING] [task_stream_manager_windows:327] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器未运行 +2025-12-12 15:57:30,697 [INFO] [task_stream_manager_windows:289] 安全重启推流器: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:57:31,228 [ERROR] [task_stream_manager_windows:226] FFmpeg[17849d54-16ef-4c06-a6b9-b4f93f5a2bc7]: t001b6100]oncti atpt to ::1 port1935 fail: Err nrr [tcp @ 000001b611ac8400] Connection attempt to 127.0.0.1 port 1935 failed: Error number -138 occurred +2025-12-12 15:57:31,232 [WARNING] [ffmpegStreamer:800] 管道破裂 +2025-12-12 15:57:31,238 [INFO] [ffmpegStreamer:284] FFmpeg监控线程已退出 +2025-12-12 15:57:31,238 [INFO] [ffmpegStreamer:228] 监控线程已停止 +2025-12-12 15:57:31,238 [INFO] [ffmpegStreamer:834] 停止FFmpeg进程 PID: 4212... +2025-12-12 15:57:31,238 [INFO] [ffmpegStreamer:228] 监控线程已停止 +2025-12-12 15:57:31,239 [INFO] [ffmpegStreamer:868] FFmpeg进程 PID: 4212 已停止 +2025-12-12 15:57:31,239 [INFO] [ffmpegStreamer:933] 推流统计结果: + 持续时间: 6.6秒 + 总帧数: 40 + 成功发送: 1 + 丢弃帧数: 39 + 丢帧率: 97.5% + 平均FPS: 0.2 + 重启次数: 0 +2025-12-12 15:57:31,239 [INFO] [ffmpegStreamer:204] 推流线程已停止 +2025-12-12 15:57:31,541 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:57:31,697 [WARNING] [task_stream_manager_windows:71] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 已有推流器,先清理 +2025-12-12 15:57:31,697 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:57:31,697 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:57:31,698 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 21.734815069954433 +2025-12-12 15:57:31,698 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://localhost:1935/live/15 +2025-12-12 15:57:31,698 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 21.734815069954433 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://localhost:1935/live/15 +2025-12-12 15:57:31,714 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 12072 +2025-12-12 15:57:32,699 [INFO] [task_stream_manager_windows:110] Windows任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器创建成功 +2025-12-12 15:57:32,700 [INFO] [task_stream_manager_windows:310] 推流器重启成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:57:32,700 [WARNING] [detectionThread:621] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流失败 (1/5) +2025-12-12 15:57:32,700 [INFO] [detectionThread:1294] 检测线程主循环结束 +2025-12-12 15:57:32,700 [INFO] [detectionThread:1348] 开始清理资源,任务ID: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:57:32,704 [INFO] [ffmpegStreamer:949] 停止推流线程... +2025-12-12 15:57:32,715 [ERROR] [ffmpegStreamer:667] FFmpeg启动后立即退出 +2025-12-12 15:57:32,715 [ERROR] [ffmpegStreamer:115] 初始FFmpeg启动失败 +2025-12-12 15:57:33,017 [INFO] [ffmpegStreamer:1022] 推流线程停止流程完成 +2025-12-12 15:57:33,017 [INFO] [task_stream_manager_windows:393] Windows任务推流器停止成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:57:33,017 [INFO] [detectionThread:703] 任务 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 推流器已清理 +2025-12-12 15:57:33,113 [INFO] [detectionThread:980] MQTT客户端已停止 +2025-12-12 15:57:33,113 [INFO] [detectionThread:980] MQTT客户端已停止 +2025-12-12 15:57:33,113 [INFO] [detectionThread:1344] 停止信号已发送,任务ID: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:57:33,113 [INFO] [detectionThread:922] 上传工作线程已停止 +2025-12-12 15:57:33,113 [INFO] [task_manager:288] 已调用线程停止方法: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:57:33,114 [INFO] [detectionThread:1392] 释放视频流... +2025-12-12 15:57:33,114 [INFO] [detectionThread:1401] 释放所有模型,共 2 个 +2025-12-12 15:57:33,114 [INFO] [detectionThread:1421] 模型 d568ab8378383793 已释放 +2025-12-12 15:57:33,114 [INFO] [detectionThread:1421] 模型 c9cd25d454e06595 已释放 +2025-12-12 15:57:33,114 [INFO] [detectionThread:1428] 清理GPU缓存... +2025-12-12 15:57:33,214 [INFO] [detectionThread:1433] GPU缓存已清理 +2025-12-12 15:57:33,214 [INFO] [detectionThread:1438] 清理其他资源... +2025-12-12 15:57:33,214 [INFO] [detectionThread:1452] 其他资源已清理 +2025-12-12 15:57:33,214 [INFO] [detectionThread:1456] 资源清理完成 +2025-12-12 15:57:33,214 [INFO] [detectionThread:1301] 检测线程已安全停止 +2025-12-12 15:57:43,127 [WARNING] [task_manager:296] 强制停止任务线程超时: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:57:43,127 [INFO] [detectionThread:1348] 开始清理资源,任务ID: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:57:43,127 [INFO] [detectionThread:1401] 释放所有模型,共 0 个 +2025-12-12 15:57:43,127 [INFO] [detectionThread:1428] 清理GPU缓存... +2025-12-12 15:57:43,210 [INFO] [detectionThread:1433] GPU缓存已清理 +2025-12-12 15:57:43,210 [INFO] [detectionThread:1438] 清理其他资源... +2025-12-12 15:57:43,210 [INFO] [detectionThread:1452] 其他资源已清理 +2025-12-12 15:57:43,210 [INFO] [detectionThread:1456] 资源清理完成 +2025-12-12 15:57:43,210 [INFO] [task_manager:321] 任务停止成功: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:57:43,210 [INFO] [task_manager:487] 更新任务状态: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 stopped -> stopped +2025-12-12 15:57:44,288 [INFO] [task_manager:470] 任务清理完成: 17849d54-16ef-4c06-a6b9-b4f93f5a2bc7 +2025-12-12 15:57:44,288 [INFO] [task_manager:518] 任务清理完成: 成功 1 个, 失败 0 个, 总计 1 个 +2025-12-12 15:57:58,820 [INFO] [server:70] 收到创建任务请求: 多模型道路监控 +2025-12-12 15:57:58,821 [INFO] [server:84] 开始创建任务前的模型验证... +2025-12-12 15:57:58,883 [INFO] [mandatory_model_crypto:124] 模型解密验证成功: encrypted_models\d568ab8378383793.enc +2025-12-12 15:57:59,191 [INFO] [mandatory_model_crypto:124] 模型解密验证成功: encrypted_models\c9cd25d454e06595.enc +2025-12-12 15:57:59,195 [INFO] [server:120] 模型验证通过: 2/2 个模型有效 +2025-12-12 15:57:59,195 [INFO] [server:172] 添加已验证的加密模型 0: encrypted_models/d568ab8378383793.enc +2025-12-12 15:57:59,195 [INFO] [server:172] 添加已验证的加密模型 1: encrypted_models/c9cd25d454e06595.enc +2025-12-12 15:57:59,195 [INFO] [server:175] 创建任务前清理已停止的任务... +2025-12-12 15:57:59,195 [INFO] [task_manager:527] 开始清理已停止的任务... +2025-12-12 15:57:59,195 [INFO] [task_manager:544] 清理已停止任务完成: 清理了 0 个 +2025-12-12 15:57:59,195 [INFO] [server:208] 开始创建任务,包含 2 个已验证的加密模型... +2025-12-12 15:57:59,195 [INFO] [task_manager:77] 当前活动任务: 0/5 +2025-12-12 15:57:59,195 [INFO] [task_manager:188] 创建加密任务成功: 2a4bdf60-eaab-4306-bcca-d2380a36cd27, 加密模型数: 2, 密钥已验证 +2025-12-12 15:57:59,195 [INFO] [server:212] 任务创建成功,ID: 2a4bdf60-eaab-4306-bcca-d2380a36cd27 +2025-12-12 15:57:59,195 [INFO] [server:221] 启动任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27... +2025-12-12 15:57:59,310 [INFO] [windows_utils:497] 检测到Windows系统,进行系统检测和配置... +2025-12-12 15:57:59,311 [INFO] [windows_utils:515] Windows系统: Windows 10/11 (Build 22621) +2025-12-12 15:57:59,432 [INFO] [windows_utils:530] FFmpeg版本: ffmpeg version N-117451-g0f5592cfc7-20241010 Copyright (c) 2000-2024 the FFmpeg developers +2025-12-12 15:57:59,432 [INFO] [windows_utils:531] FFmpeg路径: D:\ffmpeg-master-latest-win64-gpl\bin\ffmpeg.exe +2025-12-12 15:57:59,432 [INFO] [windows_utils:534] 运行FFmpeg功能测试... +2025-12-12 15:57:59,569 [INFO] [windows_utils:545] FFmpeg功能测试成功! +2025-12-12 15:57:59,569 [INFO] [windows_utils:551] 检测到 1 个GPU: +2025-12-12 15:57:59,569 [INFO] [windows_utils:553] GPU0: NVIDIA GeForce RTX 3060 +2025-12-12 15:57:59,617 [INFO] [windows_utils:565] 系统优化建议: +2025-12-12 15:57:59,618 [INFO] [windows_utils:572] power_scheme: 电源方案 GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (高性能) +2025-12-12 15:57:59,618 [INFO] [windows_utils:572] power_recommendation: For best streaming performance, use High Performance power plan. Run: powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c +2025-12-12 15:57:59,618 [INFO] [windows_utils:572] firewall: Consider adding firewall rules for RTMP ports (1935, 1936) +2025-12-12 15:57:59,618 [INFO] [windows_utils:568] network_optimizations: +2025-12-12 15:57:59,618 [INFO] [windows_utils:570] - Increase TCP buffer size: netsh int tcp set global autotuninglevel=normal +2025-12-12 15:57:59,618 [INFO] [windows_utils:570] - Disable TCP auto-tuning (if unstable): netsh int tcp set global autotuninglevel=disabled +2025-12-12 15:57:59,618 [INFO] [windows_utils:570] - Enable TCP fast open: netsh int tcp set global fastopen=enabled +2025-12-12 15:57:59,618 [INFO] [windows_utils:570] - Set TCP keepalive: netsh int tcp set global keepalivetime=30000 +2025-12-12 15:57:59,618 [INFO] [windows_utils:568] gpu_recommendations: +2025-12-12 15:57:59,618 [INFO] [windows_utils:570] - Update graphics drivers to latest version +2025-12-12 15:57:59,618 [INFO] [windows_utils:570] - In NVIDIA Control Panel: Set Power Management Mode to "Prefer Maximum Performance" +2025-12-12 15:57:59,618 [INFO] [windows_utils:570] - In Windows Graphics Settings: Add ffmpeg.exe and set to "High Performance" +2025-12-12 15:57:59,742 [INFO] [windows_utils:578] 系统资源: CPU 4.9%, 内存 28.5% +2025-12-12 15:57:59,742 [INFO] [windows_utils:623] Windows系统检测完成,状态正常 +2025-12-12 15:57:59,742 [INFO] [detectionThread:295] Windows系统检测完成: ready +2025-12-12 15:57:59,742 [INFO] [detectionThread:313] 检测线程初始化完成: 多模型道路监控 +2025-12-12 15:57:59,743 [INFO] [detectionThread:1136] 启动检测线程,任务ID: 2a4bdf60-eaab-4306-bcca-d2380a36cd27 +2025-12-12 15:57:59,744 [INFO] [detectionThread:328] 开始从本地加载 2 个模型 +2025-12-12 15:57:59,744 [INFO] [detectionThread:343] 加载模型 0: d568ab8378383793 +2025-12-12 15:57:59,809 [INFO] [mandatory_model_crypto:124] 模型解密验证成功: encrypted_models\d568ab8378383793.enc +2025-12-12 15:57:59,835 [INFO] [detectionThread:123] 加密模型解密加载成功: encrypted_models/d568ab8378383793.enc +2025-12-12 15:57:59,849 [INFO] [detectionThread:155] 启用半精度推理: encrypted_models/d568ab8378383793.enc +2025-12-12 15:57:59,849 [INFO] [detectionThread:166] 模型加载成功: encrypted_models/d568ab8378383793.enc -> cuda:0 +2025-12-12 15:57:59,849 [INFO] [detectionThread:383] 模型加载成功: d568ab8378383793, 颜色: [0, 255, 0], 设备: cuda:0, 密钥验证: True +2025-12-12 15:57:59,849 [INFO] [detectionThread:343] 加载模型 1: c9cd25d454e06595 +2025-12-12 15:58:00,188 [INFO] [mandatory_model_crypto:124] 模型解密验证成功: encrypted_models\c9cd25d454e06595.enc +2025-12-12 15:58:00,344 [INFO] [detectionThread:123] 加密模型解密加载成功: encrypted_models/c9cd25d454e06595.enc +2025-12-12 15:58:00,376 [INFO] [detectionThread:155] 启用半精度推理: encrypted_models/c9cd25d454e06595.enc +2025-12-12 15:58:00,377 [INFO] [detectionThread:166] 模型加载成功: encrypted_models/c9cd25d454e06595.enc -> cuda:0 +2025-12-12 15:58:00,379 [INFO] [detectionThread:383] 模型加载成功: c9cd25d454e06595, 颜色: [0, 255, 0], 设备: cuda:0, 密钥验证: True +2025-12-12 15:58:00,379 [INFO] [detectionThread:406] 成功加载 2/2 个模型 +2025-12-12 15:58:00,379 [INFO] [detectionThread:411] 密钥验证统计: 2个有效, 0个无效 +2025-12-12 15:58:00,379 [INFO] [detectionThread:1147] 加密密钥验证结果: 2/2 个模型加载成功 +2025-12-12 15:58:00,379 [INFO] [detectionThread:447] 连接RTMP: rtmp://175.27.168.120:6019/live/8UUXN5400A079H +2025-12-12 15:58:00,379 [INFO] [detectionThread:459] 启用硬件加速解码 +2025-12-12 15:58:00,744 [INFO] [task_manager:247] 任务启动成功: 2a4bdf60-eaab-4306-bcca-d2380a36cd27 +2025-12-12 15:58:00,744 [INFO] [server:225] 任务启动成功: 2a4bdf60-eaab-4306-bcca-d2380a36cd27 +2025-12-12 15:58:05,987 [INFO] [detectionThread:479] 视频属性: 1280x720 @ 30.303030303030305fps +2025-12-12 15:58:05,988 [INFO] [detectionThread:493] 初始化任务推流器: 2a4bdf60-eaab-4306-bcca-d2380a36cd27 +2025-12-12 15:58:06,012 [INFO] [ffmpegStreamer:106] 推流线程初始化 | 分辨率: 1280x720 | 缓冲区: 2700KB +2025-12-12 15:58:06,012 [INFO] [ffmpegStreamer:111] 启动推流线程 | 分辨率: 1280x720 | FPS: 30.303030303030305 +2025-12-12 15:58:06,012 [INFO] [ffmpegStreamer:631] 启动FFmpeg推流进程 | 目标地址: rtmp://175.27.168.120:6019/live/7777 +2025-12-12 15:58:06,012 [INFO] [task_stream_manager_windows:190] Windows FFmpeg命令: ffmpeg -y -loglevel verbose -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 1280x720 -r 30.303030303030305 -i - -c:v libx264 -preset ultrafast -tune zerolatency -f flv -g 10 -bf 0 -max_delay 0 -flags +global_header -rtbufsize 100M -b:v 2000k -bufsize 2000k -max_delay 0 -flags +global_header -rtbufsize 100M -g 10 -bf 0 rtmp://175.27.168.120:6019/live/7777 +2025-12-12 15:58:06,026 [INFO] [ffmpegStreamer:660] FFmpeg启动成功 PID: 19536 +2025-12-12 15:58:07,013 [INFO] [task_stream_manager_windows:110] Windows任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 推流器创建成功 +2025-12-12 15:58:07,013 [INFO] [detectionThread:516] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 推流器初始化成功 +2025-12-12 15:58:07,014 [INFO] [task_stream_manager_windows:436] Windows推流健康监控启动 +2025-12-12 15:58:07,014 [INFO] [detectionThread:1165] 推流健康监控已启动 +2025-12-12 15:58:07,014 [INFO] [detectionThread:950] 启动MQTT客户端... +2025-12-12 15:58:07,026 [INFO] [ffmpegStreamer:232] 启动FFmpeg监控线程 +2025-12-12 15:58:07,026 [INFO] [ffmpegStreamer:218] FFmpeg监控线程已启动 +2025-12-12 15:58:07,052 [INFO] [detectionThread:968] MQTT客户端已启动 +2025-12-12 15:58:07,052 [INFO] [detectionThread:859] 上传工作线程启动 +2025-12-12 15:58:07,052 [INFO] [detectionThread:1177] 图片上传线程已启动 +2025-12-12 15:58:07,052 [INFO] [detectionThread:710] 预热所有模型... +2025-12-12 15:58:07,216 [INFO] [detectionThread:730] 模型 d568ab8378383793 预热完成 +2025-12-12 15:58:07,450 [INFO] [detectionThread:730] 模型 c9cd25d454e06595 预热完成 +2025-12-12 15:58:07,450 [INFO] [detectionThread:734] 所有模型预热完成 +2025-12-12 15:58:07,450 [INFO] [task_manager:487] 更新任务状态: 2a4bdf60-eaab-4306-bcca-d2380a36cd27 running -> running +2025-12-12 15:58:07,450 [INFO] [detectionThread:1185] 资源初始化完成 +2025-12-12 15:58:08,835 [INFO] [detectionThread:1271] 帧处理耗时: 27.71ms | 平均FPS: 36.09 +2025-12-12 15:58:08,836 [INFO] [detectionThread:1281] 推流统计: 50帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:10,247 [INFO] [task_stream_manager_windows:348] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已推流 100 帧 +2025-12-12 15:58:10,247 [INFO] [detectionThread:615] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已成功推流 100 帧,成功率: 100.00% +2025-12-12 15:58:10,247 [INFO] [detectionThread:1271] 帧处理耗时: 28.20ms | 平均FPS: 35.46 +2025-12-12 15:58:10,247 [INFO] [detectionThread:1281] 推流统计: 100帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:11,652 [INFO] [detectionThread:1271] 帧处理耗时: 28.10ms | 平均FPS: 35.58 +2025-12-12 15:58:11,652 [INFO] [detectionThread:1281] 推流统计: 150帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:13,054 [INFO] [task_stream_manager_windows:348] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已推流 200 帧 +2025-12-12 15:58:13,054 [INFO] [detectionThread:615] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已成功推流 200 帧,成功率: 100.00% +2025-12-12 15:58:13,054 [INFO] [detectionThread:1271] 帧处理耗时: 28.03ms | 平均FPS: 35.68 +2025-12-12 15:58:13,054 [INFO] [detectionThread:1281] 推流统计: 200帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:14,490 [INFO] [detectionThread:1271] 帧处理耗时: 28.73ms | 平均FPS: 34.81 +2025-12-12 15:58:14,490 [INFO] [detectionThread:1281] 推流统计: 250帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:15,984 [INFO] [task_stream_manager_windows:348] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已推流 300 帧 +2025-12-12 15:58:15,984 [INFO] [detectionThread:615] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已成功推流 300 帧,成功率: 100.00% +2025-12-12 15:58:15,984 [INFO] [detectionThread:1271] 帧处理耗时: 29.89ms | 平均FPS: 33.46 +2025-12-12 15:58:15,984 [INFO] [detectionThread:1281] 推流统计: 300帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:17,417 [INFO] [detectionThread:1271] 帧处理耗时: 28.65ms | 平均FPS: 34.91 +2025-12-12 15:58:17,417 [INFO] [detectionThread:1281] 推流统计: 350帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:18,818 [INFO] [task_stream_manager_windows:348] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已推流 400 帧 +2025-12-12 15:58:18,818 [INFO] [detectionThread:615] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已成功推流 400 帧,成功率: 100.00% +2025-12-12 15:58:18,818 [INFO] [detectionThread:1271] 帧处理耗时: 28.02ms | 平均FPS: 35.69 +2025-12-12 15:58:18,819 [INFO] [detectionThread:1281] 推流统计: 400帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:20,314 [INFO] [detectionThread:1271] 帧处理耗时: 29.90ms | 平均FPS: 33.44 +2025-12-12 15:58:20,314 [INFO] [detectionThread:1281] 推流统计: 450帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:21,707 [INFO] [task_stream_manager_windows:348] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已推流 500 帧 +2025-12-12 15:58:21,707 [INFO] [detectionThread:615] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已成功推流 500 帧,成功率: 100.00% +2025-12-12 15:58:21,707 [INFO] [detectionThread:1271] 帧处理耗时: 27.85ms | 平均FPS: 35.91 +2025-12-12 15:58:21,707 [INFO] [detectionThread:1281] 推流统计: 500帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:23,254 [INFO] [detectionThread:1271] 帧处理耗时: 30.93ms | 平均FPS: 32.33 +2025-12-12 15:58:23,254 [INFO] [detectionThread:1281] 推流统计: 550帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:24,699 [INFO] [task_stream_manager_windows:348] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已推流 600 帧 +2025-12-12 15:58:24,699 [INFO] [detectionThread:615] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已成功推流 600 帧,成功率: 100.00% +2025-12-12 15:58:24,699 [INFO] [detectionThread:1271] 帧处理耗时: 28.90ms | 平均FPS: 34.60 +2025-12-12 15:58:24,699 [INFO] [detectionThread:1281] 推流统计: 600帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:26,164 [INFO] [detectionThread:1271] 帧处理耗时: 29.30ms | 平均FPS: 34.14 +2025-12-12 15:58:26,164 [INFO] [detectionThread:1281] 推流统计: 650帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:27,683 [INFO] [task_stream_manager_windows:348] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已推流 700 帧 +2025-12-12 15:58:27,683 [INFO] [detectionThread:615] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已成功推流 700 帧,成功率: 100.00% +2025-12-12 15:58:27,684 [INFO] [detectionThread:1271] 帧处理耗时: 30.39ms | 平均FPS: 32.90 +2025-12-12 15:58:27,684 [INFO] [detectionThread:1281] 推流统计: 700帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:29,060 [INFO] [detectionThread:1271] 帧处理耗时: 27.52ms | 平均FPS: 36.33 +2025-12-12 15:58:29,060 [INFO] [detectionThread:1281] 推流统计: 750帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:30,545 [INFO] [task_stream_manager_windows:348] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已推流 800 帧 +2025-12-12 15:58:30,546 [INFO] [detectionThread:615] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已成功推流 800 帧,成功率: 100.00% +2025-12-12 15:58:30,546 [INFO] [detectionThread:1271] 帧处理耗时: 29.70ms | 平均FPS: 33.67 +2025-12-12 15:58:30,546 [INFO] [detectionThread:1281] 推流统计: 800帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:32,108 [INFO] [detectionThread:1271] 帧处理耗时: 31.24ms | 平均FPS: 32.01 +2025-12-12 15:58:32,108 [INFO] [detectionThread:1281] 推流统计: 850帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:33,588 [INFO] [task_stream_manager_windows:348] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已推流 900 帧 +2025-12-12 15:58:33,588 [INFO] [detectionThread:615] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已成功推流 900 帧,成功率: 100.00% +2025-12-12 15:58:33,588 [INFO] [detectionThread:1271] 帧处理耗时: 29.61ms | 平均FPS: 33.78 +2025-12-12 15:58:33,588 [INFO] [detectionThread:1281] 推流统计: 900帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:35,057 [INFO] [detectionThread:1271] 帧处理耗时: 29.37ms | 平均FPS: 34.04 +2025-12-12 15:58:35,057 [INFO] [detectionThread:1281] 推流统计: 950帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:36,583 [INFO] [task_stream_manager_windows:348] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已推流 1000 帧 +2025-12-12 15:58:36,583 [INFO] [detectionThread:615] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已成功推流 1000 帧,成功率: 100.00% +2025-12-12 15:58:36,583 [INFO] [detectionThread:1271] 帧处理耗时: 30.51ms | 平均FPS: 32.77 +2025-12-12 15:58:36,583 [INFO] [detectionThread:1281] 推流统计: 1000帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:37,983 [INFO] [detectionThread:1271] 帧处理耗时: 27.99ms | 平均FPS: 35.72 +2025-12-12 15:58:37,983 [INFO] [detectionThread:1281] 推流统计: 1050帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:39,522 [INFO] [task_stream_manager_windows:348] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已推流 1100 帧 +2025-12-12 15:58:39,522 [INFO] [detectionThread:615] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已成功推流 1100 帧,成功率: 100.00% +2025-12-12 15:58:39,522 [INFO] [detectionThread:1271] 帧处理耗时: 30.79ms | 平均FPS: 32.48 +2025-12-12 15:58:39,522 [INFO] [detectionThread:1281] 推流统计: 1100帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:41,042 [INFO] [detectionThread:1271] 帧处理耗时: 30.39ms | 平均FPS: 32.91 +2025-12-12 15:58:41,042 [INFO] [detectionThread:1281] 推流统计: 1150帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:42,621 [INFO] [task_stream_manager_windows:348] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已推流 1200 帧 +2025-12-12 15:58:42,621 [INFO] [detectionThread:615] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已成功推流 1200 帧,成功率: 100.00% +2025-12-12 15:58:42,621 [INFO] [detectionThread:1271] 帧处理耗时: 31.57ms | 平均FPS: 31.68 +2025-12-12 15:58:42,621 [INFO] [detectionThread:1281] 推流统计: 1200帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:44,096 [INFO] [detectionThread:1271] 帧处理耗时: 29.51ms | 平均FPS: 33.89 +2025-12-12 15:58:44,096 [INFO] [detectionThread:1281] 推流统计: 1250帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:45,576 [INFO] [task_stream_manager_windows:348] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已推流 1300 帧 +2025-12-12 15:58:45,576 [INFO] [detectionThread:615] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已成功推流 1300 帧,成功率: 100.00% +2025-12-12 15:58:45,576 [INFO] [detectionThread:1271] 帧处理耗时: 29.58ms | 平均FPS: 33.80 +2025-12-12 15:58:45,576 [INFO] [detectionThread:1281] 推流统计: 1300帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:47,143 [INFO] [detectionThread:1271] 帧处理耗时: 30.27ms | 平均FPS: 33.04 +2025-12-12 15:58:47,143 [INFO] [detectionThread:1281] 推流统计: 1348帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:48,874 [INFO] [detectionThread:1271] 帧处理耗时: 29.54ms | 平均FPS: 33.85 +2025-12-12 15:58:48,874 [INFO] [detectionThread:1281] 推流统计: 1394帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:49,062 [INFO] [task_stream_manager_windows:348] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已推流 1400 帧 +2025-12-12 15:58:49,062 [INFO] [detectionThread:615] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已成功推流 1400 帧,成功率: 100.00% +2025-12-12 15:58:50,505 [INFO] [detectionThread:1271] 帧处理耗时: 31.79ms | 平均FPS: 31.46 +2025-12-12 15:58:50,505 [INFO] [detectionThread:1281] 推流统计: 1442帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:52,272 [INFO] [detectionThread:1271] 帧处理耗时: 29.53ms | 平均FPS: 33.86 +2025-12-12 15:58:52,272 [INFO] [detectionThread:1281] 推流统计: 1489帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:52,586 [INFO] [task_stream_manager_windows:348] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已推流 1500 帧 +2025-12-12 15:58:52,586 [INFO] [detectionThread:615] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已成功推流 1500 帧,成功率: 100.00% +2025-12-12 15:58:53,878 [INFO] [detectionThread:1271] 帧处理耗时: 30.82ms | 平均FPS: 32.45 +2025-12-12 15:58:53,879 [INFO] [detectionThread:1281] 推流统计: 1538帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:55,469 [INFO] [detectionThread:1271] 帧处理耗时: 27.94ms | 平均FPS: 35.79 +2025-12-12 15:58:55,470 [INFO] [detectionThread:1281] 推流统计: 1583帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:56,147 [INFO] [task_stream_manager_windows:348] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已推流 1600 帧 +2025-12-12 15:58:56,148 [INFO] [detectionThread:615] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已成功推流 1600 帧,成功率: 100.00% +2025-12-12 15:58:57,146 [INFO] [detectionThread:1271] 帧处理耗时: 31.12ms | 平均FPS: 32.13 +2025-12-12 15:58:57,147 [INFO] [detectionThread:1281] 推流统计: 1628帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:58,921 [INFO] [detectionThread:1271] 帧处理耗时: 28.74ms | 平均FPS: 34.79 +2025-12-12 15:58:58,922 [INFO] [detectionThread:1281] 推流统计: 1674帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:58:59,847 [INFO] [task_stream_manager_windows:348] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已推流 1700 帧 +2025-12-12 15:58:59,847 [INFO] [detectionThread:615] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已成功推流 1700 帧,成功率: 100.00% +2025-12-12 15:59:00,542 [INFO] [detectionThread:1271] 帧处理耗时: 29.41ms | 平均FPS: 34.01 +2025-12-12 15:59:00,542 [INFO] [detectionThread:1281] 推流统计: 1722帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:59:02,140 [INFO] [detectionThread:1271] 帧处理耗时: 31.03ms | 平均FPS: 32.23 +2025-12-12 15:59:02,140 [INFO] [detectionThread:1281] 推流统计: 1771帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:59:03,229 [INFO] [task_stream_manager_windows:348] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已推流 1800 帧 +2025-12-12 15:59:03,230 [INFO] [detectionThread:615] 任务 2a4bdf60-eaab-4306-bcca-d2380a36cd27 已成功推流 1800 帧,成功率: 100.00% +2025-12-12 15:59:03,894 [INFO] [detectionThread:1271] 帧处理耗时: 30.74ms | 平均FPS: 32.53 +2025-12-12 15:59:03,896 [INFO] [detectionThread:1281] 推流统计: 1816帧, 成功率: 100.00%, 重启: 0次 +2025-12-12 15:59:05,379 [INFO] [main:120] 收到退出信号,停止所有服务... +2025-12-12 15:59:05,379 [INFO] [task_stream_manager:234] 清理所有任务推流器 +2025-12-12 15:59:05,483 [INFO] [detectionThread:1271] 帧处理耗时: 28.97ms | 平均FPS: 34.52 +2025-12-12 15:59:05,484 [INFO] [detectionThread:1281] 推流统计: 1864帧, 成功率: 100.00%, 重启: 0次