PiAPI's Video Face Swap service enables face replacement in videos using advanced facial recognition and swapping technology. The service supports both single and multiple face swapping operations within MP4 videos. The face-swapping sequence is determined by the model's algorithmic detection of faces. The model assigns order labels to detected faces, and users can generally expect the API to sort faces from left to right by default. However, if faces in a photo/video are positioned diagonally (e.g., one at the top-left and another at the bottom-right), the model may prioritize them as follows:
Top-left face → Labeled 1
Bottom-right face → Labeled 0
Conversely, if one face is at the bottom-left and another at the top-right:
swap_faces_index: 0 1 target_faces_index: 1 0 Action: The left face in the source image replaces the right face in the target video, and the right face in the source replaces the left face in the target.
swap_faces_index: 0 1 target_faces_index: 0 1 Action: The left face in the source replaces the left face in the target; the right face in the source replaces the right face in the target.