Repository navigation
Muxer Sprite Sheet
spritevtt turns a stream of thumbnails into one tiled sprite sheet image and a WebVTT file that says which tile belongs to which time. A player uses the pair for scrubbing previews.
The muxer is NoMercy-only. It is not in official FFmpeg.
Since: v1.0.34.
# One thumbnail every 5 seconds, 160x90 each. Writes out.webp and out.vtt.
ffmpeg -i input.mp4 -vf "fps=1/5,scale=160:90" -f spritevtt out.webpThe VTT file sits next to the image and has the same name with .vtt. Each cue points at a tile with the W3C Media Fragments #xywh= form:
WEBVTT
00:00:00.000 --> 00:00:05.000
out.webp#xywh=0,0,160,90
00:00:05.000 --> 00:00:10.000
out.webp#xywh=160,0,160,90
This output was produced on v1.0.47 from a 20 s clip. It gave a 2 by 2 grid and four cues.
More examples:
# PNG, ten tiles per row
ffmpeg -i input.mp4 -vf "fps=1/10,scale=160:90" -f spritevtt -sprite_columns 10 out.png
# Another name for the VTT file, and full image paths in the cues
ffmpeg -i input.mp4 -vf "fps=1/5,scale=160:90" -f spritevtt -vtt_filename thumbs.vtt -relative_path 0 out.webpThe table is copied from ffmpeg -h muxer=spritevtt of v1.0.47.
| Option | Type | Default | Range | What it does |
|---|---|---|---|---|
sprite_columns |
int | 0 |
0 to 1000 | Number of columns in the grid. 0 makes a square-ish grid: ceil(sqrt(n)) columns for n frames. |
vtt_filename |
string | empty | Name for the VTT file. It is placed in the same directory as the image. Empty means the image name with .vtt. |
|
relative_path |
boolean | true |
Write only the image file name in the cues. With 0 the cues carry the output path exactly as you gave it. |
- It needs exactly one video stream. Anything else is an error.
- The image format comes from the output extension.
.webpwrites WebP. Any other extension writes PNG. - The tiles are read in order, left to right, top to bottom.
- A cue lasts until the next frame's time. The last cue repeats the spacing of the two frames before it. A single frame gets 5 seconds.
- Unused tiles at the end of the grid are painted black. YUV input is filled with black in the right range, not with green.
- With no frames at all the muxer writes an empty VTT file and logs a warning.
- It keeps every frame in memory until the end, then writes both files. Use a low frame rate and small tiles.
WebP images are at most 16383 by 16383 pixels. A bigger grid stops with an error that suggests fewer frames, smaller tiles or PNG.
The output directory must exist. See Auto-Create-Directories.
The muxer is in every platform archive. It needs the WebP and PNG encoders, which every build has.
Users
Filters and components
- Filter-stemsplit
- Filter-lyricsalign
- Whisper-Language-Detection
- Whisper-Word-Timestamps
- Filter-trailingsilence
- Filter-keydetect
- Filter-beatdetect
- Filter-rubberband
- Muxer-Sprite-Sheet
- Muxer-Chapter-VTT
- Muxer-VOBsub
- Protocol-dvdread
- Protocol-OmniDrive
- Auto-Create-Directories
- AACS-and-BDplus
- HLS-Master-Playlist
- Subtitles-OCR
- HEVC-Alpha
Acceleration and codecs
Contributors