mirror of
https://github.com/YaoFANGUK/video-subtitle-remover.git
synced 2026-05-08 19:07:29 +08:00
使用PySide6-Fluent-Widgets重构整套UI
添加任务列表组件并优化视频加载逻辑 支持可视化显示字幕区域 整理所有模型, 分别为STTN智能擦除, STTN字幕检测, LAMA, ProPainter, OpenCV 提高处理性能 新增CPU运行模式并优化多语言支持 修复Propainter模式部分视频报错 本次提交新增了CPU运行模式,适用于无GPU加速的场景。同时,优化了多语言支持,新增了日语、韩语、越南语等语言配置文件,并更新了README文档以反映新的运行模式和多语言支持。此外,修复了部分代码逻辑,提升了系统的稳定性和兼容性。
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
import os
|
||||
import sys
|
||||
import ctypes
|
||||
|
||||
import cv2
|
||||
import numpy as np
|
||||
from fsplit.filesplit import Filesplit
|
||||
|
||||
video_extensions = {
|
||||
'.mp4', '.m4a', '.m4v', '.f4v', '.f4a', '.m4b', '.m4r', '.f4b', '.mov',
|
||||
@@ -30,3 +36,24 @@ def is_video_or_image(filename):
|
||||
file_extension = os.path.splitext(filename)[-1].lower()
|
||||
# 检查扩展名是否在定义的视频或图片文件后缀集合中
|
||||
return file_extension in video_extensions or file_extension in image_extensions
|
||||
|
||||
def merge_big_file_if_not_exists(dir, file):
|
||||
if file not in os.listdir(dir):
|
||||
fs = Filesplit()
|
||||
fs.merge(input_dir=dir)
|
||||
|
||||
def get_readable_path(path):
|
||||
if sys.platform != 'win32':
|
||||
return path
|
||||
buf = ctypes.create_unicode_buffer(4096)
|
||||
ctypes.windll.kernel32.GetShortPathNameW(path, buf, 4096)
|
||||
return buf.value
|
||||
|
||||
def read_image(path):
|
||||
if os.path.getsize(path) > 100*1024*1024: # 100MB
|
||||
print(f"Image {path} is too large, skip")
|
||||
return None
|
||||
img = cv2.imdecode(np.fromfile(path, dtype=np.uint8), -1)
|
||||
if img is not None and img.shape[-1] == 4:
|
||||
img = cv2.cvtColor(img, cv2.COLOR_BGRA2BGR)
|
||||
return img
|
||||
Reference in New Issue
Block a user