deepfakes/faceswap · error · ValueError

The chosen action requires a directory as its input, but you

Error message

The chosen action requires a directory as its input, but you entered: {self.input.path}

What it means

EFFmpeg tool argument validation: the selected --action belongs to the set that consumes a directory as input (e.g. extract/mux from a folder of frames), but the given --input path is not a directory. Raised as ValueError from _check_inputs before any ffmpeg process starts.

Source

Thrown at tools/effmpeg/effmpeg.py:184

                self.output = DataItem(path=self.__get_default_output())

    def _set_ref_video(self) -> None:
        """Set :attr:`ref_vid` based on input arguments"""
        if self.args.ref_vid is None or self.args.ref_vid == "":
            self.args.ref_vid = None

        self.ref_vid = DataItem(path=self.args.ref_vid)

    def _check_inputs(self) -> None:
        """Validate provided arguments are valid

        Raises
        ------
        ValueError
            If provided arguments are not valid
        """
        if self.args.action in self._actions_have_dir_input and not self.input.is_type("dir"):
            raise ValueError("The chosen action requires a directory as its input, but you "
                             f"entered: {self.input.path}")
        if self.args.action in self._actions_have_vid_input and not self.input.is_type("vid"):
            raise ValueError("The chosen action requires a video as its input, but you entered: "
                             f"{self.input.path}")
        if self.args.action in self._actions_have_dir_output and not self.output.is_type("dir"):
            raise ValueError("The chosen action requires a directory as its output, but you "
                             f"entered: {self.output.path}")
        if self.args.action in self._actions_have_vid_output and not self.output.is_type("vid"):
            raise ValueError("The chosen action requires a video as its output, but you entered: "
                             f"{self.output.path}")

        # Check that ref_vid is a video when it needs to be
        if self.args.action in self._actions_req_ref_video:
            if self.ref_vid.is_type("none"):
                raise ValueError("The file chosen as the reference video is not a video, either "
                                 f"leave the field blank or type 'None': {self.ref_vid.path}")
        elif self.args.action in self._actions_can_use_ref_video:
            if self.ref_vid.is_type("none"):

View on GitHub (pinned to f530cb7508)

Solutions

  1. Point --input at an existing directory of frames for directory-input actions.
  2. If your source is a video, first run an action that converts video to frames (e.g. 'extract') with correct direction, or extract frames with the extract tool.
  3. Run `python tools.py effmpeg -h` to confirm which type the chosen action expects for input/output.

Example fix

# before
python tools.py effmpeg -a extract -i video.mp4 -o frames/

# after
python tools.py effmpeg -a extract -i frames_dir/ -o output.avi   # dir-input action gets a directory
Defensive patterns

Strategy: validation

Validate before calling

import os

def dir_input_ok(path: str) -> bool:
    return os.path.isdir(path)

Try / catch

try:
    effmpeg._check_inputs()
except ValueError as err:
    print("Input type mismatch:", err)
    raise SystemExit(1)

Prevention

When it happens

Trigger: Running `python tools.py effmpeg -a extract -i video.mp4 ...` where 'extract' requires a dir input, or any dir-input action with a file/glob/nonexistent path classified as non-dir by DataItem.is_type('dir').

Common situations: Swapping -i and -o semantics; passing a video where a frames folder is expected; relative path resolving to a non-existent location so it fails the dir type check.

Related errors


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