Project

General

Profile

Actions

Feature #90623

open

FAL: video thumbnails in BE module Filelist

Added by Robert von Hackwitz over 4 years ago. Updated 7 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
-
Start date:
2020-03-03
Due date:
% Done:

0%

Estimated time:
PHP Version:
7.2
Tags:
Complexity:
Sprint Focus:

Description

The thumbnails of video files (eg: .mp4, .avi) are not displayed in the backend filelist module

Actions #1

Updated by Georg Ringer over 4 years ago

  • Target version changed from Candidate for Major Version to Candidate for patchlevel
Actions #2

Updated by Georg Ringer over 4 years ago

  • Status changed from New to Needs Feedback

Thanks for creating this issue!

Are you talking about thumbnails from youtube/vimeo urls which are fetched from the hosting provider or about thumbnails from local mp4 files? The latter never worked as imagemagick can't handle e.g. mp4 files.

thanks for providing some more information!

Actions #3

Updated by Robert von Hackwitz over 4 years ago

Georg Ringer wrote:

Thanks for creating this issue!

Are you talking about thumbnails from youtube/vimeo urls which are fetched from the hosting provider or about thumbnails from local mp4 files? The latter never worked as imagemagick can't handle e.g. mp4 files.

thanks for providing some more information!

Hi Georg I'm talking about local mp4 files.
AFAIK Imagemagick can handle video files if ffmpeg is installed.

Actions #4

Updated by Josef Glatz over 4 years ago

Hi Robert,

I really like the idea. Please provide some more informations:

  • Which binaries MUST be present and executable?
    • is it enough to check for FFmpeg
    • do we also need to check for FFmpeg-probe?
  • Do you have some working command snippets IM + FFmpeg?
  • Do you have some working command snippets GM + FFmpeg? (since graphicsmagick should be prefered for TYPO3)
    • Does it make more sense to use ffmpeg directly instead via the detour of IM / GM?
  • Do we have to handle different formats/subformats of local MP4 video files when generating a poster image out of a file?
  • What about other video formats? you mentioned .avi.
    • do we have to check only for common web video formats?
      • which one are these?
    • is FFmpeg capable of creating poster images aka thumbnail images from any allowed video format file without adding specific arguments and options to convertion?

Last but not least: Is it really a bug? Feels like a feature. Has it ever worked in older TYPO3 versions?

Actions #5

Updated by Robert von Hackwitz over 4 years ago

  • Tracker changed from Bug to Feature
Actions #6

Updated by Robert von Hackwitz over 4 years ago

Hi josef,

First of all forgive me if I answer after more than a month
These are my thoughts on your questions

I think we could check only for ffmpeg

After a few experiments I think we could rely directly on ffmpeg without going through imagemagick/graphickmagick
It would enough if we check on common web video container formats like: mp4,avi,mpeg,flv,wmv,mov,webm,mkv

I've made a little extension as proof of concept.
It is available through github:
https://github.com/robertvonhackwitz/videothumbs

Actions #7

Updated by Philipp Parzer 11 months ago

any new updates on this?
we have this issue now on mobile devices in FE too

Actions #8

Updated by Pierrick Caillon 11 months ago

The snippet is no longer available.

Actions #9

Updated by Markus Klein 7 months ago

  • Status changed from Needs Feedback to New
  • Target version deleted (Candidate for patchlevel)

Also mentioned in https://stackoverflow.com/questions/78142483/how-can-i-generate-a-thumbnail-image-for-video-files-mp4-in-typo3-filelist for v12.

Snippets by ChatGPT

$videoFile = 'video.mp4';
$outputImage = 'preview.jpg';
$timeOffset = 10; // Offset in seconds

$command = "ffmpeg -i $videoFile -ss $timeOffset -vframes 1 $outputImage";
exec($command);

// frame selection by brightness level

function calculateBrightness($imagePath) {
    $imagick = new \Imagick($imagePath);
    $imagick->transformImageColorspace(\Imagick::COLORSPACE_RGB);
    $pixels = $imagick->getImageHistogram();
    $totalBrightness = 0;
    foreach ($pixels as $pixel) {
        $brightness = ($pixel->getColor()['r'] * 0.299) + ($pixel->getColor()['g'] * 0.587) + ($pixel->getColor()['b'] * 0.114);
        $totalBrightness += $brightness;
    }
    return $totalBrightness;
}

$brightnessThreshold = 5000;
$previewImages = glob('preview*.jpg');
$bestImage = null;
$bestBrightness = PHP_INT_MAX;
foreach ($previewImages as $image) {
    $brightness = calculateBrightness($image);
    if ($brightness < $bestBrightness) {
        $bestBrightness = $brightness;
        $bestImage = $image;
    }
}

Actions

Also available in: Atom PDF