deepfakes/faceswap · error · FaceswapError
The input file '{input_location}' is not a valid video
Error message
The input file '{input_location}' is not a valid video What it means
Raised by is_video() in lib/video.py when the input location is a file (not a directory, not a non-str value) whose extension is not in VIDEO_EXTENSIONS. Faceswap routes jobs between 'folder of images' and 'video' mode based on this check, so a file with an unknown extension can be neither and is rejected.
Source
Thrown at lib/video.py:62
----------
input_location
Full path to an input file
Returns
-------
bool: 'True' if input is a video 'False' if it is a folder.
Raises
------
FaceswapError
If the given location is a file and does not have a valid video extension.
"""
if not isinstance(input_location, str) or os.path.isdir(input_location):
retval = False
elif os.path.splitext(input_location)[1].lower() in VIDEO_EXTENSIONS:
retval = True
else:
raise FaceswapError(f"The input file '{input_location}' is not a valid video")
logger.debug("Input '%s' is_video: %s", input_location, retval)
return retval
def validate_video_file(file_path: str) -> str:
"""Validates that a given file exists and is a valid video format
Parameters
----------
file_path
The full path to the video file to validate
Returns
-------
The full expanded video file path
Raises
------View on GitHub (pinned to f530cb7508)
Solutions
- Check the file path and its extension; rename the file to a supported video extension (.mp4, .avi, .mkv, .mov, ...) if the content really is a video.
- If the input is images, pass the folder containing them rather than a single file.
- If the extension is valid but unusual, remux with ffmpeg -i in.mp4 -c copy out.mkv to a supported container.
Example fix
# before faceswap extract -i clip.download -o faces/ # after faceswap extract -i clip.mp4 -o faces/
Defensive patterns
Strategy: validation
Validate before calling
from lib.video import VIDEO_EXTENSIONS
import os
path = "input.mp4"
assert os.path.isdir(path) or os.path.splitext(path)[1].lower() in VIDEO_EXTENSIONS, \
f"{path} is neither a folder nor a supported video ({VIDEO_EXTENSIONS})" Type guard
def looks_like_video(path: str, exts: set[str]) -> bool:
return os.path.splitext(path)[1].lower() in exts Prevention
- Pass folders for image inputs and absolute paths for video inputs.
- Confirm the file finished downloading (no .part/.crdownload suffix) before using it as input.
When it happens
Trigger: Passing -i/--input that points at a file whose extension is not a recognized video format (e.g. .txt, .mp4.part, .webm variants not in the list, a file with no extension) to any CLI job that calls is_video (extract, convert, sort, etc.).
Common situations: Typos in the path; an incomplete download still named '.part' or '.crdownload'; pointing at an image file instead of a folder of images; uncommon container extension not in VIDEO_EXTENSIONS.
Related errors
- File '{file_path}' is not a valid video file
- Video file '{file_path}' does not exist
- There is a mismatch between the number of frames found in th
- Video file '{self._video_file}' cannot be processed. Missing
- Output as video selected, but using frames as input. You mus
AI-assisted analysis of deepfakes/faceswap@f530cb7508 (2026-08-15).
Data as JSON: /api/errors/d58a9a4da4e11e30.
Report an issue: GitHub.