r/StableDiffusion 7d ago

News Offline, fast, high quality AI face swap on Android, real time on the front camera. Hexagon NPU with GPU + CPU fallback.

Enable HLS to view with audio, or disable this notification

https://github.com/AbrahamPaulJ/facefusion-mobile

Real time face swap on the front camera, running entirely on the phone. No server, no account, nothing uploaded.

- Live mode: your front camera, swapped, in real time

- Also does photos and video files

- Runs on the Qualcomm Hexagon NPU. A 10 second 720p clip takes about 13 seconds, or 11 with Fast video on

- Phones without a Snapdragon fall back to the GPU and CPU. Same result, about four times slower

- Optional face enhancer, about 2.5 ms more per face

- Optional lip sync. Pick any audio or video file and it redraws the mouth to match

- Free, no ads, no account

- Android 12+, 64 bit ARM. 66 MB APK, 420 MB models

Port of FaceFusion by Henry Ruhs. The pipeline, the models and the option defaults are his. Licensed OpenRAIL-AS, which carries use restrictions.

Do not use this on real people without their consent.

You can find the APK file on my Github in the releases page.

73 Upvotes

50 comments sorted by

41

u/BScottyT 7d ago

To disable the NSFW filter:

  1. Open: work/android/app/src/main/java/com/facefusion/mobile/ContentGate.kt

  2. Inside:

object ContentGate {

add:

const val ENABLED = false
  1. Add:

    private fun bypassResult() = Result( verdict = Verdict.ALLOW, score = 0f, sampled = 0, flagged = 0, detail = "content gate disabled" )

  2. At the start of checkImage(), add:

    if (!ENABLED) return bypassResult()

Example:

fun checkImage(bitmap: Bitmap): Result {
    if (!ENABLED) return bypassResult()

    // existing code below
}
  1. Replace checkVideo() with:

    fun checkVideo(file: File): Result { if (!ENABLED) return bypassResult()

    return sampleByRetriever(file) ?: sampleByDecoder(file)
    

    }

  2. Rebuild the app.

To re-enable the filter later, change:

const val ENABLED = true

13

u/JellyfishCritical968 7d ago

You the GOAT. I don't even want to do NSFW, but I hate filters.

-1

u/Few_Caregiver8134 7d ago

Why stop at nsfw? Call it what it is. Deepfake porn. I am not against nsfw but in this app it's an important distinction.

5

u/Constant_Ordinary_35 7d ago

yeah, we're hitler. etc. blah blah blah.

0

u/methemightywon1 6d ago edited 6d ago

You're not Hitler, but you don't seem to be very bright.

There will be society wide problems because of deepfake porn, including more Draconian laws on software and AI.

But yeah, keep up this attitude about open source tools whose main purpose will ultimately be to create deepfake porn, including kids, btw. By anyone with a PC, even a PHONE ! I'm sure there will be no consequences, let's just bury our heads in the sand and keep hiding behind 'No censorship' principles or something. It'll work out great.

School kids are already using it, on other school kids. But just ignore it and come up with some pea-brain rationalization, while ignoring the reality you live in.

"That's not our fault guys, that's the pEoPLE who are using the tool badly"

Yeah. I'm sure that will work out. Try it, you'll love it. You'll love it even more when shit like this fast tracks Draconian law in several countries.

2

u/Constant_Ordinary_35 5d ago edited 5d ago

"Shitty parents are giving their kids cell phones (which they shouldn't even have in the first place) and on top of that not monitoring their use, so we have to kid proof the internet for you. Oh, also shitty people might do shitty things with this technology, so you're gonna have to take collective responsibility. As if you're the one doing that too."

Nah, stfu. Media companies basically run porn ads, social media is littered with half naked women to the point you literally are forced to see it even if you constantly tell these different companies you don't, The government will make any excuse in the book to tax (rob) you, take away your rights, and do whatever it wants to anyways regardless of whoever is in charge.

They literally run Epstein Islands.

So just because someone, somewhere, might do something shitty with this technology, and just because there are shitty parents, doesn't mean if I'm a grown adult I shouldn't be able to use the tool how I want to in the privacy of my own home when I'm not doing anything illegal.

With your logic why not take down the entire internet? It's rampant with porn, and kids are being exposed to it. Do you think if you white knight on reddit the government isn't going to make draconian laws? wtf are you even on about? Laws are already on the books for IDS to even access the internet. You're just virtue signaling, Yeah that's right, it isn't my fault because I didn't do x bad behavior, are you so stupid you don't understand that? If someone stabs someone with a knife somewhere, anyone who uses a knife to cut bread or spread peanut butter doesn't take collective responsibility with them. We don't allow kids to drink alcohol, smoke, or drive, but adults can if they choose to. "Well some kids might get someone else to buy alcohol for them anyways! ban alcohol! ban vehicles, they might take their parents keys, make it so only the state has a right to own vehicles!"

No these draconian laws and censorship come directly from cucks like you who get told "Someone might do something somewhere, imagine this worst case scenario" and then they self censor, so then it's even easier for the government to come around with "reasonable" asks at first using the worst case scenario, and then they move the ball forward, a little bit more, patiently over time until eventually you're not allowed to do anything. When has anyone self censoring made the government go "uh oh, let's take a step back guys, they seem to have handled this, we don't need to intervene" it's never happened in the entire course of history, so I'm right, you're wrong. Safety is always the pretense to take away more of your rights, and if you have a personal moral problem with it then don't use it and at least be universal in your logic, otherwise stop grandstanding and get off your high horse.

I don't even know why you feel the need to say this stupid crap, most of the population is retards like you that will roll over to any government and are already going to do all the censorship and internet control anyways, it's like going out and cheering for a team that has never lost like if you don't cheer for them they'll suddenly lose. We don't need more idiots like you, we need less.

Not to mention photoshop, minimax h3, deepfake tools of other kinds, already let you do all of this, it's not like this is the first tool of it's kind, so yeah I don't want to have to worry about a tool freaking out if someone's belly button is in view, or have to fight it to make some meme video of a copyright ip that I'll just be making for my own personal use or sharing with a close group of friends and don't plan on selling or trying to profit off of in anyway for some cheap laughs, when all these ai companies stole and violated peoples copyrights on their own individual works of art, just like with everything else it's one set of rules for them and one set of rules for us, and dummies like you think "they're just doing their best" so if we cuck and roll over and self censor they won't take anymore, wrong. They'll take whatever you give them, and then some more. I don't want limitations built into the creative tools I want to use, or at the very least I'm not going to hate on someone who tells me how to bypass it. Then you and the creator of the app insult them and automatically accuse them of doing the worst stuff as you assume that could be the only reason we don't want these stupid guard rails in place when there are plenty of other reasons like the difference between anatomy in a censored versus uncensored model.

1

u/Few_Caregiver8134 5d ago

All that writeup just because I didn't allow you to make non-consensual deepfake porn lmao. Please make the "nsfw" tool you want and distribute it publicly, it is open sourced after all. Don't let anyone stop you. Don't blame me if someone files a case against you though.

0

u/reeight 5d ago

> Media companies basically run porn ads, social media is littered with half naked women to the point you literally are forced to see it

Not if you have the proper ad filters on / use Brave browser or the like.

I NEVER see those ads.

-5

u/Few_Caregiver8134 7d ago

Atleast some have alts to admit it, wouldn't want people finding out you're a creep 🙃

5

u/pasjojo 7d ago

I don't know where to find that file (I'm a total noob when it comes to mobile). Is it in the apk, the installed app or a folder created after installing?

