Skip to content

Fix video thumbnails on newer ffmpeg, add configurable ffmpeg path - #7037

Merged
jaymcnallie merged 1 commit into
codice:masterfrom
andrewkfiedler:819-video-thumbnails-ffmpeg-9
Nov 19, 2026
Merged

jaymcnallie merged 1 commit into
codice:masterfrom
andrewkfiedler:819-video-thumbnails-ffmpeg-9

Conversation

@andrewkfiedler

Copy link
Copy Markdown
Contributor

What does this PR do?

  • ffmpeg 9 dropped the -vsync option, so every thumbnail failed when the plugin ran against it. The thumbnail is now made in a single ffmpeg run that picks a frame from the start, a third in and two thirds in, and writes the GIF directly. GIF output doesn't pad the gaps between frames, so the sync option isn't needed anymore and the same command works on 4.3.1, 8.1.2 and 9.0.2.
  • Short clips now get a 3 frame GIF instead of a single PNG. Videos without a readable duration still get a PNG.
  • Add an optional ffmpegPath setting so an install can use its own ffmpeg instead of the bundled one, which is x86 only. Uninstalling only removes the bundled copy.
  • Fix testVideoThumbnail, which read sample.mp4 as a string and uploaded a corrupted file, so it never actually made a thumbnail. It now checks the metacard has one.
  • Add VideoThumbnailImplFakeFfmpegTest so the new setting and the error handling get tested on any arch.

How should this be tested?

CI covers the unit tests and the itest. I also ran the new command against ffmpeg 4.3.1, 8.1.2 and 9.0.2, and tested it end to end in a downstream project with ffmpegPath pointed at 9.0.2.

Any background context you want to provide?

A downstream project moved to ffmpeg 9 and video thumbnails stopped generating. The old code passed -vsync vfr, which ffmpeg renamed to -fps_mode in 5.1 and removed in 9. I debated probing which flag the binary takes, but that seemed fragile. Instead, the GIF is now written directly, so there's no frame padding to turn off.

With the security manager on, a configured binary outside bin_third_party/ffmpeg needs an execute grant in configurations.policy. That's called out in the docs.

Checklist:

  • Documentation Updated
  • Update / Add Threat Dragon models
  • Update / Add Unit Tests
  • Update / Add Integration Tests

 - ffmpeg 9 dropped the -vsync option, so every thumbnail failed when the plugin ran against it.  The thumbnail is now made in a single ffmpeg run that picks a frame from the start, a third in and two thirds in, and writes the GIF directly.  GIF output doesn't pad the gaps between frames, so the sync option isn't needed anymore and the same command works on 4.3.1, 8.1.2 and 9.0.2.
 - Short clips now get a 3 frame GIF instead of a single PNG.  Videos without a readable duration still get a PNG.
 - Add an optional ffmpegPath setting so an install can use its own ffmpeg instead of the bundled one, which is x86 only.  Uninstalling only removes the bundled copy.
 - Fix testVideoThumbnail, which read sample.mp4 as a string and uploaded a corrupted file, so it never actually made a thumbnail.  It now checks the metacard has one.
 - Add VideoThumbnailImplFakeFfmpegTest so the new setting and the error handling get tested on any arch.
@jaymcnallie
jaymcnallie merged commit a1d462a into codice:master Nov 19, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants