Generate video sprites using just FFmpeg

(steelcm.com)

79 points | by steelcm 2 days ago

24 comments

  • EE84M3i 2 days ago

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

    • wmf 2 days 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 2 days 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 a day 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 a day 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.

  • montroser 2 days 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 a day 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 a day 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 a day 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 a day ago

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

  • bastloing 2 days 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 2 days 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 2 days ago

        Could be a poster frame or chapter frame or chapter marker

    • wslh 2 days ago

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

      • JSR_FDED 2 days 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.

  • brokenmachine 2 days 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.

  • pdyc a day ago

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

    • steelcm a day 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 a day 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 a day ago

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

  • lofaszvanitt a day 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.

  • a day ago
    [deleted]
  • robblbobbl 2 days ago

    Cool thanks