Skip to content

Bug: concat fails on relative input paths (list file lives in the OS temp dir) #48

Description

@TMHSDigital

Summary

concat writes its demuxer list file to the OS temp dir (via tempPath()), and the ffmpeg concat demuxer resolves a relative file '...' entry against the directory of the list file, not the process working directory. So a relative input path that exists relative to cwd passes the existsSync guard but then fails inside ffmpeg with a confusing "No such file or directory" pointing at a temp-dir path.

Where

src/tools/concat.ts checks existsSync(f) (cwd-relative) for each input, then buildConcatListContent(args.inputs) (src/utils/media.ts) writes the inputs verbatim into a list file created by tempPath() (OS temp dir). The mismatch between the existence check (cwd) and the demuxer's resolution base (temp dir) is the bug.

Repro

From a working directory containing a.mp4 and b.mp4:

concat { inputs: ["a.mp4", "b.mp4"] } -> the existsSync guard passes, but ffmpeg reports it cannot find <temp>/a.mp4.

Suggested fix

Resolve each input to an absolute path before writing the list file (e.g. path.resolve(f) in concat.ts, or have buildConcatListContent take pre-resolved absolute paths). This also matches how resolveOutput already makes the output path absolute. Keep the single-quote escaping in buildConcatListContent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions