Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breaking: update documentation by setting videoCompression: false #5301

Merged
merged 12 commits into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
52 changes: 30 additions & 22 deletions docs/guides/guides/screenshots-and-videos.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,12 @@ If enabled, Cypress records a video for each spec file when running tests during
}
```

:::cypress-config-example
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was missing from the video configuration example which broke the others which I missed in the previous PR


Videos are stored in the
[`videosFolder`](/guides/references/configuration#Videos) which is set to
`cypress/videos` by default.

After `cypress run` completes, Cypress compresses the video in order to save on
file size. By default it compresses to a `32 CRF`, but this is configurable with
the [`videoCompression`](/guides/references/configuration#Videos) property.

When using the `--record` flag while running your tests, videos are processed,
compressed, and uploaded to [Cypress Cloud](/guides/cloud/introduction) after
every spec file runs, successful or not. To change this behavior to only process
Expand All @@ -79,46 +77,56 @@ clear your videos folder before a run, you can set

### Video encoding

If your spec files have a long run duration, you might notice a time gap between
a finished spec and a new spec starting during `cypress run`. During this time,
Cypress is encoding the captured video and possibly uploading it to Cypress
Cloud.
After a video is recorded, Cypress encodes the video to a commonly digestable
format. Part of this encoding process includes video compression.

If the machine is encoding the video slowly (which is often the case for virtual
machines that use less CPU cores), the encoding might take a long time. In this
case, you can modify the
[`videoCompression`](/guides/references/configuration#Videos) configuration to
make the encoding a little bit faster. Here are some common scenarios:
Compression is disabled by default, meaning this step will be skipped
completely, so the file size of the video will be larger, but the encoding
process is faster. Setting
[`videoCompression`](/guides/references/configuration#Videos) to `true` will
coerce the video compression value to 32 Constant Rate Factor (CRF), which takes
longer to process, but results in a smaller video.

**Change compression value**
**Enabling compression**

:::cypress-config-example

```ts
{
videoCompression: 15
videoCompression: true
}
```

:::cypress-config-example

A lower `videoCompression` value will spend less time compressing and result in
a bigger video file size.
If your spec files have a long run duration and
[`videoCompression`](/guides/references/configuration#Videos) is enabled, you
might notice a time gap between a finished spec and a new spec starting during
`cypress run`. During this time, Cypress is encoding the captured video and
possibly uploading it to Cypress Cloud.

**Disable compression**
**Change compression value from 32**

:::cypress-config-example

```ts
{
videoCompression: false
videoCompression: 15
}
```

:::
:::cypress-config-example

In addition to enabling or disabling video compress, you can specify the CRF
value used to compress the video. Here is some common scenario:

The compression step will be skipped completely, so the video will be large, but
the processing should be faster.
- If the machine is encoding the video slowly (which is often the case for
virtual machines that use less CPU cores), try increasing the CRF value.

- If your videos are extremely low quality, try decreasing the CRF value.

A lower `videoCompression` value will spend less time compressing and result in
a bigger video file size and higher quality video.

:::info

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/references/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ For more options regarding screenshots, view the
| Option | Default | Description |
| ----------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `trashAssetsBeforeRuns` | `true` | Whether Cypress will trash assets within the `downloadsFolder`, `screenshotsFolder`, and `videosFolder` before tests run with `cypress run`. |
| `videoCompression` | `32` | The quality setting for the video compression, in Constant Rate Factor (CRF). The value can be `false` to disable compression or a value between `0` and `51`, where a lower value results in better quality (at the expense of a higher file size). |
| `videoCompression` | `false` | The quality setting for the video compression, in Constant Rate Factor (CRF). The value can be `false` to disable compression or a value between `0` and `51`, where a lower value results in better quality (at the expense of a higher file size). |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should also mention that true is valid and sets the value to 32 CRF.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is handled in the release-12.15.0 branch. It just hasn't made its way into main yet. Once released, we will need to merge main into the v13 docs branch to make sure the language makes sense

| `videosFolder` | `cypress/videos` | Where Cypress will automatically save the video of the test run when tests run with `cypress run`. |
| `video` | `false` | Whether Cypress will capture a video of the tests run with `cypress run`. |
| `videoUploadOnPasses` | `true` | Whether Cypress will process, compress, and upload videos to [Cypress Cloud](/guides/cloud/introduction) even when all tests in a spec file are passing. This only applies when recording your runs to Cypress Cloud. Turn this off if you'd like to only upload the spec file's video when there are failing tests. |
Expand Down