David Staessens | 38dba3c | 2020-05-26 08:56:27 | [diff] [blame] | 1 | # Video Encoder tests |
| 2 | The video encoder tests are a set of tests that validate various video encoding |
David Staessens | a3ed4f2 | 2020-05-29 05:20:50 | [diff] [blame] | 3 | scenarios. They are accompanied by the video encoder performance tests that can |
| 4 | be used to measure a video encoder's performance. |
| 5 | |
| 6 | These tests run directly on top of the video encoder implementation, and |
David Staessens | 38dba3c | 2020-05-26 08:56:27 | [diff] [blame] | 7 | don't require the full Chrome browser stack. They are built on top of the |
Eric Willigers | c2e3d881 | 2022-01-17 01:59:37 | [diff] [blame] | 8 | [GoogleTest](https://github.com/google/googletest/blob/main/README.md) |
David Staessens | 38dba3c | 2020-05-26 08:56:27 | [diff] [blame] | 9 | framework. |
| 10 | |
David Staessens | 38dba3c | 2020-05-26 08:56:27 | [diff] [blame] | 11 | [TOC] |
| 12 | |
| 13 | ## Running from Tast |
Hirokazu Honda | bf36605b | 2021-02-24 07:45:41 | [diff] [blame] | 14 | The Tast framework provides an easy way to run the video encoder tests from a |
| 15 | ChromeOS chroot. Test data is automatically deployed to the device being tested. |
| 16 | To run all video encoder tests use: |
| 17 | |
| 18 | tast run $HOST video.EncodeAccel.* |
| 19 | |
| 20 | Wildcards can be used to run specific sets of tests: |
| 21 | * Run all VP8 tests: `tast run $HOST video.EncodeAccel.vp8*` |
| 22 | |
| 23 | Check the |
Fei Shao | d8c7371 | 2023-09-12 04:46:30 | [diff] [blame] | 24 | [tast video folder](https://chromium.googlesource.com/chromiumos/platform/tast-tests/+/refs/heads/main/src/go.chromium.org/tast-tests/cros/local/bundles/cros/video/) |
Hirokazu Honda | bf36605b | 2021-02-24 07:45:41 | [diff] [blame] | 25 | for a list of all available tests. |
| 26 | See the |
| 27 | [Tast quickstart guide](https://chromium.googlesource.com/chromiumos/platform/tast/+/HEAD/docs/quickstart.md) |
| 28 | for more information about the Tast framework. |
David Staessens | 38dba3c | 2020-05-26 08:56:27 | [diff] [blame] | 29 | |
| 30 | ## Running manually |
| 31 | To run the video encoder tests manually the _video_encode_accelerator_tests_ |
| 32 | target needs to be built and deployed to the device being tested. Running |
| 33 | the video encoder tests can be done by executing: |
| 34 | |
Hirokazu Honda | bf36605b | 2021-02-24 07:45:41 | [diff] [blame] | 35 | ./video_encode_accelerator_tests [<video path>] |
David Staessens | 38dba3c | 2020-05-26 08:56:27 | [diff] [blame] | 36 | |
| 37 | e.g.: `./video_encode_accelerator_tests bear_320x192_40frames.yuv.webm` |
| 38 | |
David Staessens | a3ed4f2 | 2020-05-29 05:20:50 | [diff] [blame] | 39 | Running the video encoder performance tests can be done in a smilar way by |
| 40 | building, deploying and executing the _video_encode_accelerator_perf_tests_ |
| 41 | target. |
| 42 | |
Hirokazu Honda | bf36605b | 2021-02-24 07:45:41 | [diff] [blame] | 43 | ./video_encode_accelerator_perf_tests [<video path>] |
David Staessens | a3ed4f2 | 2020-05-29 05:20:50 | [diff] [blame] | 44 | |
| 45 | e.g.: `./video_encode_accelerator_perf_tests bear_320x192_40frames.yuv.webm` |
| 46 | |
David Staessens | 38dba3c | 2020-05-26 08:56:27 | [diff] [blame] | 47 | __Test videos:__ Various test videos are present in the |
| 48 | [_media/test/data_](https://cs.chromium.org/chromium/src/media/test/data/) |
| 49 | folder in Chromium's source tree (e.g. |
| 50 | [_bear_320x192_40frames.yuv.webm_](https://cs.chromium.org/chromium/src/media/test/data/bear_320x192_40frames.yuv.webm)). |
| 51 | These videos are stored in compressed format and extracted at the start of each |
| 52 | test run, as storing uncompressed videos requires a lot of disk space. Currently |
| 53 | only VP9 or uncompressed videos are supported as test input. If no video is |
| 54 | specified _bear_320x192_40frames.yuv.webm_ will be used. |
| 55 | |
| 56 | __Video Metadata:__ These videos also have an accompanying metadata _.json_ file |
| 57 | that needs to be deployed alongside the test video. The video metadata file is a |
| 58 | simple json file that contains info about the video such as its pixel format, |
| 59 | dimensions, framerate and number of frames. These can also be found in the |
| 60 | _media/test/data_ folder (e.g. |
| 61 | [_bear_320x192_40frames.yuv.webm.json_](https://cs.chromium.org/chromium/src/media/test/data/bear_320x192_40frames.yuv.webm.json)). |
Hirokazu Honda | bf36605b | 2021-02-24 07:45:41 | [diff] [blame] | 62 | The metadata file must be _\<video path\>.json_ in the same directory. |
David Staessens | 38dba3c | 2020-05-26 08:56:27 | [diff] [blame] | 63 | |
| 64 | ## Command line options |
| 65 | Multiple command line arguments can be given to the command: |
| 66 | |
David Staessens | 96a0008 | 2020-06-01 01:46:36 | [diff] [blame] | 67 | --codec codec profile to encode, "h264 (baseline)", |
| 68 | "h264main, "h264high", "vp8" and "vp9" |
Hirokazu Honda | bf36605b | 2021-02-24 07:45:41 | [diff] [blame] | 69 | --output_folder overwrite the output folder used to store |
| 70 | performance metrics, if not specified results |
| 71 | will be stored in the current working directory. |
David Staessens | b0a9528 | 2020-06-11 00:46:33 | [diff] [blame] | 72 | |
David Staessens | 38dba3c | 2020-05-26 08:56:27 | [diff] [blame] | 73 | -v enable verbose mode, e.g. -v=2. |
| 74 | --vmodule enable verbose mode for the specified module, |
| 75 | e.g. --vmodule=*media/gpu*=2. |
David Staessens | b0a9528 | 2020-06-11 00:46:33 | [diff] [blame] | 76 | |
David Staessens | 38dba3c | 2020-05-26 08:56:27 | [diff] [blame] | 77 | --gtest_help display the gtest help and exit. |
| 78 | --help display this help and exit. |
| 79 | |
David Staessens | b0a9528 | 2020-06-11 00:46:33 | [diff] [blame] | 80 | Non-performance tests only: |
| 81 | |
Hirokazu Honda | bf36605b | 2021-02-24 07:45:41 | [diff] [blame] | 82 | --num_temporal_layers the number of temporal layers of the encoded |
| 83 | bitstream. Only used in --codec=vp9 currently. |
| 84 | --disable_validator disable validation of encoded bitstream. |
| 85 | --output_bitstream save the output bitstream in either H264 AnnexB |
| 86 | format (for H264) or IVF format (for vp8 and |
| 87 | vp9) to <output_folder>/<testname>. |
| 88 | --output_images in addition to saving the full encoded, |
| 89 | bitstream it's also possible to dump individual |
| 90 | frames to <output_folder>/<testname>, possible |
| 91 | values are \"all|corrupt\" |
| 92 | --output_format set the format of images saved to disk, |
| 93 | supported formats are \"png\" (default) and |
| 94 | \"yuv\". |
| 95 | --output_limit limit the number of images saved to disk. |
David Staessens | b0a9528 | 2020-06-11 00:46:33 | [diff] [blame] | 96 | |
David Staessens | 38dba3c | 2020-05-26 08:56:27 | [diff] [blame] | 97 | ## Source code |
Hang Nguyen | e703182 | 2024-06-21 02:12:07 | [diff] [blame] | 98 | See the video encoder tests [source code](https://cs.chromium.org/chromium/src/media/gpu/test/video_encode_accelerator_tests.cc). |
| 99 | See the video encoder performance tests [source code](https://cs.chromium.org/chromium/src/media/gpu/test/video_encode_accelerator_perf_tests.cc). |