deepfakes/faceswap · error · ValueError
An unexpected FFRuntimeError occurred: {ffe}
Error message
An unexpected FFRuntimeError occurred: {ffe} What it means
Wrapper error around ffmpeg-python's FFRuntimeError: the ffmpeg subprocess run by effmpeg exited with a code other than 255 (255 is tolerated as the post-SIGINT status) and not via KeyboardInterrupt. The original FFRuntimeError is chained (`from ffe`), so the real ffmpeg stderr is embedded in the message.
Source
Thrown at tools/effmpeg/effmpeg.py:507
items_to_check.append("input")
elif i == "o":
items_to_check.append("output")
return all(getattr(self, i).fps is None for i in items_to_check)
@staticmethod
def __run_ffmpeg(exe=str(ffmpeg.FFMPEG_PATH), inputs=None, outputs=None):
"""Run ffmpeg"""
logger.debug("Running ffmpeg: (exe: '%s', inputs: %s, outputs: %s", exe, inputs, outputs)
ffm = FFmpeg(executable=exe, inputs=inputs, outputs=outputs)
try:
ffm.run(stderr=subprocess.STDOUT)
except FFRuntimeError as ffe:
# After receiving SIGINT ffmpeg has a 255 exit code
if ffe.exit_code == 255:
pass
else:
raise ValueError(f"An unexpected FFRuntimeError occurred: {ffe}") from ffe
except KeyboardInterrupt:
pass # Do nothing if voluntary interruption
logger.debug("ffmpeg finished")
@staticmethod
def __convert_fps(fps):
"""Convert to Frames per Second"""
if "/" in fps:
_fps = fps.split("/")
retval = float(_fps[0]) / float(_fps[1])
else:
retval = float(fps)
logger.debug(retval)
return retval
@staticmethod
def __get_duration(start_time, end_time):
"""Get the duration"""View on GitHub (pinned to f530cb7508)
Solutions
- Read the tail of the message — it contains ffmpeg's own stderr; fix the reported cause (codec, path, filter).
- Test the same operation manually with the ffmpeg CLI to reproduce and isolate.
- For codec issues, install full ffmpeg builds (e.g. from johnvansickle static builds or distro ffmpeg-full) rather than minimal ones.
- For path issues, create the output directory and check write permissions.
Example fix
# before: fails because output dir does not exist python tools.py effmpeg -a rescale -i in.mp4 -o newdir/out.mp4 # after mkdir -p newdir python tools.py effmpeg -a rescale -i in.mp4 -o newdir/out.mp4
Defensive patterns
Strategy: try-catch
Validate before calling
import os, shutil
def ffmpeg_ready(input_path: str, output_dir: str) -> bool:
return (shutil.which("ffmpeg") is not None
and os.path.exists(input_path)
and os.path.isdir(output_dir)) Try / catch
from ffmpy import FFRuntimeError
try:
run_ffmpeg_action(...)
except ValueError as err:
if "FFRuntimeError" in str(err):
# original ffmpeg stderr is embedded — surface it verbatim for diagnosis
print("ffmpeg failed:", err)
raise SystemExit(1) from err
raise Prevention
- Pre-create output directories and check input readability before running effmpeg.
- Install a full-featured ffmpeg build; verify needed codecs with `ffmpeg -encoders | grep <codec>`.
- Test new action/filter combinations manually with the ffmpeg CLI first.
When it happens
Trigger: Any effmpeg action where the ffmpeg binary fails: unsupported/missing codec, unreadable input file, unwritable output path, invalid filter string, or a broken ffmpeg install — ffm.run() raises FFRuntimeError and it is re-raised as ValueError.
Common situations: Converting to a codec not compiled into the distro ffmpeg; output directory missing or no write permission; input file truncated; ffmpeg not on PATH / FFMPEG_PATH pointing to the wrong binary.
Related errors
- The chosen action requires a directory as its input, but you
- The chosen action requires a video as its input, but you ent
- The chosen action requires a directory as its output, but yo
- The chosen action requires a video as its output, but you en
- The file chosen as the reference video is not a video, eithe
AI-assisted analysis of deepfakes/faceswap@f530cb7508 (2026-08-15).
Data as JSON: /api/errors/fd76a9fddb9ff913.
Report an issue: GitHub.