MrDeepFakes Forums

Some content may not be available to Guests. Consider registering an account to enjoy unrestricted access to guides, support and tools

  • We are looking for community members who are intested in helping out. See our HELP WANTED post.

[GUIDE] Compositing, Post Processing, Video Editing Guides

TMBDF

Moderator | Deepfake Creator | Guide maintainer
Staff member
Moderator
Verified Video Creator
DFL 2.0 new whole face face type mode requires manual masking but also in some cases you might wanna do it manually for better control of final result and to add extra layer or refinement (such as color correction, sharpening, blur, grain).

Here are a couple short video tutorials that show you how you can use software such as Adobe After Effects, Magix Vegas Pro or Davinci Resolve (free) to composite result face onto data_dst.

Davinci Resolve - @iperov tutorial on compositing result face onto data_dst using result_mask:
 [video=youtube]

After Effects: coming soon

Vegas: coming soon
 

iperov

DF Enthusiast
Developer
AE tutorial how to recover background when dst face is wider than src
(in Russian)
 

mrsdeepfake7

DF Vagrant
iperov said:
AE tutorial how to recover background when dst face is wider than src
(in Russian)


Thanks for this.

Does anyone have tutorials on how to do the basic steps import the mask into AE? I can't seem to get just the face with a transparent background (even when using the alpha matte), I'm missing a simple step.
 

lazarus

DF Vagrant
mrsdeepfake7 said:
iperov said:
AE tutorial how to recover background when dst face is wider than src
(in Russian)


Thanks for this.

Does anyone have tutorials on how to do the basic steps import the mask into AE? I can't seem to get just the face with a transparent background (even when using the alpha matte), I'm missing a simple step.


Simpy import both of result and result_mask clips into a new comp, place result_mask clip above result clip and then change the track matte of result clip from none to luma matte
 
hey, I'm trying to do this



but somehow, my result_mask.mov and result.mov is not shown properly on Resolve.
Can anyone figure out why? (I'm using .jpg for my project, can that be the cause of the problem?)
 

CelebFaker

DF Vagrant
pineapplekingdom said:
hey, I'm trying to do this



but somehow, my result_mask.mov and result.mov is not shown properly on Resolve.
Can anyone figure out why? (I'm using .jpg for my project, can that be the cause of the problem?)


I found out that removing --lossless in the merged to mp4/avi bat will make the result_mask readable in resolve.
 
CelebFaker said:
pineapplekingdom said:
hey, I'm trying to do this



but somehow, my result_mask.mov and result.mov is not shown properly on Resolve.
Can anyone figure out why? (I'm using .jpg for my project, can that be the cause of the problem?)


I found out that removing --lossless in the merged to mp4/avi bat will make the result_mask readable in resolve.


God, Thanks so much!
 
@"CelebFaker"
Hey, may I ask you 1 more question? In the 30-March build I'm using, I couldn't find the
"result_mask.mov" shown in the tutorial vid. In previous releases, I believe this was created
whenever I run the "merge SAEHD" batch, but seems to be gone now.
Do you have any ideas where it is now?
 

CelebFaker

DF Vagrant
pineapplekingdom said:
@"CelebFaker"
Hey, may I ask you 1 more question? In the 30-March build I'm using, I couldn't find the
"result_mask.mov" shown in the tutorial vid. In previous releases, I believe this was created
whenever I run the "merge SAEHD" batch, but seems to be gone now.
Do you have any ideas where it is now?

I dont have that specific build but the result_mask is created with result video at the same time when you run merged to mp4/avi bat
 

devilish1

DF Vagrant
Verified Video Creator
pineapplekingdom said:
@"CelebFaker"
Hey, may I ask you 1 more question? In the 30-March build I'm using, I couldn't find the
"result_mask.mov" shown in the tutorial vid. In previous releases, I believe this was created
whenever I run the "merge SAEHD" batch, but seems to be gone now.
Do you have any ideas where it is now?

"result_mask" is generated when you run "8) merged to avi, mp4, or the lossless versions"
 
@"devilish1"
@"CelebFaker"

Hey guys, thanks for your help, I finally fixed the problem.

Please look at the codes below. This is how the
8) merged to mp4
batch looks like (in 30-March build), when you right click and edit it.

-------------------------------------------------------------
@echo off
call _internal\setenv.bat

"%PYTHON_EXECUTABLE%" "%DFL_ROOT%\main.py" videoed video-from-sequence ^
--input-dir "%WORKSPACE%\data_dst\merged" ^
--output-file "%WORKSPACE%\result.mp4" ^
--reference-file "%WORKSPACE%\data_dst.*" ^
--include-audio

"%PYTHON_EXECUTABLE%" "%DFL_ROOT%\main.py" videoed video-from-sequence ^
--input-dir "%WORKSPACE%\data_dst\merged_mask" ^
--output-file "%WORKSPACE%\result_mask.mp4" ^
--reference-file "%WORKSPACE%\data_dst.*" ^
--lossless

pause

-------------------------------------------------------------

Now, as I wrote before, somehow the "result.mp4" and "result_mask.mp4"
generated by this batch cannot be seen from Da Vinci Resolve (latest version),

Simply deleting the "--lossless" written at the bottom of the code (as @"CelebFaker" found out),
would actually solve half of the the problem, by making the "result.mp4" seen from Resolve,
but this time, you'll get another problem; "result_mask.mp4" is not generated (This is why I said "half" of the problem is solved)

So this is how I fixed the problem.

-------------------------------------------------------------
@echo off
call _internal\setenv.bat

"%PYTHON_EXECUTABLE%" "%DFL_ROOT%\main.py" videoed video-from-sequence ^
--input-dir "%WORKSPACE%\data_dst\merged" ^
--output-file "%WORKSPACE%\result.mp4" ^
--reference-file "%WORKSPACE%\data_dst.*" ^
--include-audio

"%PYTHON_EXECUTABLE%" "%DFL_ROOT%\main.py" videoed video-from-sequence ^
--input-dir "%WORKSPACE%\data_dst\merged_mask" ^
--output-file "%WORKSPACE%\result_mask.mp4" ^
--reference-file "%WORKSPACE%\data_dst.*" ^
--include-audio

pause

-------------------------------------------------------------

Instead of deleting "--lossless", I rewrote it to "--include-audio" like the code above it.
Now I get 2 files generated properly, and they both can be seen from Resolve.

I bet there's an smarter fix though. The above fix I found out will pause the batch process
after "result.mp4" has been generated, and you'll have to press enter key
to make the batch process go on. Also, you'll get an unneeded audio for "result_mask.mp4".

I hope someone could refine this!
 

devilish1

DF Vagrant
Verified Video Creator
@"pineapplekingdom"

There should be 4 merging options

8) merged to avi
8) merged to mov lossless
8) merged to mp4 lossless
8) merged to mp4

