Provide Thumbnail generation for Video (local) and certain Document types

Created on 23 September 2022, over 2 years ago
Updated 25 April 2024, 10 months ago

Problem/Motivation

While thumbnail generation works great for other media types like Image, Video (from platform), Slideshow Slide or Slideshow, there's no thumbnail generation available yet for

  • Video (from file)
  • Documents (especially PDFs and others)

What we mainly need, is a media source plugin to provide the preview images to map (admin/structure/media/manage/remote_video) to our custom preview image field, which allows us to overwrite the preview image anytime, if needed.

We typically do not use the core media thumbnail field, as it has some flaws. For example, the preview file can't be simply replaced in UI and currently it's not even possible to regenerate the thumbnail (that's also not possible for our field yet, but at least you can do it manually).

Back to our issue, there are modules that handle media thumbnail generation very well:
https://www.drupal.org/project/media_thumbnails

So option A would be to use the great media_thumbnail functionality to generate our video and document thumbnails, but presumably it will mean, we have to drop our (better) custom preview image field, while the way media_thumbnails works with its providers per file types, is a GREAT idea.

Option B would be to implement some general media source plugins (better in a separate module, not in drowl_media) like https://git.drupalcode.org/project/media_entity_image_exif/-/blob/8.x-1.... does for exif data on images.

For that we'd have to extend https://git.drupalcode.org/project/drupal/-/blob/9.5.x/core/modules/medi... and add the additional information. Eventually, for the video part, we need to require php-ffmpeg to create the thumbnails and the implementation at https://www.drupal.org/project/media_thumbnails_video could help us.

Same for PDF documents https://www.drupal.org/project/media_thumbnails_pdf could help us as basis for our implementation.

In the end the difference to https://www.drupal.org/project/media_thumbnails is that we'd like to expose the thumbnail created as source, instead of storing it to the media core thumbnail field. But then we need a similar ecosystem as the already existing for media_thumbnails.

Wouldn't it then be the best idea to add a functionality based on or for media_thumbnails so we can instead AND also use the result for our custom field?

I created an issue to discuss that (and start implementation once we agree on it) at: #3311530: Provide Thumbnail as MediaSource metadata attribute

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

4.0

Component

Miscellaneous

Created by

🇩🇪Germany Anybody Porta Westfalica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024