deepfakes/faceswap · error · FaceswapError

Video file '{file_path}' does not exist

Error message

Video file '{file_path}' does not exist

What it means

Raised by validate_video_file() in lib/video.py when the expanded, absolutized path does not point at an existing regular file. This is a straight path-existence check performed before any video processing begins.

Source

Thrown at lib/video.py:86

    """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
    ------
    FaceswapError
        If the given video file is not valid
    """
    file_path = os.path.expanduser(os.path.abspath(file_path))
    if not os.path.isfile(file_path):
        raise FaceswapError(f"Video file '{file_path}' does not exist")
    if os.path.splitext(file_path)[-1].lower() not in VIDEO_EXTENSIONS:
        raise FaceswapError(f"File '{file_path}' is not a valid video file")
    return file_path


# TODO look for instances of this and see if we can roll it into VideoInfo
def count_frames(filename, fast=False):
    """ Count the number of frames in a video file

    There is no guaranteed accurate way to get a count of video frames without iterating through
    a video and decoding every frame.

    :func:`count_frames` can return an accurate count (albeit fairly slowly) or a possibly less
    accurate count, depending on the :attr:`fast` parameter. A progress bar is displayed.

    Parameters
    ----------
    filename: str

View on GitHub (pinned to f530cb7508)

Solutions

  1. Verify the path with ls or a file manager and correct it.
  2. Use the absolute path to the video file.
  3. Ensure any quotes/backslashes for spaces in the path are correct in your shell.

Example fix

# before
faceswap extract -i vid.mp4 ...   # run from wrong cwd

# after
faceswap extract -i /home/user/videos/vid.mp4 ...
Defensive patterns

Strategy: validation

Validate before calling

import os
assert os.path.isfile(os.path.expanduser(video_path)), f"missing video: {video_path}"

Type guard

def is_existing_file(path: str) -> bool:
    return os.path.isfile(os.path.expanduser(path))

Prevention

When it happens

Trigger: Calling validate_video_file (directly or via CLI jobs that validate video inputs) with a path to a file that has been moved, deleted, or never existed; relative paths that resolve against an unexpected working directory are also expanded and checked.

Common situations: Typos in the -i argument; shell quoting issues with paths containing spaces; running from a different working directory with a relative path; the file being on an unmounted network drive.

Related errors


AI-assisted analysis of deepfakes/faceswap@f530cb7508 (2026-08-15). Data as JSON: /api/errors/f3ec770c7b680778. Report an issue: GitHub.