the bottom one "8) merged to mp4" is what I use and am able to import to both Resolve and Adobe no problem.  Had issues with the lossless one.  Renaming wont help, just use the bottom one!!!  If you've been messing with code at all, maybe just backup the models and re-download the March 30th model.  There is also a video that covers importing to resolve...  
https://mrdeepfakes.com/forums/thre...s-pro-and-after-effects?highlight=compositing
 
@"devilish1"
Hmm, well none of them worked for me, until I rewrote the code.

In the linked tutorial video, the needed videos can be seen from Da Vinci
before being imported, but my (and probably @celebfaker 's ) problem was that the
videos were not shown in the first place :(
(You can view the file from explorer, but can't be seen from Da Vinci)

Thanks anyway for your advice. I'm downloading the latest build now,
hoping everything works fine without any coding this time.
 

CelebFaker

DF Vagrant
Can you please provide a tutorial video for the head replace composing in DaVinci? I dont know how to sort layers to hide the dst face and make the result head appear with masks.
 

Shallowfayk

DF Vagrant
First off I always edit my dst files  in AE. I import the movie, edit it for the best faces and Render the images. If the movie has a high frame rate such as 60fps or even 30fps and you don’t want to render so many frames..do this: 

Import the DST movie into AE. Drag the movie down to the create comp button. Once the comp is made go into edit>composition settings and change the comp to your desired frame rate. (I like 24fps) Then I do my editing and render. Make sure to save your AE file. I usually save it in the dst folder.

Do all your extracting, training, and merging.

Now open up the AE file you saved. Import the merged and merged_mask footage into your project. Make sure they are the same FPS as your dst comp. 

Drag both sequences into the edited dst comp that you made earlier. Masked footage on top merged footage second and all the other footage below.  In the effects tab add these effects (in this order) to your Merged_mask footage.

Set matte
Simple choker
Gaussian blur

Set Matte: change it to luminance. This will take out all the black and leave you with just the white face mask. 

Now go to your merged layer which is the second sequence in the comp. On the sequence click on the track matte drop down and change it to alpha. Once you do this you will see the merged_masked layer turn off. Turn it back on so you can see the white mask again. I do this with the white mask on so I can see the edges of the matte best.
Now go to your blur and simple choker effects. I play with these till I get it just right. I usually blur somewhere between 15-25 and I choke from 6-20 but do what works best for you. Keep turning the masked layer on and off while you work to get your desired result. Once you get it where you want turn the masked layer off.

In addition I also select all my effects in the sequence and create a user preset. That way I only have to click on that to add all these effects.

Hope this helps. I’m sure there are other ways to do this but I find this works best for me. If you have any questions or comments please let me know.  
Thanks
 

vehv

DF Vagrant
lazarus said:
mrsdeepfake7 said:
iperov said:
AE tutorial how to recover background when dst face is wider than src
(in Russian)


Thanks for this.

Does anyone have tutorials on how to do the basic steps import the mask into AE? I can't seem to get just the face with a transparent background (even when using the alpha matte), I'm missing a simple step.


Simpy import both of result and result_mask clips into a new comp, place result_mask clip above result clip and then change the track matte of result clip from none to luma matte

So I did this but the result_mask isnt aligned properly compared to face movements in data_dst. Is there some trick to align it properly or do I have to do it manually? Or am I doing something completely wrong here? 

Edit
I figured it out, data_dst was somehow 11 milliseconds longer than result and it was super easy to fix. Now I feel a bit dumb lol.
 

Shallowfayk

DF Vagrant
vehv said:
lazarus said:
mrsdeepfake7 said:
iperov said:
AE tutorial how to recover background when dst face is wider than src
(in Russian)


Thanks for this.

Does anyone have tutorials on how to do the basic steps import the mask into AE? I can't seem to get just the face with a transparent background (even when using the alpha matte), I'm missing a simple step.


Simpy import both of result and result_mask clips into a new comp, place result_mask clip above result clip and then change the track matte of result clip from none to luma matte

So I did this but the result_mask isnt aligned properly compared to face movements in data_dst. Is there some trick to align it properly or do I have to do it manually? Or am I doing something completely wrong here? 

Edit
I figured it out, data_dst was somehow 11 milliseconds longer than result and it was super easy to fix. Now I feel a bit dumb lol.


Hey, yes that can be an issue. I'm assuming you are rendering frames from AE to make your dst files.  More than likely the mp4 file you used had a frame rate of 29.997 or 23.999 or something like that. Remember : After you import your mp4 you have to change its frame rate to the nearest whole number
( Interpret footage ctl + alt +G ) like 24 if its 23.99 or 30 if its 29.977 ect.. That way your comp will render things out right. Also you have to make sure the frames you import have the same fps as the original comp. Your AE might be set to a different frame rate as the mp4. Basically if things don't match... check the frames rates on the comp and mp4
 
lazarus said:
mrsdeepfake7 said:
iperov said:
AE tutorial how to recover background when dst face is wider than src
(in Russian)


Thanks for this.

Does anyone have tutorials on how to do the basic steps import the mask into AE? I can't seem to get just the face with a transparent background (even when using the alpha matte), I'm missing a simple step.


Simpy import both of result and result_mask clips into a new comp, place result_mask clip above result clip and then change the track matte of result clip from none to luma matte



OMG thank you i was searching and googling how to import dst mask ::) thank you so much for this info.
 
Shallowfayk said:
First off I always edit my dst files  in AE. I import the movie, edit it for the best faces and Render the images. If the movie has a high frame rate such as 60fps or even 30fps and you don’t want to render so many frames..do this: 

Import the DST movie into AE. Drag the movie down to the create comp button. Once the comp is made go into edit>composition settings and change the comp to your desired frame rate. (I like 24fps) Then I do my editing and render. Make sure to save your AE file. I usually save it in the dst folder.

Do all your extracting, training, and merging.

Now open up the AE file you saved. Import the merged and merged_mask footage into your project. Make sure they are the same FPS as your dst comp. 

Drag both sequences into the edited dst comp that you made earlier. Masked footage on top merged footage second and all the other footage below.  In the effects tab add these effects (in this order) to your Merged_mask footage.

Set matte
Simple choker
Gaussian blur

Set Matte: change it to luminance. This will take out all the black and leave you with just the white face mask. 

Now go to your merged layer which is the second sequence in the comp. On the sequence click on the track matte drop down and change it to alpha. Once you do this you will see the merged_masked layer turn off. Turn it back on so you can see the white mask again. I do this with the white mask on so I can see the edges of the matte best.
Now go to your blur and simple choker effects. I play with these till I get it just right. I usually blur somewhere between 15-25 and I choke from 6-20 but do what works best for you. Keep turning the masked layer on and off while you work to get your desired result. Once you get it where you want turn the masked layer off.

In addition I also select all my effects in the sequence and create a user preset. That way I only have to click on that to add all these effects.

Hope this helps. I’m sure there are other ways to do this but I find this works best for me. If you have any questions or comments please let me know.  
Thanks

Thank you so much i just learnt how edit the mask and shrink it :) this is exactly what i was trying to do.
 
Top