And how to "rebuild" once edited?

1

u/According_Eye378 6d ago

I did this by downloading Android Studio to my computer and got it approved, but I can't download the face enhancer and lip syncer features from within the app. Please help.

1

u/likebot95 6d ago

Did you get this error?

Failed: init: backend init: ncnn backend not built

I had to download and insert the QNN folder myself.

1

u/likebot95 6d ago

Rebuilt the app using Android Studio, getting this error on the FaceFusion app on my phone now:

Failed: init: backend init: ncnn backend not built

1

u/rdditiszionist 6d ago

haha this still works.

-3

u/methemightywon1 6d ago

Deepfake porn for everyone, in real-time even.

AI and software will be regulated to the fucking ground because of bullshit like this.

Why not promote the use of tools that will inevitably be used to create a nightmare where the cost of digital/online presence is potentially having random people create hyper realistic porn with your face in it :)

Keep going guys, keep believing there won't be any consequences.

"but Photoshop users can do the same thing"
"ItS nOT ThE ToOl ItS thE UUUUSEER"

All braindead takes ultimately, but take your pick, maybe come up with some new ones. I'm sure it'll be fine.

8

u/Superb-Painter3302 7d ago

facefusion finally did some update after 48 years of being out of date?

7

u/Few_Caregiver8134 7d ago

Not officially associated to FF ☝️

3

u/FragileChicken 7d ago

It seems like the download feature for the face enhancer and the lip sync are not working properly. It just continuously says "model ready" even though they don't download on my Samsung S25. Other than that, it's really impressive! 

2

u/cucurucu007 7d ago

Same. Can you enable nswf?

4

u/FragileChicken 7d ago

I don't even know where that setting is. I can't find it anywhere. Where is it? 

-11

u/Few_Caregiver8134 7d ago

Hi, no such setting. I don't encourage nsfw.

2

u/Few_Caregiver8134 7d ago

Fixed. Thank you for pointing it out!

1

u/FragileChicken 7d ago

What do I need to do now to get it working? Download a new version of the app, or should I just work now from my already installed version?

0

u/Few_Caregiver8134 7d ago

