mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2025-12-24 20:24:34 +08:00
sorted() is needed around os.listdir for proper linux file sorting. The reason your files are not in order is that os.listdir() returns filenames in an arbitrary order (usually based on how they are stored in the file system's inode table), not alphabetically or numerically. On Windows, os.listdir sometimes appears sorted due to how NTFS works, but on Ubuntu (Linux), the raw directory listing is almost never sorted by name. The Fix You need to sort the list of files before iterating through them. Change this line: code Python for f in os.listdir(kwargs['video']): To this: code Python for f in sorted(os.listdir(kwargs['video'])):