Hardware based thumbnail generation (nvidia)

Hey!

I’v been using nexcloud close to a year on my tiny Nvidia Jetson Nano. Been ok so far. The reason for my post is the about the preview generator. My question is how would I go about doing the following.

  1. Not generate previews and store them on disk for the types JPEG, MP4 (h264/h265)
  2. Call an external program to handle generating the thumbnail/preview for JPEGs and MP4s

The reason I ask is because on the jetson nano I’ve hardware encoder/decoder for the said formats. And offloading the thumbnail generation to hardware/GPU won’t impact the CPU (that much), plus its lightning fast (300 thumbnails generated before you can blink).

Some folks may benefit from Intels quicksync

I’m a noob when it comes to PHP but I’m comfortable with C. So if someone can help me point to some docs (line of code to hack) to call the external function. Would it be better to use a shared library?

Software stack :
Nextcloud version : 20.0.7
Operating system and version: Ubuntu 18.04.6 LTS
Apache or nginx version: 2.4.29
PHP version: 7.2.24

There is something in the bug tracker of the previewgenerator:

That’s not quite the same, but thanks, I know what to search for now (keywords like imagemagick + previewGenerator). I’ll keep my quest going till I succeed or fail :slight_smile: . I think what that bug was referring to is using imagemagick’s opencl php bindings, it would be good at resizing, not encoding and decoding. What I’m trying to do is to offload the decode+resize+encode to the hardware and not use cpu at all.

Sorry, it wasn’t exactly the same. There are also some guides, how you can offload the preview generation via cronjobs and run all the generation at night. Having a some specific piece of software (in C or any other language) and run it via cron, can be an option. But the thing with the GPU would be to do it in real time as you check the folders.

I’m running a cron already every 10 mins to generate the previews. What I’d like to do is not to create previews for JPEGs MP4s (that I can do), but instead trigger an on the fly resize. It seems like the photo app has webdav calls that request these thumbnail files. I think its going to be a bit more involved than just the preview generator. It would be a change on the front end as well :confused: .

1 Like