ImageMagickVideoThumbnailError: unable to open image `VIDEO:/tmp/imthumb12321.tmp[100]

166 views
Skip to first unread message

Steli Vali

unread,
Nov 15, 2023, 11:07:35 AM11/15/23
to DSpace Technical Support
Hi guys,

after I followed the documentation on how to activate ImageMagick to generate thumbnails for MP4-Videos, I get this error: 

org.im4java.core.CommandException: convert-im6.q16: unable to open image `VIDEO:/tmp/imthumb1285171159781639618.tmp[100]': No such file or directory @ error/blob.c/OpenBlob/2874

I am using:
DSpace 7.6 
ImageMagick 6.9.10-23
MMPEG 4.2.7

Any help greatly appreciated. I already spent a day on this so I hope that I will manage to solve it. Thank you.

Abel Gómez

unread,
Nov 15, 2023, 2:46:14 PM11/15/23
to DSpace Technical Support
Hi Steli,

does it fail with any video? or only with a specific one? How long is that video?

Did you try to use the ImageMagick PDF filter? Does it work?

On a side note, can you provide info on the system you're using?

Abel

Steli Vali

unread,
Nov 15, 2023, 2:56:55 PM11/15/23
to DSpace Technical Support
Hi Abel,

the video is 20 seconds long and is .mp4 (I have recorded my screen on a Windows Desktop)
Is the only video that I have tried. But it is strange that the error tell that "No such file or directory".
For PDFs works fine, only for MP4 does throw this error.
The server on which DSpace is running is an Ubuntu 20.04. I can see the /tmp/imthumb12321.tmp created, but I guess it breaks when it tries to find "VIDEO:/tmp/imthumb12321.tmp[100]" - file. The code breaks exactly when it tries to run the ops in the ImageMagickVideoThumbnail, when is getting the thumbnail.
So my guess is that some op is breaking it. Maybe I am using a wrong version of ImageMagick or other library and the "VIDEO:/tmp/imthumb12321.tmp[100]" is not processed propery. Which version do you use on your system?

Thank you

Abel Gómez

unread,
Nov 15, 2023, 3:12:22 PM11/15/23
to DSpace Technical Support
Hi Steli,

I use:

Debian 11.8
Dspace 7.6
FFMPEG 4.3.6-0+deb11u1
ImageMagick 6.9.11-60

The " VIDEO:/tmp/imthumb12321.tmp[100]" path refers to frame number 100. It's strange that a 20s. video is less than 20 frames... but, could it be the case?

