Cap icon indicating copy to clipboard operation
Cap copied to clipboard

cap export reports a path it didn't write when -o doesn't end in .mp4

Open patrickballard opened this issue 1 month ago • 1 comments

Description

For an MP4 export (the default), cap export writes <name>.mp4 whatever extension -o has, but reports the path as given:

command reports writes
cap export rec.cap -o out.gif --json {"type":"Completed","path":"out.gif"} out.mp4
cap export rec.cap -o out.webm --json {"type":"Completed","path":"out.webm"} out.mp4
cap export rec.cap -o out --json {"type":"Completed","path":"out"} out.mp4

Without --json it prints Exported video to out.gif. The reported file doesn't exist, so a script or agent that opens or uploads it fails. GIF and MOV exports already report the file they write: --format gif -o out.mp4 reports and writes out.gif.

The cause: MP4File::init (crates/enc-ffmpeg/src/mux/mp4.rs:56) sets the .mp4 extension on the path it writes, but Mp4ExportSettings::export returns the path it was given. GifExportSettings::export sets .gif itself and returns that path.

Checked with a release build of main at de2cae74d on a 3-second recording.

I've opened a PR that fixes this; it's linked below.

patrickballard avatar Oct 26 '26 19:10 patrickballard

CAP-936

linear[bot] avatar Oct 26 '26 19:10 linear[bot]