Skip to content

How we improved animated screenshots

Smoother motion without a GPU

November 30, 2026

Our new animated screenshot recorder makes the page wait for each frame. An animated screenshot turns any URL into a short video. Our servers have no GPU, so a heavy WebGL page can draw slower than it plays. Recorded in real time, the clip stutters.
Before: recorded in real time, including page load. After: captured frame by frame, once the page loads. The clips are not in sync, and the new one holds its last frame for 0.2s. The FPS meter in the new clip follows our clock, so it is not a rendering speed.
TL;DR
  • We move the page's main clock one frame at a time, and capture each frame before the next.
  • In both WebGL scenes we tested, a median of 150 of 150 frames were distinct. Before, the medians were 16 of 156 and 102 of 150.
  • A clip starts after the page loads and is no longer completely white, or when that wait reaches its limit.
  • Requests for those two scenes took 1.8× to 2.3× as long.
  • Very heavy pages can fail. Of two heavier homepages, one failed in all three runs. The other failed once, and its two successful requests took 5.5× to 5.8× the previous median.

Real-time recording cannot wait for a slow page

A recorder can only save the frames Chrome draws.
Our previous recorder used Chrome's Page.startScreencast, which sends frames as Chrome draws them. The page's clock keeps running in between. In the previous three.js clip, the animation kept moving while Chrome was drawing, so the model jumped from pose to pose.
We also opened the page in two browsers at the same time: one for the video, and one for a still image. Without a GPU, WebGL is drawn on the CPU, so both browsers competed for it. Moving to Mesa llvmpipe made drawing much faster, but not fast enough for the three.js scene.

Now the page waits for us

We stopped recording in real time.
The page now runs on a virtual clock that only the recorder moves during the recording. For each frame, the recorder takes three steps:
  1. Move the clock to the frame's time.
  2. Let the page update for that time.
  3. Capture the page and send the image to ffmpeg, which encodes the H.264 video.
The frame number and fps give each frame's time, in milliseconds from the start of the clip:
const frameTime = (frame, fps) => (frame * 1000) / fps
At 30 frames per second, the clock moves 33.3ms for each new frame. A slow frame does not make it jump ahead, as long as each frame finishes within 5s.
The three.js scene has its own FPS meter. It settles at 4 FPS (4-4) before and 30 FPS (29-30) after, but the server did not get faster. The new reading follows the virtual clock.
The clock comes from timeweb, an open source library by tungs. It replaces the main ways a page tells the time, including requestAnimationFrame(), timers, CSS animations and videos. We patch timeweb as it loads for cases it does not handle, such as scroll-driven animations. Some parts of a page, such as workers and network activity, still run in real time.
Our code is open source too, in the capture package of browserless.

Clips start after the page loads

The first frame of a video is often its thumbnail.
The previous recorder started when navigation began, so a clip could open on a blank page. The new one loads the page first, then waits until it is no longer completely white. The recording starts there, or when the wait reaches its limit.
In both videos on this page, the new clip shows the scene from its first frame. A clip can still start on a white page, a black page, or a loading screen.
The poster image is the first frame of the same video, so the two always match.

Both WebGL scenes reached 150 distinct frames

We compared both recorders on the same server.
We tested four pages, using test deployments of both versions, not production traffic. Each recorder captured each page three times, one request at a time, at the default 5s and 30 frames per second. Two pages were WebGL scenes: three.js and The Eye of Sauron. The table shows the median of the three runs for each scene:
SceneDistinct frames beforeDistinct frames afterRequest beforeRequest after
three.js16 of 156150 of 1507.5s17.1s
Sauron102 of 150150 of 1506.6s12.2s
A distinct frame is one that ffmpeg's mpdecimate filter keeps, because it changed enough from the last one it kept. The count is not a frame rate. It ignores very small changes and includes frames from page load. The previous three.js clip has 156 frames because it lasted 5.2s.
Request times cover the whole request. Before, that included a separate still image, captured at the same time. The results combine the virtual clock, a single browser, and waiting for the page to load. We did not measure each change alone.
The difference is harder to see in the Sauron videos, because the previous recorder already got 102 distinct frames:
Before: recorded in real time, including page load. After: captured frame by frame, once the page loads. The clips are not in sync, and smooth playback is not a rendering speed.
Each video uses a run with the median number of distinct frames.

