Generate video sprites using just FFmpeg

80 pointsposted 10 months ago
by steelcm

25 Comments

EE84M3i

10 months ago

Is it common to call these sprites in British English? I would call them "thumbnails".

wmf

10 months ago

The term "sprite" is mostly used in games. A single image file that contains multiple sub-images is called a "sprite sheet". (This reduces overhead compared to loading a large number of image files.) In this case they happen to be video thumbnails.

allenu

10 months ago

I'll admit I was expecting an explanation of how to extract sprites from retro video game footage using FFmpeg, which I can see totally being possible with a bit of work.

dlcarrier

10 months ago

I was thinking the opposite: Using FFmpeg as a sprite engine, to move sprites around, over background layers

Overlaying them at fixed positions is trivially easy, but animating the movement may take some work.

steelcm

10 months ago

Maybe thumbnail sprite sheet is a more accurate term? I would have thought thumbnail on it's own doesn't represent the fact we're stitching together all the thumbnails of the video into a single image.

bastloing

10 months ago

Back in the day a sprite was a smaller 2d bitmap you'd superimpose on the screen. A key frame was a marker like this.

smitelli

10 months ago

I’m trying to remember the name of a UI control that could be backed by something like this. It was a sequence of thumbnails laid out in a row like a film strip. (For all I know, that was what it was called.)

bastloing

10 months ago

Could be a poster frame or chapter frame or chapter marker

wslh

10 months ago

Yes, and the sprites were supported by a specific coprocessor. For example, the Apple II didn't have one.

JSR_FDED

10 months ago

We had to make do with Shape Tables in AppleSoft BASIC…good times drawing those out manually on graph paper. And then XOR-ing them onto the background. Amazing how good games were on the Apple ][ without dedicated graphics hardware.

montroser

10 months ago

A long time ago, we used this approach to play videos at 15 fps in IE6, with no flash or realplayer plugins required! No sound though...

jvan

10 months ago

I've used vcs[0] to make contact sheets from videos. It has a nice feature that if it detects the frame is blacked out, it will shift the capture time so every frame on the sheet has something to look at. Easy syntax to set capture at every delta or capture x number of frames evenly distanced, columns per row, ignore a set length of end time, and frame size.

[0] https://p.outlyer.net/vcs

steelcm

10 months ago

This sounds like a more robust tool, however I wanted to keep our external tooling to a minimum. The contact sheet generation sits as part of our transcoding pipeline for uploaded media which already uses ffmpeg.

jvan

10 months ago

vcs is a 5000-line bash script wrapper around ImageMagick and FFmpeg, any features you want can be extracted to your own scripting.

kookamamie

10 months ago

A "sprite" is commonly understood to have no background, so I'd say these are closer to thumbnails.

brokenmachine

10 months ago

I wish there was some way to get vlc to use external sprite files.

While I'm thinking about it, external chapter files would be great too. Then you could make your own bookmarks without modifying the video file.

yyx

10 months ago

You can make a playlist with start-time and stop-time.

https://scriptun.com/tools/video/m3u-playlist-generator

That would be a great way to create smyths (streamlined mythbusters).

brokenmachine

10 months ago

Thanks, that is something to think about.

Doesn't seem to support multiple chapters on a single file (without janky stopping and starting, that is).

lofaszvanitt

10 months ago

I get chills every time I watch this open source video. I don't know who created these mongrel creatures, but it's worse than a horror flick.

pdyc

10 months ago

interesting will probably integrate as sprite mode in my ffmpeg video editor https://newbeelearn.com/tools/videoeditor/

steelcm

10 months ago

We're using this method as part of our user media upload pipeline at editsquare.com I'm guessing you're using ffmpeg wasm on your editor? One thing to note, that I didn't mention in the article, is generating a JPEG output is substantially quicker than a PNG.

pdyc

10 months ago

good to know and great product as well editsquare.com .Would probably contact you for api sometime in future(hope to get hn discount ;-) )

steelcm

10 months ago

Hah! Of course. We're hoping to release our video editor early next year. So keep an eye out.

user

10 months ago

[deleted]