30 lines
1.0 KiB
Markdown
30 lines
1.0 KiB
Markdown
# Generating thumbnail tiles using ffmpeg
|
|
> ffmpeg can unsurprisingly build contact sheets, too. Is there anything ffmpeg can't do?
|
|
|
|
I've been organizing my movie collection lately, and I needed a way to figure out what a video is all about without having to
|
|
view & seek it.
|
|
Building a contact sheet is a simple solution for this. It places frames with from the video in a grid separated by
|
|
an interval (like every minute) and you can quickly see what a video contains.
|
|
|
|
## ffmpeg tile filter
|
|
|
|
With anything media-related, I checked to see if ffmpeg supports this: it turns out, it has a `tile` filter[^tile][tile], which gives
|
|
us some primitives to work with.
|
|
|
|
## Covering the whole video
|
|
|
|
```shell
|
|
ffmpeg -skip_frame nokey -i video.mp4 -vf 'scale=320:-1,tile=8x8' -an -vsync 0 keyframes%03d.png
|
|
```
|
|
|
|
This creates n files, each containing 8x8 grid of keyframes from the video.
|
|
It's close, but I need a single file with tiles spanning the video from start to finish.
|
|
|
|
##
|
|
|
|
```shell
|
|
|
|
```
|
|
|
|
[tile]: https://ffmpeg.org/ffmpeg-filters.html#tile-1
|