Video Face Swap Made Easy! ComfyUI
ฝัง
- เผยแพร่เมื่อ 6 ก.ย. 2024
- DM/comment for question or your experiential needs. ComfyUI, combined with stock or your own videos, can transform your storyboarding and video projects. Discover the magic of seamless face swapping to align every video perfectly with your creative vision. Whether you're crafting pitches or bringing stories to life, our step-by-step guide makes it easy for you to maintain visual consistency across your videos. Perfect for filmmakers, content creators, and visual artists who aspire to elevate their work with minimal effort. Subscribe and unlock the full potential of your storytelling today! 🌟🎬✨
~WORKFLOW:~
Click the Download button to download the image and then drag the image to your ComfyUI to get this workflow:
github.com/cre...
To preview, go here... and if the download button is working you can download from here too:
comfyworkflows...
~NODES~
REACTOR:github.com/Gou...
LOAD VIDEOgithub.com/Nuk...
~MODELS~
inswapper_128.onnxretinaface_resnet50
codeformer.pthRealESRGAN_x2plus.pth
(optional for upscaling image)
Delete the top nodes for the face swap, only here as reference.
perfectly working. when swapping face in videos keep "source_face_index" to 0 in Reactor node.
Thanks bro.
Glad it helped. Source is which face to pick. If there were two people in the video, 0 is the one in the left and 1 would be the one on the right.
all tuts from reactor, doing the easy way, but none show how dealing with object between face hands oclussions or masking.
You can try small segments when an object crosses vs longer. Otherwise the goal would be to create a clip with the face clear using and hacky technique then run a face swap and add back the missing object on another layer. Advances happen monthly and there could always be a better solution, keep looking and researching.
Bro, please help @Creator Brew, the workflow provided says that the "Save Node" is missing, and when I go to Installed missing custom nodes, I dont' find any nodes to be installed, any help? any node replacement for "save node" node?
The save video node isn't working. Could you please help?
Great video - this workflow did work for me a week ago but now I'm receiving an issue with the save video. I had N-Suite, which worked fine. What's the issue here?
Do you have any idea the "upload button" isn't shown ? also Animdiff is not installed
also maybe you now have to use the "local_url" ? but i don't get what it's supposed to be
thx in advance
It isn't using Animdiff, are you sure you are using the right workflow? Also, checkout photoshop.adobe.com it's gen image online lets you use a reference image, which will act much like this.
Doesn't work. You skipped too many steps in the tutorial which makes it impossible to follow you.
There are 4 nodes in this whole workflow, you can see them here: th-cam.com/video/QOWbm4IgvFM/w-d-xo.htmlsi=zDnjXH2VO7BMkYgH&t=146 and you can download the workflow here without doing anything: github.com/creatorbrew/workflows/blob/main/video_face_swap.png So exactly what issue are you having?
1. Have you loaded the required nodes? (load the workflow and then go to the Manager and click Install Missing Nodes) 2. Downloaded the models 3. Have an up-to-date version of ComfyUI 4. Restarted ComfyUi after doing 1, 2, & 3.What exactly is your issues and what steps have you taken so far? Thanks.
thanks for sharing; by any chance, do you know why reactore node can not be installed? I tried the manager, installed, desintaled, re-installed, updated all the nodesbut i still get this error: (IMPORT FAILED) ReActor Node for ComfyUI
Here's a way to start to see if there is a conflict. Download the Portable Comfyui. Install Manager. And immediately install reactor. The restart. If Reactor shows up then you are on the right track to fixing.
There can be a node conflict, or an update that is needed.
I had the same Problem, i instaled it manual not with the Manager, worked for me
I have the same problem I get a missing node notice "Save video" and previously I had the problem of "reactor N node" I don't know how I did it, but I was able to solve it with the "reactor" gith hub page but "save video" I can't
The problem is with ComfyUI-N-Nodes ( where the missing save video node lives)
Installing ComfyUI-N-Nodes will trash your ComfyUI causing startup to abort - at least on my updated Linux system
### N-Suite Revision: ab4af9de
Current version of packaging: 24.1
Version of cpuinfo: Not found
Current version of git: 3.1.43
Current version of moviepy: 1.0.3
Current version of cv2: 4.10.0
Current version of skbuild: 0.18.0
Version of typing: Not found
Current version of diskcache: 5.6.3
fish: Job 1, 'python main.py' terminated by signal SIGILL (Illegal instruction)
To fix this so you can start ComfyUI again
remove the following :
Delete the ComfyUI-N-Nodes folder in custom_nodes (You might only have this - this is the one that fixed it when removed)
Delete the comfyui-n-nodes folder in ComfyUI\web\extensions
Delete the n-styles.csv and n-styles.csv.backup file in ComfyUI\styles
Delete the GPTcheckpoints folder in ComfyUI\models
@@jamz310 i have none of the mentoned folders or files and still get the "missing save video node" message. Any ideas?
So then for longer video should I put higher number for batch_size? or leave it at 0?
leave at 0, but, for best results you can do X number of frames at a time. Like setting batch to 60 will do the first 60 frames. Setting the start time to 30 will do the next 30 frames and so on. This works best not throwing a whole video into it, but picking out the good segments to batch and moving forward. Good= a person is looking at camera and about to turn. That's one batch. The person begins to turn, that's the second batch. And so on.
when i run it nothing happens, face is not switching just upscales the image... any ideas?
Check face index - the template default is set to 1, but if there is only 1 face it should be 0
You did not really go over how to resize...you just point at it and go there it is....but when you do a drop to width or height...they share the same number even if you change the drop down. I believe it's a bit more than that using the outputs of the width and height but not sure how to plug it in with in the pipeline.
You can resize using an upscale node. For width and height with the reactor node it looks at an image and gets an image by the position it is in within the image, then it applies the image to another image, in this case a video frame via the position selected within the destination image. The width and height in the destination image doesn’t matter since it is a face to face. Though the destination image’s face is the structure which the new face is being placed on and because of this there is no restructuring of the width snd height of the face. So other than upscaling is there something else you are referring too?
resize_by:
Select how to resize frames - 'none', 'height', or 'width'.
size:
Target size if resizing by height or width.
selecting "none" is the easiest choice. But you can select by WIDTH or by HEIGHT and then type in the corresponding value.
@@Nibot2023 Did this answer what you are asking? Did you try this first to do the experiment first hand?
@023 The specific of only one dimension is because it is automatically calculating the other dimension to keep things proportional. A good place to start is always visiting the github page for a Node because the author usually has extra info: github.com/Nuked88/ComfyUI-N-Nodes
You'll find the answer of:
resize_by: Select how to resize frames - 'none', 'height', or 'width'.
size: Target size if resizing by height or width.
I know there are a lot of adjustments to get the tailored workflow for you, the same is true for everyone coming to any video. The best learning strategy is to watch a video, do exactly what is there first. Quickly. Then to try what you need to do. If that doesn't work, then with ComfyUI or Automatic 1111 searching the web for the "node" type you are using will lead to github where the authors usually have more documentation. Of course ask me (or any video maker); but sometimes the answers are also out on git. I hope this helps you.
@@creatorbrew Thanks for taking the time to respond. I will check out the link that you sent. I am just trying different things and push things to see different results.
I dont have a button to upload a video to the LoadVideo node, drag and drop doesnt work either.
Hi- are you using the same node from the downloaded workflow? Did you up grade comfyui and updated the nodes and the restarted and after restart quit and restart manually? If you can share a screen shot it will help postimages.org
Yeah it's all the same. I tried everything. Node just has no upload button, path doesn't work, don't have any ability to push a video to this node at all. I'm at work but can send a photo later
also try a fresh portable version and just the video mode loading. Sometimes there are node conflicts, starting with the portable and the node in question helps with troubleshooting.
Hi there. Amazing results would love to try. Have never used a github workflow before. Could you point me in the direction of a video that might help me learn so i can use your workflow? Thank you Adrian
To get the workflow head over here: github.com/creatorbrew/workflows/blob/main/video_face_swap.png
There is a downward arrow button ontop to download this image. You then take this image and drag it on to the ComfyUI interface to load the workflow.
Here are two general videos about using GitHub
th-cam.com/video/xAJ3Bb6CdaA/w-d-xo.html
th-cam.com/video/sD65M0V3YUs/w-d-xo.html
To get ComfyUI:
1) Go here: github.com/comfyanonymous/ComfyUI
2) Click on the hyperlink "Direct link to download"
3) Unzip it
4) Click Install Manager
5) Run
6) Follow the link for getting the Face Reactor set up
In this case, you don't need to really use Git other than like a web page for reading instructions and clicking links to download
T@@creatorbrew Thanks thats really kind of you to reply.😀
@@creatorbrew sorry to be a pain but when i unzip the file there is no install manager file? Could you point me in the right direction please? Thx
replicate.com/guides/comfyui/comfyui-manager/#:~:text=nodes%20and%20weights.-,Install%20the%20ComfyUI%20manager,nodes%20directory%3A%20ComfyUI%2Fcustom_nodes%20.&text=You%20should%20now%20have%20a,are%20a%20few%20extra%20steps. I have not used this url, but take a quick look online for “install ComfyUI manager” After you have it installed restart comfyui
Is there a note for a counter so I can adjust the start frame with each run?
images_limit: Limit number of frames to extract.
starting_frame: Select which frame to start from.
You can wire that into an equation, changing the starting_frame with each run.
Thank you very much for the answer, but with which notes do I do this?
@@-MM_TV- you would connect it coming out of the load video. To intercept the start frame value and increment it per run, if I understand what you are trying to do.
Thanks for sharing. FYI your workflow link in the description is broken
Thank you, it looks like the DOWNLOAD BUTTON on the comfyuiworkflows.com site is not working. Here's another link: github.com/creatorbrew/workflows/blob/main/video_face_swap.png Download the image with the download button, upper right above the image, and then drag the image to your Comfyui to import the workflow. have fun!
@@creatorbrew ok, si sicedio pero como es posible eso, de donde salio el flujo de trabajo?
The workflow works well. But I am not able to see nor save the video. From the SaveVideo node
I got same issue. SaveVideo node missed too
@@Kennyyoung-qz5qg Same here, any solution?
@@MaghrabyANO same for me
So, for people who (like me) are having problems with the SaveVideo node (btw, I'm using a MacBook Pro m3, I've reinstalled the git nodes several times and in different ways, but that particular node is still not available to me), I swapped the SaveVideo node for the Save Gif (MTB) node and it works! Of course, I don't want a gif as output, so I'm still trying to find another solution or node to save a video, but the workflow is working, it's just this node that isn't working for some stupid reason.
@@jonattaspoltronieri259 isn't working for me either. any solutions yet?
hi thank you iv had a problem as video over 1min long will not work ?
You have to batch long videos, part of that node. Or cut up the mp4 file.
Doing 3 seconds at a time works best if a video has lots of changes, like a quick head turn. To help the tool of AI out, feed it similar cuts.
I like the 4080 good price, enough vram
actually, make sure to get the Super. Cheaper and a little better. 4070 TI Super or 4080 Super
Thank you. When loading the graph, the following node types were not found:ComfyUI-N-Nodes
I installed it, did the comfyui update and got this message, I ran it through google colab and google drive.
@@lilillllii246 With Comfyui, are you on a Mac or PC? If on a PC, download the self contained package. Drag in the Workflow. Run the "Manager" bat file. Then go under Manager and install the missing nodes. Then restart Comfyui and it all will work.
Let me know if you aren't on PC or you are needing to run it through colab.
Standalone / Portable for Windows
github.com/comfyanonymous/ComfyUI
Manager
github.com/ltdrdata/ComfyUI-Manager
N-Nodes (but install this through the Manager)
github.com/Nuked88/ComfyUI-N-Nodes
@@creatorbrew Thank you. I use google colab. not loca pc. not possible in google colab?
@@lilillllii246 It's possible, just more to look into. You have to have the Nuke project's nodes installed into the ComfyUI custom_nodes folder. Is N-Suite showing up there?
@@creatorbrew I have the same problem. ComfyUI-N-Nodes is installed (using the manager), but when I startup the workflow, and the following message shows up: "When loading the graph, the following node types were not found: - ComfyUI-N-Nodes.
Nodes that have failed to load will show as red on the graph."
And that node shows as (undefined) and red on the graph.
Any ideas how to fix this?
it looks like you are using a mac. Yet how come you are using a 4080 GPU?
Great observation! I run comfyui on a gaming desktop, and now also as an AWS instance, then can access it locally via ip address. When you launch comfyui portable on a pc you can edit the bat file to listen on local host, an ip, url, and port.
Some days easier to boot pc in other side of desk and focus on creation on my Mac.
@@creatorbrew brilliant bro! I have the same needs but cant get this working. Tried using wireguard but because it's just a remote desktop, basically you are still using the PC😂 Will you make a tutorial of how do you do this? I'd definitely check on that!
Sure.
@@creatorbrew thx a lot!
Hi, i have and issue and couldn't find anything on github or reddit. when i start comfyUI it shows the savevideo node as missing and tells me that it couldn't findit. i checked and it isn't in the custom nodes directory. Is there a fix or way to install it manually by any chance?
update node name in the n package, it's renamed
@@ChristofferNordvall i‘ll look into it. 🙏🏻
@@ChristofferNordvall Hey i tried to figure it out but am lost. What is the n package? is that a file name?
@@ChristofferNordvall ok i found the N-Nodes, which file needs to be renamed? there is no save video file
how do we upload videos of 3 mins long HD it's always file to big.
Do u know a way to circumcize this?
An alternative would be to first cut up the video in small fragments and then batch ur workflow but how can we do this in one go?
Cut down to manageable parts. 30 seconds each. Try.
For automation if it isn’t taking the 3min the only way to automate is with a script. I written a platform for such tasks, but only as a corporate product.
The workflow works best with 15 sec -30sec clips. Where the head isn’t doing drastic moves between. Example would be head turn is one clip and a walk is another - to get the best consistency.
@@creatorbrew i could use something like ffmpeg to cut a video into frames wich is cli so good for automation, but i don't know how to iterate over all the frames in the folder
@@leandrogoethals6599you can cut video for free using Adobe express tools online. If you want to cut the frames then you need another input node other than the load video node in this video.
If you are using the load video mode, then you can right click it and convert the start frame into an input. Then the start video can be wired to a new group of nodes to check for the condition and offset the start. The efficiency nodes might work for what you are doing,
@@leandrogoethals6599 What are you trying to achieve? Is this for an experiment or for work? If for work I'll have a different answer than below:
FFMP is for cutting the individual frames, but this workflow is about a Load Video node that takes in video. If you use this node and want a free video slider, than Adobe Express can do that www.adobe.com/express/feature/video/editor
Also, you can right click the Load Video node and then convert the start frame to an input field (something that can be wired) and use the custom Efficiency Nodes or other group to run an IF/Then condition and step up the start frame with each pass, this by going through the one video start segments. For something with multiple videos or frames then another strategy would be needed for multiple videos, says something like creating the name of the video files as an increment plus or with frames it would be using the other load video node that takes in frames instead of video and offsetting the frame number.
The videos are being saved, so in the backend you would need to take all those videos and splice together with FFMPEG or other CLI way OR loop the formation of the video to include the previous one and extending it.
If this is a company project, my approach would be different, I might use the URL loader for a video and then I would write a thin front end to handle the processing of things, straight javascript or react, to make a clean interface. I've done this with a platform I made on top of Stable Diffusion to automate task and do other things.
@@creatorbrew So what would be the benefit to load video instead of batch individual frames?
Like coherence?
Could u make a tuturial on this i thinkthat would have a lot of viewsi think
Upload upload video input not working
Are you using this Node for loading video?
github.com/Nuked88/ComfyUI-N-Nodes
if it isn't working at all, it has a conflict with AnimDiff (disable that and try). Make sure to restart Comfyui after installing or after disabling.
@@creatorbrew now showing input 👍
UR GPU?
RTX 2060, RTX 4050 and RTX 4080
@@creatorbrew i wanna start using a.i like SD.which one should i go? 3090 4060ti 16 or 4080?