58 lines
2.1 KiB
Python
58 lines
2.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Scan LTX Director output videos and map them to scenes.
|
|
|
|
Usage: python3 scan_videos.py [output_dir]
|
|
|
|
Extracts from each LTX_Director_*.mp4:
|
|
- Scene number (from start_frame in prompt metadata)
|
|
- Model type (fp8+LoRAs, Q4, or unknown)
|
|
- Resolution and duration
|
|
- Whether Transition LoRA is wired (LoraLoaderModelOnly in prompt)
|
|
- Whether zhuanchang trigger is present
|
|
- File size
|
|
"""
|
|
|
|
import subprocess, os, re, sys
|
|
|
|
outdir = sys.argv[1] if len(sys.argv) > 1 else os.path.expanduser("~/comfy-ui/output/video")
|
|
files = sorted([f for f in os.listdir(outdir) if f.startswith("LTX_Director_") and f.endswith(".mp4")])
|
|
|
|
print(f"{'File':40s} | {'Resolution':20s} | {'Scene':10s} | {'Model':12s} | {'Trans':6s} | {'zhuanchang':10s} | {'Size':>8s}")
|
|
print("-" * 120)
|
|
|
|
for f in files:
|
|
path = os.path.join(outdir, f)
|
|
|
|
# Resolution and duration
|
|
r = subprocess.run(["ffprobe", "-v", "quiet", "-select_streams", "v:0",
|
|
"-show_entries", "stream=width,height,duration",
|
|
"-of", "csv=p=0", path], capture_output=True, text=True)
|
|
res = r.stdout.strip()
|
|
|
|
# Prompt metadata
|
|
r2 = subprocess.run(["ffprobe", "-v", "quiet", "-show_entries", "format_tags=prompt",
|
|
"-of", "csv=p=0", path], capture_output=True, text=True)
|
|
prompt_raw = r2.stdout.strip()
|
|
|
|
# Scene from imageFile
|
|
img_match = re.search(r"imageFile.*?ltx_start_frame_(\d+)", prompt_raw)
|
|
scene = f"Scene_{img_match.group(1)}" if img_match else "?"
|
|
|
|
# Model type
|
|
if "UNETLoader" in prompt_raw and "LTX2LoraLoaderAdvanced" in prompt_raw:
|
|
model = "fp8+LoRAs"
|
|
elif "UnetLoaderGGUF" in prompt_raw:
|
|
model = "Q4"
|
|
else:
|
|
model = "?"
|
|
|
|
# Transition LoRA
|
|
has_trans = "LoraLoaderModelOnly" in prompt_raw
|
|
has_zhuanchang = "zhuanchang" in prompt_raw
|
|
|
|
# File size
|
|
size = os.path.getsize(path)
|
|
size_str = f"{size/1024:.0f}KB"
|
|
|
|
print(f"{f:40s} | {res:20s} | {scene:10s} | {model:12s} | {str(has_trans):6s} | {str(has_zhuanchang):10s} | {size_str:>8s}")
|