Open beta Leyla is free until December 31, 2026. Preorder at founders’ prices

Download

Scrub previews with nothing made ahead

Most media servers make scrub previews ahead: a sheet of small pictures for every title, made in the background after a scan. On a library of 40,000 titles those sheets took 68 GB, and about 4,000 of the titles were opened in six months. Leyla makes each picture when someone drags to it.

What making them ahead costs

Plex calls them video preview thumbnails and Jellyfin calls them trickplay images; either way they are made ahead, in the background. A preview sheet is a picture every few seconds of a film, stitched together and stored. Making one means decoding through the whole file, so a new library keeps the server busy for days, and the sheets fill a disk with pictures of films nobody scrubs. On our own test library: 68 GB of sheets for 40,000 titles, of which about a tenth were opened in half a year.

How Leyla does it

  1. Ask for keyframes, not seconds

    When a title opens, the app is given the times of the file's keyframes, read from its index, at most a few thousand. It only ever asks for one of those times, so every picture has one address and the second scrub is answered by the browser's cache.

  2. Decode one frame

    The server keeps a small helper running: a patched ffprobe with a thumbnail mode that seeks to a keyframe, decodes that one frame, scales it and writes a JPEG over a pipe. That takes 8 to 30 ms, 25 to 60 ms for 1080p and 4K on our test machine, and seconds only when a sleeping disk has to wake.

  3. Show what you have, then the exact one

    While you drag, the app shows the nearest picture it already holds at once and asks for the exact one, which arrives a few milliseconds later. Requests the finger has passed are cancelled.

  4. Look ahead in the direction you move

    A drag, or a TV remote's right button held down, moves one way. The server decodes the next few points in that direction when a worker is idle, so the next press is already in memory.

What is kept

A picture is kept in memory for a while, and once someone has actually looked at it, on disk for every viewer, for about a week unused and within a size limit. Nothing is made for a title nobody opens. The picture under the seek bar is the frame a seek there would land on, because both come from the same keyframe.

The same helper gives files without chapters their scene chapters, at background priority, only when no viewer is waiting.

Questions

How much space do preview thumbnails take?

On our test library, 68 GB for 40,000 titles. The size grows with the library and with how often a picture is taken.

Why does generating preview thumbnails take so long?

Making a sheet means decoding the whole film. Across a new library that keeps a server busy for days, on a NAS longer.

Can I turn them off?

In most media servers, yes, and you lose the picture under the seek bar. Leyla has none to turn off: each picture is made when someone drags to it.

The result

No background job after a scan, no 68 GB, and a picture under the seek bar the moment you drag, on the web, phones and TVs. Leyla's ffmpeg, with the thumbnail mode, is public at tropicalthink/leyla-ffmpeg.

Something wrong or out of date here? Tell us.