{"record":{"id":"d58a9a4da4e11e30","repo":"deepfakes/faceswap","slug":"the-input-file-input-location-is-not-a-valid-v","errorCode":null,"errorMessage":"The input file '{input_location}' is not a valid video","messagePattern":"The input file '(.+?)' is not a valid video","errorType":"exception","errorClass":"FaceswapError","httpStatus":null,"severity":"error","filePath":"lib/video.py","lineNumber":62,"sourceCode":"    ----------\n    input_location\n        Full path to an input file\n\n    Returns\n    -------\n    bool: 'True' if input is a video 'False' if it is a folder.\n\n    Raises\n    ------\n    FaceswapError\n        If the given location is a file and does not have a valid video extension.\n    \"\"\"\n    if not isinstance(input_location, str) or os.path.isdir(input_location):\n        retval = False\n    elif os.path.splitext(input_location)[1].lower() in VIDEO_EXTENSIONS:\n        retval = True\n    else:\n        raise FaceswapError(f\"The input file '{input_location}' is not a valid video\")\n    logger.debug(\"Input '%s' is_video: %s\", input_location, retval)\n    return retval\n\n\ndef validate_video_file(file_path: str) -> str:\n    \"\"\"Validates that a given file exists and is a valid video format\n\n    Parameters\n    ----------\n    file_path\n        The full path to the video file to validate\n\n    Returns\n    -------\n    The full expanded video file path\n\n    Raises\n    ------","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/deepfakes/faceswap/blob/f530cb7508ae670f6474f8a7d9c4df94705cf96b/lib/video.py#L44-L80","documentation":"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.","triggerScenarios":"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.).","commonSituations":"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.","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."],"exampleFix":"# before\nfaceswap extract -i clip.download -o faces/\n\n# after\nfaceswap extract -i clip.mp4 -o faces/","handlingStrategy":"validation","validationCode":"from lib.video import VIDEO_EXTENSIONS\nimport os\npath = \"input.mp4\"\nassert os.path.isdir(path) or os.path.splitext(path)[1].lower() in VIDEO_EXTENSIONS, \\\n    f\"{path} is neither a folder nor a supported video ({VIDEO_EXTENSIONS})\"","typeGuard":"def looks_like_video(path: str, exts: set[str]) -> bool:\n    return os.path.splitext(path)[1].lower() in exts","tryCatchPattern":null,"preventionTips":["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."],"tags":["faceswap","video","file-validation","cli"],"backgroundTag":null,"analyzedSha":"f530cb7508ae670f6474f8a7d9c4df94705cf96b","analyzedAt":"2026-08-15T02:59:26.626Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}