feat(video): 添加关键帧提取与视频分割功能- 新增 ExtractKeyFrames 节点用于提取视频关键帧
- 新增 ExtractKeyFramesAndSplit 节点用于同时提取关键帧并分割视频
- 更新模块导入路径以适配重构后的目录结构- 修改节点分类名称为中文显示
- 移除旧版节点映射配置并集中管理导出节点
-优化输入参数定义方法签名
- 保留 WEB_DIRECTORY 配置支持前端资源加载
This commit is contained in:
guoliheng
2025-10-20 09:56:33 +08:00
parent a6bde15c69
commit c9db610c0b
4 changed files with 20 additions and 19 deletions
+17 -4
View File
@@ -1,3 +1,20 @@
from video_extract_key_frames.nodes import ExtractKeyFrames, ExtractKeyFramesAndSplit
# A dictionary that contains all nodes you want to export with their names
# NOTE: names should be globally unique
NODE_CLASS_MAPPINGS = {
"ExtractKeyFrames": ExtractKeyFrames,
"ExtractKeyFramesAndSplit": ExtractKeyFramesAndSplit,
}
# A dictionary that contains the friendly/humanly readable titles for the nodes
NODE_DISPLAY_NAME_MAPPINGS = {
"ExtractKeyFrames": "Extract Key Frames",
"ExtractKeyFramesAndSplit": "Extract Key Frames & Split Video",
}
WEB_DIRECTORY = "./web"
__all__ = [
"NODE_CLASS_MAPPINGS",
"NODE_DISPLAY_NAME_MAPPINGS",
@@ -7,7 +24,3 @@ __all__ = [
__author__ = """guyouyue"""
__email__ = "guyuoyue@gmail.com"
__version__ = "1.0.0"
from src.video_extract_key_frames.nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
WEB_DIRECTORY = "./web"
@@ -2,7 +2,7 @@
# 主要是各个节点的定义和业务逻辑
import folder_paths
from src.video_extract_key_frames.service import (
from video_extract_key_frames.service import (
extract_keyframes,
split_and_save_video_segments
)
@@ -15,7 +15,7 @@ class ExtractKeyFrames:
"""
@classmethod
def INPUT_TYPES(s):
def INPUT_TYPES(cls):
"""
定义节点所需输入参数的信息。
@@ -40,8 +40,8 @@ class ExtractKeyFrames:
RETURN_TYPES = ("IMAGE", "STRING", "INT")
RETURN_NAMES = ("KEYFRAMES", "indexes_string", "indexes_int")
CATEGORY = "ExtractKeyFrames(关键帧处理)"
FUNCTION = "execute"
CATEGORY = "ExtractKeyFrames"
def execute(self, image, threshold, merge_inter_frames, max_frames, similarity_method):
"""
@@ -172,15 +172,3 @@ class ExtractKeyFramesAndSplit:
return (keyframe_images, indexes_string, keyframe_indices, segment_files_str)
# A dictionary that contains all nodes you want to export with their names
# NOTE: names should be globally unique
NODE_CLASS_MAPPINGS = {
"ExtractKeyFrames": ExtractKeyFrames,
"ExtractKeyFramesAndSplit": ExtractKeyFramesAndSplit,
}
# A dictionary that contains the friendly/humanly readable titles for the nodes
NODE_DISPLAY_NAME_MAPPINGS = {
"ExtractKeyFrames": "Extract Key Frames",
"ExtractKeyFramesAndSplit": "Extract Key Frames & Split Video",
}