feat: add fps input to PrismAudioFeatureExtractor
Exposes the video frame rate as an optional input (default 30). Correct FPS ensures accurate temporal frame sampling in VideoPrism and Synchformer feature extraction. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -120,6 +120,7 @@ class PrismAudioFeatureExtractor:
|
|||||||
"caption_cot": ("STRING", {"default": "", "multiline": True, "tooltip": "Chain-of-thought description"}),
|
"caption_cot": ("STRING", {"default": "", "multiline": True, "tooltip": "Chain-of-thought description"}),
|
||||||
},
|
},
|
||||||
"optional": {
|
"optional": {
|
||||||
|
"fps": ("FLOAT", {"default": 30.0, "min": 1.0, "max": 120.0, "step": 0.001, "tooltip": "Frame rate of the input video. Match this to your source (e.g. 24, 25, 30, 60). Affects temporal sampling in feature extraction."}),
|
||||||
"python_env": ("STRING", {"default": "python", "tooltip": "Path to python binary with JAX/TF. Leave as 'python' to auto-install a managed venv on first use."}),
|
"python_env": ("STRING", {"default": "python", "tooltip": "Path to python binary with JAX/TF. Leave as 'python' to auto-install a managed venv on first use."}),
|
||||||
"cache_dir": ("STRING", {"default": "", "tooltip": "Directory to cache extracted features. Empty = temp dir"}),
|
"cache_dir": ("STRING", {"default": "", "tooltip": "Directory to cache extracted features. Empty = temp dir"}),
|
||||||
"synchformer_ckpt": ("STRING", {"default": "", "tooltip": "Path to synchformer checkpoint (auto-resolved if empty)"}),
|
"synchformer_ckpt": ("STRING", {"default": "", "tooltip": "Path to synchformer checkpoint (auto-resolved if empty)"}),
|
||||||
@@ -131,7 +132,7 @@ class PrismAudioFeatureExtractor:
|
|||||||
FUNCTION = "extract_features"
|
FUNCTION = "extract_features"
|
||||||
CATEGORY = PRISMAUDIO_CATEGORY
|
CATEGORY = PRISMAUDIO_CATEGORY
|
||||||
|
|
||||||
def extract_features(self, video, caption_cot, python_env="python", cache_dir="", synchformer_ckpt=""):
|
def extract_features(self, video, caption_cot, fps=30.0, python_env="python", cache_dir="", synchformer_ckpt=""):
|
||||||
# Resolve python binary — auto-install managed venv if using default
|
# Resolve python binary — auto-install managed venv if using default
|
||||||
if python_env == "python":
|
if python_env == "python":
|
||||||
python_env = _ensure_extract_env()
|
python_env = _ensure_extract_env()
|
||||||
@@ -152,7 +153,7 @@ class PrismAudioFeatureExtractor:
|
|||||||
# Save video to temp file
|
# Save video to temp file
|
||||||
with tempfile.NamedTemporaryFile(suffix=".mp4", delete=False) as tmp:
|
with tempfile.NamedTemporaryFile(suffix=".mp4", delete=False) as tmp:
|
||||||
tmp_video = tmp.name
|
tmp_video = tmp.name
|
||||||
_save_video_tensor_to_mp4(video, tmp_video)
|
_save_video_tensor_to_mp4(video, tmp_video, fps=fps)
|
||||||
|
|
||||||
# Build subprocess command
|
# Build subprocess command
|
||||||
script_path = os.path.join(
|
script_path = os.path.join(
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
{"name": "features", "type": "PRISMAUDIO_FEATURES", "links": [4], "slot_index": 0}
|
{"name": "features", "type": "PRISMAUDIO_FEATURES", "links": [4], "slot_index": 0}
|
||||||
],
|
],
|
||||||
"properties": {"Node name for S&R": "PrismAudioFeatureExtractor"},
|
"properties": {"Node name for S&R": "PrismAudioFeatureExtractor"},
|
||||||
"widgets_values": ["describe the video in detail", "python", "", ""]
|
"widgets_values": ["describe the video in detail", 30.0, "python", "", ""]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 4,
|
"id": 4,
|
||||||
|
|||||||
Reference in New Issue
Block a user