Sprite DX - Stage 3 - Adding Custom ComfyUI Nodes


I’m codifying the exercise we did in previous post into a ComfyUI custom node.
Node 1 - Video Downloader
First node we will create is a video downloader. Right now, when Fal.ai generates a video it provides a URL to download that video file. We now need to download the video into local drive so that we can run it through PySceneDetect node we will create later down the line.
Source code: https://github.com/sprited-ai/sprited-comfyui-nodes/blob/main/src/sprited_nodes/download_video.py
It basically downloads the image url given by the Fal.ai and just saves the file into a tmp folder, so that we can pick it up later.
All good so far.
Node 2 - Shot Splitter
Now, we create a node that uses PySceneDetector approach discussed in previous post to split the video into multiple videos each containing distinct shots.
Source code: https://github.com/sprited-ai/sprited-comfyui-nodes/blob/main/src/sprited_nodes/split_shots.py
So far so good. Let’s move on to loop detection.
Node 3 - Loop Detection
Finally, we use the post-processing approach discussed previously, to extract meaningful loops from the video and save them
Source code: https://github.com/sprited-ai/sprited-comfyui-nodes/blob/main/src/sprited_nodes/extract_loop.py
Results
Results can be seen in the previous post.
Conclusion
ComfyUI Custom Nodes sure has some learning curve but it was relatively straightforward to add custom nodes. We now have Stage 3 of SpriteDX pipeline in ComfyUI.
Next Step?
It is still rough round the edges. I will need to test it further to make sure stage 3 works with good success rate.
Find replacement for Fal.ai. It is little too expensive. It would be good to be able to use many providers and switch between them on-demand.
Next, we would want to convert the mp4 files into frames and run it through background removal algorithm.
—Sprited Dev
Subscribe to my newsletter
Read articles from Sprited Dev directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
