Feature #90623
openFAL: video thumbnails in BE module Filelist
Added by Robert von Hackwitz over 4 years ago. Updated 4 months ago.
0%
Description
The thumbnails of video files (eg: .mp4, .avi) are not displayed in the backend filelist module
Updated by Georg Ringer over 4 years ago
- Target version changed from Candidate for Major Version to Candidate for patchlevel
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!
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.
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?
- do we have to check only for common web video formats?
Last but not least: Is it really a bug? Feels like a feature. Has it ever worked in older TYPO3 versions?
Updated by Robert von Hackwitz over 4 years ago
- Tracker changed from Bug to Feature
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
Updated by Philipp Parzer 8 months ago
any new updates on this?
we have this issue now on mobile devices in FE too
Updated by Markus Klein 4 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;
}
}