Documentation / Video

Video

The stack (easy with Docker)

We use FFMpeg to record a video with 30 fps of the screen (but you can configure the number of frames per second). The easiest way is to use our Docker container with pre-installed FFMpeg but if you for some reason want to use the npm version, you can record a video too. As long as you install FFMpeg yourself.

When we got the video we use Visual Metrics (built by Pat Meenan) to analyze the video and get SpeedIndex and other visual metrics from the video. If you use our Docker container you get that for free, else you need to install all the Visual Metrics dependencies yourself.

We record the video in two steps: First we turn the background orange (that is used by VisualMetrics to know when the navigation starts), sets the background to white and let the browser go to the URL. The video is recorded lossless and then when the video has been analyzed, we remove the orange frames and convert the video to a compressed mp4.

The video will look something like this:

There are a couple of things that you can do to configure the video and the metrics.

SpeedIndex and other Visual Metrics

To collect Visual Metrics like firstVisualChange, SpeedIndex, visualComplete85%, visualComplete95% visualComplete99% and lastVisualChange you add the parameter --speedIndex. The video will then be recorded, analyzed and then removed.

Keep or remove the video

If you want to keep the video when you collect metrics or only want the video, just add --video to the list of parameters.

Video quality

You can change the number of frames per second (default is 30) by using --browsertime.videoParams.framerate. If you have a large server with a lot of extra CPU you can increase the amount. You should probably not decrease it lower than 30 since it will affect the precision of Visual Metrics.

You can also change the constant rate factor (see https://trac.ffmpeg.org/wiki/Encode/H.264#crf) to change the quality of the video. CRF is added in the second step (we first record the video as lossless as possible).

Remove timer and metrics from the video

The video will by default include a timer and show when visual metrics happens. If you want the video without any text/timer you just add --browsertime.videoParams.addTimer false.

Filmstrip parameters

When the video is analyzed with VisualMetrics screenshots for a filmstrip is also created.

If you don’t use those images you can turn them off with --videoParams.createFilmstrip false.

If you use them and want them the same size as the video (they are 200x200 by default) you can turn on the full size by --videoParams.filmstripFullSize.

If you want to change the quality (compression level 0-100) of the images you do that with --videoParams.filmstripQuality.

XVFB

If you run the Docker container we will automatically setup XVFB as a virtual frame buffer. If you run without Docker but still want to use XVFB, you add --xvfb and sitespeed.io will then start XVFB automatically, you only need to make sure it is installed.

Compare two video runs (combine two videos)

One of the things we love with WebPageTest is the video where you can compare two different runs. Since sitespeed.io is serverless, it is nothing you can do on the fly. Instead we created a simple tool you can use. Only thing you need is Docker!

  1. curl -O https://raw.githubusercontent.com/sitespeedio/sitespeed.io/master/tools/combineVideos.sh
  2. chmod +x combineVideos.sh
  3. Download the videos you want to compare, let us call them file1.mp4 and file2.mp4
  4. ./combineVideos.sh file1.mp4 file2.mp4
  5. You are done!

You will then have the two videos side by side, slightly slowed down that makes it easier to compare them: