cypress – Record video only for failed test cases

How to record videos only for the failed test cases in CI pipeline using cypress, what configuration shall I make to achieve this … My cypres.json looks like below

{
“defaultCommandTimeout”: 30000,
“pageLoadTimeout”: 120000,
“requestTimeout”: 30000,
“responseTimeout”: 30000,
“execTimeout”: 30000,
“taskTimeout”: 30000,
“screenshotsFolder”: “cypress/screenshots”,
“trashAssetsBeforeRuns”:true,
“testFiles”: “**/*Smoke.spec.ts”,
“video”: false,
“videosFolder”: “build/cypress/videos”,
“viewportWidth”: 1300,
“viewportHeight”: 1000,
“animationDistanceThreshold”: 50,
“reporter”: “junit”,
“reporterOptions”: {
“mochaFile”: “build/cypress/test-output-[hash].xml”,
“toConsole”: true,
“attachments”: true
}
}