omeka / omeka-s

Omeka S is a web publication system for universities, galleries, libraries, archives, and museums. It consists of a local network of independently curated exhibits sharing a collaboratively built pool of items, media, and their metadata.
GNU General Public License v3.0
403 stars 135 forks source link

Thumbnails creation fails for MP4 video #1841

Closed jajm closed 2 years ago

jajm commented 2 years ago

If I try to upload an MP4 video file, the thumbnails are not created.

These errors appear in log file:

2022-05-11T10:12:34+00:00 ERR (3): convert: unable to open image `mpeg:/tmp/omekaZZcxkR[0]': No such file or directory @ error/blob.c/OpenBlob/2924.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/575.
convert: no images defined `/tmp/omekaZdePvT.jpg' @ error/convert.c/ConvertImageCommand/3229.

Here is a short video for testing: https://user-images.githubusercontent.com/306836/167829151-008771ae-adaa-400f-a170-387f8a47a83b.mp4

If I change mpeg: to mp4: in application/src/File/Thumbnailer/ImageMagick.php and re-upload the file, then the thumbnail creation works.

Of course changing the "prefix" in thumbnailer code is not a practical solution. But maybe if the temporary file kept the extension of the original file, there will be no need for the prefix at all ?

zerocrates commented 2 years ago

Can you share what version of ImageMagick you're using? It would be good to know if this is something that's version-specific.

jajm commented 2 years ago

I'm using the debian package for bullseye (https://packages.debian.org/bullseye/imagemagick, 8:6.9.11.60+dfsg-1.3)

convert --version says:

Version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org
Copyright: (C) 1999-2021 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(4.5) 
Delegates (built-in): bzlib djvu fftw fontconfig freetype heic jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff webp wmf x xml zlib
zerocrates commented 2 years ago

OK, thanks.

It looks like where other versions I'm familiar with have listed "mpeg" as the name of the generic video support, this Debian one has "video." From some poking around, it looks like this is something they changed in ImageMagick 6.9.11-31.

Does setting the "prefix" to video also work for you? I think it should.

Using "mp4" or something similar is probably the best approach for the time being... it looks like it should work fine for both versions, we'll just have to do some testing to confirm on the older ones where "mpeg" is currently working.

jajm commented 2 years ago

Does setting the "prefix" to video also work for you? I think it should.

Yes it does

zerocrates commented 2 years ago

I'll do some more investigation but I believe the root of this issue is just that there's actually a bug with the "mpeg" format specifically in your newer version, such that using "mp4" where we previously used "mpeg" is actually a viable solution here.

Including the extension with the temp filename is an option as well but would require more in the way of changes.