deepfakes/faceswap · error · ValueError

The chosen action requires a directory as its output, but yo

Error message

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

What it means

EFFmpeg tool validation mirror-image of the input checks: the chosen action writes its result into a directory (e.g. extract writes frames into a folder), but the supplied --output is not a directory. Caught before ffmpeg runs.

Source

Thrown at tools/effmpeg/effmpeg.py:190

        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"):
                logger.warning("Warning: no reference video was supplied, even though "
                               "one may be used with the chosen action. If this is "
                               "intentional then ignore this warning.")

    def _set_times(self) -> None:
        """Set start, end and duration attributes"""

View on GitHub (pinned to f530cb7508)

Solutions

  1. Give --output a directory path (existing or creatable) for dir-output actions.
  2. If you want a video result, use a vid-output action (e.g. mux) instead of a frames-extract action.
  3. Remove a same-named file that blocks creation of the output directory.

Example fix

# before
python tools.py effmpeg -a extract -i src.mp4 -o out.mp4

# after
python tools.py effmpeg -a extract -i src.mp4 -o frames_out/
Defensive patterns

Strategy: validation

Validate before calling

import os

def dir_output_ok(path: str) -> bool:
    return os.path.isdir(path) or not os.path.exists(path)  # creatable

Prevention

When it happens

Trigger: Running `python tools.py effmpeg -a extract -i src.mp4 -o out.mp4` — 'extract' has dir output and out.mp4 is typed as a file — or any dir-output action with a non-dir output path.

Common situations: Assuming extract writes a video; leaving a stale file at the intended output path so the dir check fails; swapping -i and -o.

Related errors


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