Transcript of Cinema-Grade AI Face Swaps! Fully Automatic & Flawless Results with FLUX in ComfyUI
Video Transcript:
hello everyone today I'm thrilled to share a topic that many of you are very interested in face swapping but we're not talking about just any face swap we're talking about high quality face swapping based on the Flux Context model unlike traditional methods like PID or instant Ida which often show noticeable modeling artifacts things like oversampling around the eyes and eyebrows or that telltale plastic face look flux context completely avoids these issues the quality of each generated image is exceptionally high with no obvious FX model traces imagine finding a beautiful face you like with flux context you can swap it onto any character at any angle the face's angle can change constantly during the swapping process and there are no strict requirements for the subject's pose what's more the lighting rendition is absolutely stunning you'll see perfect blending even with complex lighting conditions on the target image let's dive into the workflow it might look simple but it contains a lot of powerful features first observe these two images one is our source face which remains unchanged and the other is our target character onto whom we will swap the face let's run it and see the final face swap effect as you can see the result is quite amazing even if the hair colors are a bit different the overall transition is incredibly natural isn't it we can try another one for instance this one where the hair color is more similar look how natural this becomes and it supports multiple angles let's try a non frontal face like this one which is a complete side profile see the face swap effect is still incredibly beautiful not only that if your target image has very complex lighting this workflow can perfectly inherit it take a look at this image you'll notice very distinct lighting on the face after swapping we still achieve a seamless fusion effect with beautiful overall lighting integration even though some of the original lighting on the swapped face might be removed the transition area ensures a perfect blend so how is this quality achieved the key lies in a specific element this image which is the face we want to swap is essentially pasted onto the target image's face then our flux model does its magic and swaps the face the magic here is powered by a Laura called Placeit you can think of it simply as a pasting Laura this is what the Placeit Laura page looks like there's a basic example although it's small showing an image pasted onto a character and the entire blending effect is perfectly restored this Laura is also quite small in file size let's look at its recommended settings Laura weight recommended 1 0 or 0 9 image format the image you're pasting should ideally be a square image overlay area should be aligned trigger word very simple it's just place it returning to our workflow we are ultimately processing this image I'm using the official Flux DVX model here I've also added tick cache because Flux Context's structure is similar to f so tick cache can be effective and many extensions are optimized for it crucially pay attention to the parameters for flux models we recommend setting it up like this it uses a dual encoder clip eye and our T5 encoder plus our V and right here we add our place it Laura below that is a standard flux workflow process we take the image directly perform a flux image scale to resize it after scaling we have a very simple prompt place it which aligns with our Laura's trigger word then we generate a latent image which is merged with our prompt conditions these are the official 25 settings for the negative prompt I'm using 0 here though you could use ng if you prefer but it's not strictly necessary in this context for the sampler we use 20 sampling steps a CFG scale of 10 the oiler sampler and the DPM SDE scheduler after decoding you get this amazing effect however despite its simplicity the main point is how this image is generated automatically many influencers discuss this Laura but they often use manual methods like photos or other techniques to paste images but mine is different it's automatically generated and we've tried so many examples you'll find that the results are consistently excellent we can try another one to confirm my statement for example look at this let's run it again see the result isn't it beautiful so this is not a forced technical solution it's actually very stable we've tried many examples all run live and you'll find that the generated results are consistently fantastic so how do we do this we mainly use two extensions 1 face analyze 2 auto crop face these are very skillful to use first let's clarify the two images this is the face to be swapped this is our target image this node is called face align or face alignment the key is who aligns with whom notice where my image from is connected it's connected to our source face image an image 2 is connected to our target image clearly I want to swap this face onto that person so we must align this face with that one specifically face part alignment there's also an analyze model which is the face analysis model we generally use insightface of course you can use Lib but it seems Lib isn't installed on running hub so we'll use insightface for the provider you can choose anything CPU is sufficient because insightface is very efficient some might ask what this does you might not see it clearly by just looking let me change an image to one that more clearly shows what align face does what face alignment is for for example this image look it has a significant difference from the face it's a complete side profile then we'll run it again and you might be able to see the effect you can probably see it now did you notice that the image rotated this means if you want to align this face with that face this image must be rotated like this then if you layer them together you'll find that the faces can overlap quite well so what does this face align solve it solves the angle problem next when we crop the face we won't crop from here we'll crop from there so we use two instances of auto crop face we directly crop this face you need to pay attention the first one is to crop the face from an already cropped image here we use a scale factor which determines how large the cropped face will be if you set it too small for example like this let's run it look at the effect the face is cropped so small pasting it like this would be meaningless right so this is used to set the size of the cropped area I recommend setting it to 5 0 or above I'll use 6 I forgot what I used just now remember these two values must be the same don't use 6 for the top and 3 for the bottom it won't paste correctly the cropped face generally encompasses the head area as you can see the benefit of this is that I can ensure the cropped face has a fixed aspect ratio there are many ratios here but I recommend choosing 1 to 1 when you choose 1 to 1 the cropped face will be square and this face will also be square now what we need to do is paste this face onto the target image for this we'll use a node called Image Paste Crop when you crop this face each crop will have an output one this output 1 is a data set what kind of data set it's a crop data set this crop data set contains both the size of the crop and its position similar to a bounding box and pay attention this node is very tricky to use your goal is to paste it onto this image so for the image input it must be the target image this remains unchanged and whom do you want to paste of course it's our source face image so it connects here the key is the crop data input which one do you connect this must be very clear my crop data is connected to this one meaning the crop data from the target image essentially I am scaling this image the source face to the same size as the target face and then pasting it at the same position as the target face and that becomes this so these nodes are the essence of this workflow many people might find it confusing therefore sometimes we indeed need some mathematical or programming mindset of course this can also be a bit smaller is this a bit too big I forgot what my previous setting was let's try 5 you also set this to 5 let's run it again I think 5 might give a better effect 6 is a bit too large because the more you cover the smaller the reference area becomes if you crop too little then issues like hair transition might arise so you just need to experiment with this yourself the main thing is to understand how this node generates the output alright that's all for today follow me to become someone who understands AI
Cinema-Grade AI Face Swaps! Fully Automatic & Flawless Results with FLUX in ComfyUI
Channel: Veteran AI
Share transcript:
Want to generate another YouTube transcript?
Enter a YouTube URL below to generate a new transcript.