mirror of
https://github.com/YaoFANGUK/video-subtitle-remover.git
synced 2026-04-13 07:37:31 +08:00
添加任务列表组件并优化视频加载逻辑 支持可视化显示字幕区域 整理所有模型, 分别为STTN智能擦除, STTN字幕检测, LAMA, ProPainter, OpenCV 提高处理性能 新增CPU运行模式并优化多语言支持 修复Propainter模式部分视频报错 本次提交新增了CPU运行模式,适用于无GPU加速的场景。同时,优化了多语言支持,新增了日语、韩语、越南语等语言配置文件,并更新了README文档以反映新的运行模式和多语言支持。此外,修复了部分代码逻辑,提升了系统的稳定性和兼容性。
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
import os
|
|
import stat
|
|
|
|
import platform
|
|
from .common_tools import merge_big_file_if_not_exists
|
|
from backend.config import BASE_DIR
|
|
|
|
class FFmpegCLI:
|
|
|
|
"""
|
|
进程管理器类,用于管理子进程的生命周期
|
|
使用弱引用避免内存泄漏
|
|
"""
|
|
_instance = None
|
|
|
|
@classmethod
|
|
def instance(cls):
|
|
"""单例模式获取实例"""
|
|
if cls._instance is None:
|
|
cls._instance = FFmpegCLI()
|
|
return cls._instance
|
|
|
|
def __init__(self):
|
|
os.chmod(self.ffmpeg_path, stat.S_IRWXU + stat.S_IRWXG + stat.S_IRWXO)
|
|
|
|
@property
|
|
def ffmpeg_path(self):
|
|
system = platform.system()
|
|
if system == "Windows":
|
|
ffmpeg_dir = os.path.join(BASE_DIR, 'ffmpeg', 'win_x64')
|
|
merge_big_file_if_not_exists(ffmpeg_dir, 'ffmpeg.exe')
|
|
return os.path.join(ffmpeg_dir, 'ffmpeg.exe')
|
|
elif system == "Linux":
|
|
return os.path.join(BASE_DIR, 'ffmpeg', 'linux_x64', 'ffmpeg')
|
|
else:
|
|
return os.path.join(BASE_DIR, 'ffmpeg', 'macos', 'ffmpeg') |