Smoother clips take longer, and requests can fail

Every frame has to be drawn before the clip can end.
A real-time recorder spends about 5s recording a 5s clip, however slow the page is. The new one spends as long as its frames take to draw. In our tests, the three.js request took 2.3× as long and the Sauron request 1.8×.
Very heavy pages can fail, and nothing shortens a clip to fit the request's time limit. The other two pages we tested were heavier homepages. The previous recorder returned a clip every time, with 1 to 23 distinct frames. The new one did not:
  • One homepage failed in all three runs. One failure was a timeout. We have not confirmed what caused the other two errors.
  • The other homepage failed once, also for an unconfirmed reason. Its two successful requests took 5.5× to 5.8× the previous recorder's median request time. Their clips had 93 and 78 distinct frames.
There are two other limits:
  • A clip can freeze. If a frame after the first takes longer than 5s, the last good image fills the rest of the clip, and the request can still succeed.
  • Videos on the page can stay still. The recorder moves a playing video to the right time for each frame. For an ordinary video file, this usually needs a server that supports range requests. Without them, the video can stay still.
If the total capture time is the problem, asking for fewer frames can help. A 3s clip at 15 frames per second has 45 frames instead of the default 150, which is 70% fewer to draw.

Try it on your own page

You don't need to turn anything on. New animated screenshots on our main API use this recorder:

The following examples show how to use the Microlink API with CLI, cURL, JavaScript, Python, Ruby, PHP & Golang, targeting 'https://threejs.org/examples/webgl_animation_skinning_blending' URL with 'screenshot' API parameter:

CLI Microlink API example

microlink https://threejs.org/examples/webgl_animation_skinning_blending&screenshot.animated

cURL Microlink API example

curl -G "https://api.microlink.io" \
  -d "url=https://threejs.org/examples/webgl_animation_skinning_blending" \
  -d "screenshot.animated=true"

JavaScript Microlink API example

import createClient from 'microlink.io'

const microlink = createClient()

const data = await microlink.screenshot('https://threejs.org/examples/webgl_animation_skinning_blending', {
  animated: true
})

Python Microlink API example

import requests

url = "https://api.microlink.io/"

querystring = {
    "url": "https://threejs.org/examples/webgl_animation_skinning_blending",
    "screenshot.animated": "true"
}

response = requests.get(url, params=querystring)

print(response.json())

Ruby Microlink API example

require 'uri'
require 'net/http'

base_url = "https://api.microlink.io/"

params = {
  url: "https://threejs.org/examples/webgl_animation_skinning_blending",
  screenshot.animated: "true"
}

uri = URI(base_url)
uri.query = URI.encode_www_form(params)

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
response = http.request(request)

puts response.body

PHP Microlink API example

<?php

$baseUrl = "https://api.microlink.io/";

$params = [
    "url" => "https://threejs.org/examples/webgl_animation_skinning_blending",
    "screenshot.animated" => "true"
];

$query = http_build_query($params);
$url = $baseUrl . '?' . $query;

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET"
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error #: " . $err;
} else {
    echo $response;
}

Golang Microlink API example

package main

import (
    "fmt"
    "net/http"
    "net/url"
    "io"
)

func main() {
    baseURL := "https://api.microlink.io"

    u, err := url.Parse(baseURL)
    if err != nil {
        panic(err)
    }
    q := u.Query()
    q.Set("url", "https://threejs.org/examples/webgl_animation_skinning_blending")
    q.Set("screenshot.animated", "true")
    u.RawQuery = q.Encode()

    req, err := http.NewRequest("GET", u.String(), nil)
    if err != nil {
        panic(err)
    }

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, err := io.ReadAll(resp.Body)
    if err != nil {
        panic(err)
    }

    fmt.Println(string(body))
}
Or run it from your terminal:
npx microlink.io screenshot https://sauron-webgl.vercel.app --animated
Set the length and frame rate with the animated screenshot options.

Start building

Sign up, add the key to your requests, and start turning any link into what you need.
Get your free API key
25 requests/day · Every Pro feature · No credit card
Trusted with 140M+ requests every month