cypress video compression failed on CI runner: how to fix
Shows how to stop Cypress video compression failures on CI runners, either by disabling compression in the Cypress config or by making ffmpeg available on the runner. Use it when a Cypress run on CI exits with a video compression or ffmpeg error after specs complete. Not for local video playback issues, general Cypress install failures, or screenshot problems.
TL;DR
Set videoCompression: false in your Cypress config to skip the ffmpeg compression step entirely. This is the fastest fix on minimal CI images where ffmpeg is missing or underpowered. If you need small video artifacts, install ffmpeg on the runner instead and keep compression on. The compression step runs after all specs pass, so a failure here fails an otherwise green run.
Error
Cypress failed to compress the video after the spec run finished.
Command failed with exit code 1: ffmpeg -i /tmp/runner/videos/login-spec.mp4 -vcodec libx264 -crf 32 /tmp/runner/videos/login-spec-compressed.mp4Steps
- Open
cypress.config.js(orcypress.jsonon Cypress 9 and older) and addvideoCompression: falseinside thee2eblock. Expected: the config file contains the new option with no syntax errors. - Re-run the CI job. Expected: the run completes and uploads raw (larger) mp4 artifacts with no compression step in the log.
- Optional: if artifact size matters, install ffmpeg on the runner image instead and leave compression enabled. Expected: the compression step logs success and produces smaller mp4 files.
When to use
- Cypress exits non-zero on CI with a video or ffmpeg error after specs pass.
- The runner is a slim Docker image without ffmpeg installed.
- You want the quickest unblock and can accept larger video artifacts.
When not to use
- Videos fail locally too (that points at a broken Cypress install, not CI).
- The failure is about screenshots, not video compression.
- You need compressed video artifacts and have time to fix the runner image properly.
Tool compatibility
- Cypress 9 through 15 (the
videoCompressionconfig key exists in all of them). - Any CI runner: GitHub Actions, GitLab CI, Jenkins, CircleCI.
- ffmpeg 4.x or 5.x if you choose the install-ffmpeg route.
Variant phrasings
ffmpeg exited with code 1 during cypress video processing
Same root cause: the post-run ffmpeg call failed. Disabling videoCompression skips it; installing ffmpeg fixes it.
cypress could not compress video after spec run
Older Cypress wording for the same failure. Same fix applies.
Why it happens
After the last spec finishes, Cypress shells out to ffmpeg to re-encode each video with libx264. Slim CI images often ship without ffmpeg, or the runner lacks the CPU and memory headroom for the encode, so the post-processing step exits non-zero and marks the whole run failed.
Edge cases
videoCompression: falsebut the error persists: check the log, the real failure is now earlier in the run.- ffmpeg is installed but still fails: the runner may be OOM-killed during encoding, try a larger runner or disable compression.
- Videos are huge after disabling compression: set
video: falsefor stable specs, orvideoUploadOnPasses: falseto keep video only for failures.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_rxCPowKZbHDx0unTgLG5qA
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.