The "VIDEO:" prefix refers to the ImageMagick "explicit image format" option on input files (see https://imagemagick.org/script/command-line-processing.php#input), and the VIDEO type is specified in the supported file formats list (see https://imagemagick.org/script/formats.php#supported).

Can you test with a different file, e.g., GMT20230623-074346-video.mp4 available at https://hdl.handle.net/11705/SEM/SEM024?

That thumbnail has been generated using this filter.

I can also test with your file directly if it's publicly available and/or if you feel comfortable with it.

Abel

Steli Vali

unread,
Nov 17, 2023, 7:00:02 AM11/17/23
to DSpace Technical Support
Hi Abel,

sorry for the late reply, I had some problems with the ORCID in DSpace and prioritesed that.
I have tested with you file and the same error: convert-im6.q16: unable to open image `VIDEO:/tmp/imthumb12321.tmp[100]': No such file or directory @ error/blob.c/OpenBlob/2874

Also get the same error when I try to execute it directly in terminal: convert -size 640x480 -depth 8 VIDEO:/home/dspace/FAUDSpace.mp4 vidthumb.png
Error: convert-im6.q16: unable to open image `VIDEO:/home/dspace/FAUDSpace.mp4': No such file or directory @ error/blob.c/OpenBlob/2874

What I noticed is that here https://imagemagick.org/script/command-line-processing.php#input the comand is not convert but magick. When I try this command I get "Command 'magick' not found".
However convert -version shows: Version: ImageMagick 6.9.10-23

With ImageMagick 6.9.11 I get the same error when I try "convert VIDEO:/FAUDSpace.mp4 vidthumb.png" or "convert -size 640x480 -depth 8 VIDEO:/FAUDSpace.mp4 vidthumb.png".
The video has 30 Frames/sec and has 7 seconds, so it has 210 frames.

Should I try other command? Or is something wrong with the command or document?

Thank you for helping

Abel Gómez

unread,
Nov 17, 2023, 7:46:10 AM11/17/23
to DSpace Technical Support
Hi Steli,

I confirm that the following works in Debian 11:

```
root@debian11:~# wget https://biblioteca.sistedes.es/bitstreams/a81773f8-aa61-45b5-90f0-ba53a8cf8378/download -q -O video.tmp
root@debian11:~# convert -size 640x480 VIDEO:./video.tmp[100] thumb.jpg
root@debian11:~# ll -h thumb.jpg
-rw-r--r-- 1 root root 183K Nov 17 13:36 thumb.jpg
```

But fails in Ubuntu 20.04 with an error similar to the one you reported:

```
root@UBUNTU20:~# wget https://biblioteca.sistedes.es/bitstreams/a81773f8-aa61-45b5-90f0-ba53a8cf8378/download -q -O video.tmp
root@UBUNTU20:~# convert -size 640x480 VIDEO:./video.tmp[100] thumb.jpg
convert-im6.q16: unable to open image `VIDEO:./video.tmp[100]': No such file or directory @ error/blob.c/OpenBlob/2874.
convert-im6.q16: no decode delegate for this image format `TMP' @ error/constitute.c/ReadImage/572.
convert-im6.q16: no images defined `thumb.jpg' @ error/convert.c/ConvertImageCommand/3258.
root@UBUNTU20:~#
```

Thus, it seems is something related to the Ubuntu distribution rather than DSpace.

In any case, I'll investigate the root cause to see if we can improve the documentation at https://wiki.lyrasis.org/display/DSDOC7x/ImageMagick+Media+Filters#ImageMagickMediaFilters-PossibleErrors/Issues

I feel kind of responsible since I contributed this video filter :)

Cheers,

Abel

Steli Vali

unread,
Nov 17, 2023, 8:26:25 AM11/17/23
to DSpace Technical Support
Hi Abel,

thank you for helping.
I tried it on Ubuntu 22.04 and it works also there.
So it seems to be a problem that occurs on Ubuntu 20.04 (and maybe other OSs), but unrelated to DSpace.
Thank you for help and I am happy to see this feature in DSpace, so that we can provide thumbnails to videos.
(PS: I am lucky that my production system is running on Ubuntu 22.04)

Abel Gómez

unread,
Nov 17, 2023, 8:51:54 AM11/17/23
to DSpace Technical Support
Hi Steli,

I'm writing this message again since it seems it got lost (apologies if, in the end, it's sent twice).

I'm happy to know it works in your production server, but to continue with the discussion (and for the records), I've been able to track down where the error comes from.

It seems that the video format changed its name from "MPEG" to "VIDEO" in ImageMagick 6.9.11-31 (see commit https://github.com/ImageMagick/ImageMagick6/commit/4872c693299802cfe6677742867098f64440d9aa).

Thus, I'm pretty confident that (assuming ImageMagick has enough resources) the following command will indeed work (notice the MPEG vs VIDEO format):

convert -size 640x480 MPEG:./video.tmp[100] thumb.jpg

Thus, I'm also pretty confident that changing "VIDEO" to "MPEG" in line 66 in file `dspace-api/src/main/java/org/dspace/app/mediafilter/ImageMagickVideoThumbnailFilter.java` (see https://github.com/DSpace/DSpace/blob/50b47b707ccc4f0d7ed3887f08f0a88a39686f29/dspace-api/src/main/java/org/dspace/app/mediafilter/ImageMagickVideoThumbnailFilter.java#L66) would also make this filter work in older ImageMagick/Linux distributions (such as ubuntu 20.04).

Since DSpace has to be installed from sources anyway, I think that changing that line in old systems is not a big deal in specific cases.

In any case, ImageMagick delegates are specified in file `/etc/ImageMagick-6/delegates.xml` (you can compare how these files differ between Ubuntu 20.04 and Ubuntu 22.04 and see the MPEG vs VIDEO issue).

Thus, I'll try to see if ImageMagick can be configured in such a way that no modifications to DSpace are needed when running ImageMagick < 6.9.11-31.

Cheers!

Abel

Steli Vali

unread,
Nov 17, 2023, 9:14:58 AM11/17/23
to DSpace Technical Support

Hi Abel,

 

I added in ImageMAgickVideoThumbail:

 

@Autowired

ConfigurationService configurationService;

 

And in method getThumbnailFile at line 65:

String videoFormat = configurationService.getProperty("imagemagick.video.format", "VIDEO"); //default is VIDEO String framerate = configurationService.getProperty("imagemagick.video.framenumber", "100"); //default is 100

 

Also in dspace.cfg I added:

# uncomment only if ImageMagick Version < 6.9.11 imagemagick.video.format = MPEG # change frame number at which a thumbnail is generate #imagemagick.video.framenumber = 100

 

Now I am testing it, as I am not sure if it works and let you know. Yes the frame rate is also a good idea to have as configuration.

 

Best regards,
Steli

Abel Gómez

unread,
Nov 17, 2023, 9:46:28 AM11/17/23
to DSpace Technical Support
Great, thanks for testing.

I had in my todo list to upgrade from DSpace 7.6 to 7.6.1, so I think it's a good opportunity to also do some tests, and send a PR with the findings of our discussion :)

Cheers!

Abel

Steli Vali

unread,
Nov 17, 2023, 10:46:30 AM11/17/23
to DSpace Technical Support
Hi Abel,

tested again, and even if we change the format to MPEG, an error still occurs:
InvalidImageIndex (for any index as I tried with 1, 10, 100 and still get that error)


So maybe the best approach is to mention that the Version of IM must be > 6.9.11, because with 6.9.10 does not work. (or at least not as we need -> works if no frame is specified, but will generate images for all the frames in video)

Best regards,
Steli

Abel Gómez

unread,
Nov 17, 2023, 10:53:30 AM11/17/23
to dspac...@googlegroups.com
Ops!

Thanks for testing then. Since I'm already coding, I can take charge of
doing further tests and updating the documentation/code where needed.

Just one comment regarding the VIDEO vs MPEG issue: it's not version
6.9.11 exactly, it's 6.9.11-31 (6.9.11-30 still uses the MPEG format
name :)).

Thanks!

Abel


El 17/11/2023 a las 16:46, Steli Vali escribió:
> Hi Abel,
>
> tested again, and even if we change the format to MPEG, an error still
> occurs:
> InvalidImageIndex (for any index as I tried with 1, 10, 100 and still
> get that error)
>
> It is also a Bug reported about something similar here: IM7: subimage
> specification returns no images - Legacy ImageMagick Discussions Archive
> <https://legacy.imagemagick.org/discourse-server/viewtopic.php?t=35435>
> https://github.com/ImageMagick/ImageMagick6/commit/4872c693299802cfe6677742867098f64440d9aa <https://github.com/ImageMagick/ImageMagick6/commit/4872c693299802cfe6677742867098f64440d9aa>).
>
> Thus, I'm pretty confident that (assuming ImageMagick has
> enough resources) the following command will indeed work
> (notice the MPEG vs VIDEO format):
>
> convert -size 640x480 MPEG:./video.tmp[100] thumb.jpg
>
> Thus, I'm also pretty confident that changing "VIDEO" to
> "MPEG" in line 66 in file
> `dspace-api/src/main/java/org/dspace/app/mediafilter/ImageMagickVideoThumbnailFilter.java` (see https://github.com/DSpace/DSpace/blob/50b47b707ccc4f0d7ed3887f08f0a88a39686f29/dspace-api/src/main/java/org/dspace/app/mediafilter/ImageMagickVideoThumbnailFilter.java#L66 <https://github.com/DSpace/DSpace/blob/50b47b707ccc4f0d7ed3887f08f0a88a39686f29/dspace-api/src/main/java/org/dspace/app/mediafilter/ImageMagickVideoThumbnailFilter.java#L66>) would also make this filter work in older ImageMagick/Linux distributions (such as ubuntu 20.04).
> https://biblioteca.sistedes.es/bitstreams/a81773f8-aa61-45b5-90f0-ba53a8cf8378/download <https://biblioteca.sistedes.es/bitstreams/a81773f8-aa61-45b5-90f0-ba53a8cf8378/download> -q -O video.tmp
> root@debian11:~# convert -size 640x480
> VIDEO:./video.tmp[100] thumb.jpg
> root@debian11:~# ll -h thumb.jpg
> -rw-r--r-- 1 root root 183K Nov 17 13:36 thumb.jpg
> ```
>
> But fails in Ubuntu 20.04 with an error similar to
> the one you reported:
>
> ```
> root@UBUNTU20:~# wget
> https://biblioteca.sistedes.es/bitstreams/a81773f8-aa61-45b5-90f0-ba53a8cf8378/download <https://biblioteca.sistedes.es/bitstreams/a81773f8-aa61-45b5-90f0-ba53a8cf8378/download> -q -O video.tmp
> root@UBUNTU20:~# convert -size 640x480
> VIDEO:./video.tmp[100] thumb.jpg
> convert-im6.q16: unable to open image
> `VIDEO:./video.tmp[100]': No such file or directory
> @ error/blob.c/OpenBlob/2874.
> convert-im6.q16: no decode delegate for this image
> format `TMP' @ error/constitute.c/ReadImage/572.
> convert-im6.q16: no images defined `thumb.jpg' @
> error/convert.c/ConvertImageCommand/3258.
> root@UBUNTU20:~#
> ```
>
> Thus, it seems is something related to the Ubuntu
> distribution rather than DSpace.
>
> In any case, I'll investigate the root cause to see
> if we can improve the documentation at
> https://wiki.lyrasis.org/display/DSDOC7x/ImageMagick+Media+Filters#ImageMagickMediaFilters-PossibleErrors/Issues <https://wiki.lyrasis.org/display/DSDOC7x/ImageMagick+Media+Filters#ImageMagickMediaFilters-PossibleErrors/Issues>
>
> I feel kind of responsible since I contributed this
> video filter :)
>
> Cheers,
>
> Abel
>
> El viernes, 17 de noviembre de 2023 a las 13:00:02
> UTC+1, Steli Vali escribió:
>
> Hi Abel,
>
> sorry for the late reply, I had some problems
> with the ORCID in DSpace and prioritesed that.
> I have tested with you file and the same error:
> convert-im6.q16: unable to open image
> `VIDEO:/tmp/imthumb12321.tmp[100]': No such file
> or directory @ error/blob.c/OpenBlob/2874
>
> Also get the same error when I try to execute it
> directly in terminal: convert -size 640x480
> -depth 8 VIDEO:/home/dspace/FAUDSpace.mp4
> vidthumb.png
> Error: convert-im6.q16: unable to open image
> `VIDEO:/home/dspace/FAUDSpace.mp4': No such file
> or directory @ error/blob.c/OpenBlob/2874
>
> What I noticed is that here
> https://imagemagick.org/script/command-line-processing.php#input <https://imagemagick.org/script/command-line-processing.php#input> the comand is not convert but magick. When I try this command I get "Command 'magick' not found".
> https://imagemagick.org/script/command-line-processing.php#input <https://imagemagick.org/script/command-line-processing.php#input>), and the VIDEO type is specified in the supported file formats list (see https://imagemagick.org/script/formats.php#supported <https://imagemagick.org/script/formats.php#supported>).
>
> Can you test with a different file, e.g.,
> GMT20230623-074346-video.mp4 available at
> https://hdl.handle.net/11705/SEM/SEM024
> <https://hdl.handle.net/11705/SEM/SEM024>?
> --
> All messages to this mailing list should adhere to the Code of Conduct:
> https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx
> <https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx>
> ---
> You received this message because you are subscribed to the Google
> Groups "DSpace Technical Support" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to dspace-tech...@googlegroups.com
> <mailto:dspace-tech...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dspace-tech/bca19427-0cbe-48a3-9763-c8945c804e1cn%40googlegroups.com <https://groups.google.com/d/msgid/dspace-tech/bca19427-0cbe-48a3-9763-c8945c804e1cn%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
Abel Gómez Llana, PhD

ab...@gomez.llana.me
https://abel.gomez.llana.me

Reply all
Reply to author
Forward
0 new messages