Cap icon indicating copy to clipboard operation
Cap copied to clipboard

cap export --settings-json skips the fps and resolution checks

Open patrickballard opened this issue 1 month ago • 1 comments

Description

cap export rejects --fps 0 and a zero --resolution, but the same values passed through --settings-json go straight to the exporter:

--settings-json what happens
"fps": 0 exit 1 with Exporter error: Video/ffmpeg::Error(22: Invalid argument), and an empty .mp4 is left at the output path
"resolution_base": {"x": 0, "y": 0} exit 0 and {"type":"Completed"}, but the file is a 4×2-pixel video

--settings-json is how an agent passes full export settings, and the second case is a Completed export that can't be used: the kind of result the zero-frame guard in Export::run_inner is there to stop.

Reproduction

cap export rec.cap -o out.mp4 --json --settings-json '{"format":"Mp4","fps":30,"resolution_base":{"x":0,"y":0},"compression":"Maximum","custom_bpp":null}'

Expected: an error, as --resolution 0x0 gives (Resolution '0x0' must be greater than zero).

Actual: {"type":"Completed","path":"out.mp4"}, and out.mp4 is 4×2 pixels.

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

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

patrickballard avatar Oct 26 '26 14:10 patrickballard

CAP-934

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