affaan-m/ECC · error · ValueError

Output must differ from the original source media

Error message

Output must differ from the original source media

What it means

make_clip refuses to run when the resolved output path equals the resolved source path, because writing the generated clip would destroy the original media. The comparison uses Path.resolve() so symlinks and relative/absolute spellings of the same file are caught.

Solutions

  1. Choose a distinct output filename or directory for the generated clip
  2. Resolve both paths in your script and assert they differ before calling make_clip
  3. If in-place conversion is intended, copy the source to a temp file and use the copy as source

Example fix

// before
make_clip("video.mp4", "video.mp4")  # would overwrite source
// after
make_clip("video.mp4", "video_zoom.mp4")
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
if Path(source).resolve() == Path(output).resolve():
    raise SystemExit("output must differ from source")

Try / catch

try:
    make_clip(source, output, ...)
except ValueError as e:
    if "must differ" in str(e):
        output = Path(output).with_stem(Path(output).stem + "_clip")
        make_clip(source, str(output), ...)

Prevention

When it happens

Trigger: Calling make_clip(source="clip.mp4", output="clip.mp4"), or output="./clip.mp4" while source is an absolute path to the same file, or output given via a symlink that resolves to the source.

Common situations: Scripting batch conversions where in/out are built from the same variable; defaulting output to the input filename in a template; users pointing --output at the source directory with the same basename.

Understand the failure class

Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/ab8106d59e3e3c35. Report an issue: GitHub.

Appendix: source

Thrown at skills/taste-application/scripts/tasteforge/media/stills.py:56

    source,
    output,
    duration=4,
    start_crop=(0, 0, 1, 1),
    end_crop=(0.1, 0.1, 0.8, 0.8),
    width=1920,
    height=1080,
    fps=30,
    overwrite=False,
    runner=subprocess.run,
):
    geometry(width, height, fps, duration)
    graph = filter_graph(
        start_crop, end_crop, max(1, round(duration * fps)), width, height, fps
    )
    if not Path(source).is_file():
        raise FileNotFoundError(source)
    if Path(source).resolve() == Path(output).resolve():
        raise ValueError("Output must differ from the original source media")
    with output_file(output, overwrite) as temporary:
        runner(
            [
                "ffmpeg",
                "-nostdin",
                "-y",
                "-v",
                "error",
                "-i",
                str(source),
                "-vf",
                graph,
                "-an",
                "-t",
                str(duration),
                "-c:v",
                "libx264",
                "-preset",

View on GitHub (pinned to 8321021c54)