# AI : Faceswap : CLI : Overview ```bash conda activate faceswap python faceswap.py -h python faceswap.py COMMAND [OPTIONS] # extract, train, convert, gui python tools.py -h python tools.py COMMAND [OPTIONS] # alignments, effmpeg, manual, mask, model, preview, sort ``` ## Basics ``` # An alignments.json file will also be created in the input folder. ... extract -i ~/folder -o ~/faces -p ~/folder_alignments.fsa # extract from multiple photos & videos ... extract -i ~/video.mp4 -o ~/faces -p ~/video_alignments.fsa # extract from video ... train -m MODELDIR -A FACES1 -B FACES2 [-p|--preview] ... convert -m MODELDIR -i ~/template.mp4 -o ~/converted # use video as source ... convert -m MODELDIR -i ~/template/ -r ~/template.mp4 -o ~/converted # use folder of frames as source ``` #### Recipes ``` # extract for training $ python faceswap.py extract -i /foo/foo.mp4 -o /foo/__all__ --alignments /foo/foo_training.fsa --masker bisenet-fp --identity --min-size 180 # 1080p / 6 --extract-every-n 12 # 24 fps / 2 # explode $ ffmpeg -i /foo/foo.mp4 -o /foo/foo/foo_%06d.png # extract for conversion $ python faceswap.py extract -i /foo/foo/ -o /tmp --alignments /foo/foo_conversion.fsa --normalization hist --re-feed 8 --re-align # train — Phase 1 $ python faceswap.py train -m MODELDIR -A PERSON1_NOT_TARGET_FACES -B PERSON2 # train — Phase 2 $ python faceswap.py train -m MODELDIR -A PERSON1_TARGET_FACES -B PERSON2 --no-warp ``` > [!NOTE] > Currently unable to run convert using a video source. Multiple people have recently reported the same. In the meantime, you can explode the video into a folder of frames and use that as a source combined with the video as a "reference" (-r). ## Common Options ``` -C|--configfile CONFIGFILE Optionally overide the saved config with the path to a custom config file. -L|--loglevel {INFO,VERBOSE,DEBUG,TRACE} Log level. Stick with INFO or VERBOSE unless you need to file an error report. Be careful with TRACE as it will generate a lot of data. -F|--logfile LOGFILE Path to store the logfile. Leave blank to store in the faceswap folder. ```