{"record":{"id":"8c3b4f59e17e114b","repo":"deepfakes/faceswap","slug":"the-chosen-action-requires-a-directory-as-its-outp","errorCode":null,"errorMessage":"The chosen action requires a directory as its output, but you entered: {self.output.path}","messagePattern":"The chosen action requires a directory as its output, but you entered: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/effmpeg/effmpeg.py","lineNumber":190,"sourceCode":"\n        self.ref_vid = DataItem(path=self.args.ref_vid)\n\n    def _check_inputs(self) -> None:\n        \"\"\"Validate provided arguments are valid\n\n        Raises\n        ------\n        ValueError\n            If provided arguments are not valid\n        \"\"\"\n        if self.args.action in self._actions_have_dir_input and not self.input.is_type(\"dir\"):\n            raise ValueError(\"The chosen action requires a directory as its input, but you \"\n                             f\"entered: {self.input.path}\")\n        if self.args.action in self._actions_have_vid_input and not self.input.is_type(\"vid\"):\n            raise ValueError(\"The chosen action requires a video as its input, but you entered: \"\n                             f\"{self.input.path}\")\n        if self.args.action in self._actions_have_dir_output and not self.output.is_type(\"dir\"):\n            raise ValueError(\"The chosen action requires a directory as its output, but you \"\n                             f\"entered: {self.output.path}\")\n        if self.args.action in self._actions_have_vid_output and not self.output.is_type(\"vid\"):\n            raise ValueError(\"The chosen action requires a video as its output, but you entered: \"\n                             f\"{self.output.path}\")\n\n        # Check that ref_vid is a video when it needs to be\n        if self.args.action in self._actions_req_ref_video:\n            if self.ref_vid.is_type(\"none\"):\n                raise ValueError(\"The file chosen as the reference video is not a video, either \"\n                                 f\"leave the field blank or type 'None': {self.ref_vid.path}\")\n        elif self.args.action in self._actions_can_use_ref_video:\n            if self.ref_vid.is_type(\"none\"):\n                logger.warning(\"Warning: no reference video was supplied, even though \"\n                               \"one may be used with the chosen action. If this is \"\n                               \"intentional then ignore this warning.\")\n\n    def _set_times(self) -> None:\n        \"\"\"Set start, end and duration attributes\"\"\"","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/deepfakes/faceswap/blob/f530cb7508ae670f6474f8a7d9c4df94705cf96b/tools/effmpeg/effmpeg.py#L172-L208","documentation":"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.","triggerScenarios":"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.","commonSituations":"Assuming extract writes a video; leaving a stale file at the intended output path so the dir check fails; swapping -i and -o.","solutions":["Give --output a directory path (existing or creatable) for dir-output actions.","If you want a video result, use a vid-output action (e.g. mux) instead of a frames-extract action.","Remove a same-named file that blocks creation of the output directory."],"exampleFix":"# before\npython tools.py effmpeg -a extract -i src.mp4 -o out.mp4\n\n# after\npython tools.py effmpeg -a extract -i src.mp4 -o frames_out/","handlingStrategy":"validation","validationCode":"import os\n\ndef dir_output_ok(path: str) -> bool:\n    return os.path.isdir(path) or not os.path.exists(path)  # creatable","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-create output frame directories in pipelines (os.makedirs(out, exist_ok=True)).","Do not reuse a filename where a folder is expected; action docs list the output type."],"tags":["faceswap","effmpeg","ffmpeg","output-validation","cli-arguments"],"backgroundTag":null,"analyzedSha":"f530cb7508ae670f6474f8a7d9c4df94705cf96b","analyzedAt":"2026-08-15T02:59:26.626Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}