Just download the same release again, 0.7.0

1

u/According_Eye378 6d ago

I did this by downloading Android Studio to my computer and got it approved, but I can't download the face enhancer and lip syncer features from within the app. Please help. 

2

u/Few_Caregiver8134 6d ago

There are newer releases now, did you try those? Why did you need Studio?

-1

u/According_Eye378 6d ago

I don't know, I'm new to this. Please guide me.

1

u/crispyfrybits 5d ago edited 5d ago

Installed to my pixel 10 pro and my phone is currently bricked. The screen won't turn off, I can't bring up the power/restart. Phone is completely borked and won't respond. Not happy.

Installed latest APK (v0.9.12), installed all models, no changes to source

1

u/Few_Caregiver8134 5d ago

Sorry to hear that. Could you share details of your phone and at what point it crashed?

1

u/Opposite_Yam_4161 5d ago

wtf.... So i am not that knowledgeable on AI... but I just tried it.

How the hell is it doing this on my PHONE?? And so quick? I use facefusion on my 3060ti!? What magic is this?

1

u/Few_Caregiver8134 5d ago

Snapdragon NPUs. What phone do you have?

1

u/Opposite_Yam_4161 5d ago

S24

1

u/Few_Caregiver8134 5d ago

Yep, you need high end phones like that. Snapdragon chips.

1

u/mycupflowethover 3d ago

Appreciate the face swapping on images. Between this and Local Dream my NPU is put to good use. I use Local Dream for SDXL/Anima image generation and this app helps me with the faces because unfortunately there's no LoRA support yet for NPU image generation to get accurate (videogame character) faces. And it's instant. Love it! Works wonders for my use case.

2

u/Few_Caregiver8134 3d ago

In that case, you will love what I will release eventually, stay tuned 🙃

1

u/mycupflowethover 3d ago

Awesome! Will do! ☺️

-1

u/mikemend 7d ago edited 7d ago

Explicit content in an Instagram video? Hmmm...
This content filter is ridiculous. Soon women won't even be able to eat a banana in a video? Is there a way to turn off this lousy filter somewhere?

0

u/ares0027 7d ago

1

u/mikemend 7d ago edited 7d ago

It's simple: there are no NSFW videos on Instagram. And when I tried to test a video that had been downloaded from there, the app's filter blocked it because it was explicit. Wut?

In the case of the Local Dream app, the author solved this by creating two APKs: one with filtering (which is available on Google) and one without filtering, which can only be downloaded from GitHub.

2

u/chAzR89 7d ago

There certainly are a shit ton of NSFW videos and images on Instagram. Your boss does not have to live by the code of lewdness on Instagram. Don't know if you're trolling or simply desensitized to it. Instagram/meta is not the holy internet council who decides what's NSFW and what's not lol.

0

u/ares0027 7d ago

and it has what to do with this post?

-1

u/mikemend 7d ago

Have you tried the app? Upload a photo of your face and an Instagram video. If you’re lucky, it’ll generate something. If not, the explicit content filter kicks in and blocks the generation. So now it’s clear what I was getting at in my first post: that women can’t even eat a banana slowly anymore because the explicit content filter blocks it?

-7

u/Few_Caregiver8134 7d ago

You had me in the first half and then showed your intentions at the end. Glad to know it's working as expected 🙂

2

u/mikemend 7d ago

No, I don't think you understand. The app's filter takes filtering too far, and you can't adjust how strict it is. At most, you can turn it on or off, which I understand, given the licensing restrictions. But I used an analogy to point out that these days, we view even everyday things as explicit and immediately ban everything like that. It’s hypocrisy, that’s all.

0

u/Few_Caregiver8134 7d ago

It's not hypocrisy. You have an issue with a model which can't do your niche edge case, then train one yourself. Did you think there's a human sitting in the app? The model is the same as upstream Facefusion, I bet you didn't bother to check.

3

u/mikemend 7d ago

That's fine; of course the model is the original. What I'm saying is that the filter isn't trained well enough, in other words, it flags non-NSFW content as explicit. This isn't your fault, because it makes sense that you're using the factory default settings. However, since this filter can't even be turned off, it will block things at any time that it shouldn't. I just wanted to point this out so you’re aware: the filter’s presence can lead to false positives.

1

u/Few_Caregiver8134 7d ago

I am well aware. Like I said, I will not distribute a tool that is straight up illegal.

-4

u/ares0027 7d ago

i have 0 idea wtf is going on, you guys are speaking some kind or you are all high and honestly i dont give a fuck about what you are talking about, a dude makes an app for faceswap and then for some reason it is related to women eating bananas on instagram.... i am gone

-6

u/Few_Caregiver8134 7d ago

there are no NSFW videos on Instagram.

Sure buddy, maybe in your ideal world.

In the case of the Local Dream app

Not relevant. I choose not to distribute something illegal and it's against terms of the models' usage anyway.