Quite confused about Nextcloud previewgenerator & thumbnails in general

Can some one shed a little light on prevewgenerator for me, should i remove it ? Was i not supposed to use it? Did i use it wrong? Is it working exactly as it is supposed to? Im really not sure.

I only started looking at the previewgenerator because i needed mp4 video thumbnails. I think all i needed to do was to install ffmpeg and adjust the config.php file a little, but i ended up installing previewgenerator.

Truenas / Nextcloud in a jail (both fully up to date on stable branches)

What i have already done :-

I installed & activated the app.

I added

su -m www -c 'php /usr/local/www/nextcloud/occ preview:pre-generate'

to crontab (every 30 mins.

crontab -u www -e

I ran

su -m www -c 'php /usr/local/www/nextcloud/occ preview:generate-all -vvv'

When i ran It, it was indexing all the image files that it could find. It took a few hours but it did finish without error.
It created a 10GB folder called preview that I’m not sure about, i mean 10GB for thumbnails? But i do have a lot of photos so maybe.

root@nextcloud:/mnt/files/appdata_ocfuu1fbyyca # du -sh preview/*
701M    preview/0
646M    preview/1
613M    preview/2
622M    preview/3
625M    preview/4
654M    preview/5
677M    preview/6
705M    preview/7
663M    preview/8
709M    preview/9
649M    preview/a
635M    preview/b
706M    preview/c
648M    preview/d
635M    preview/e
627M    preview/f

The mp4 files now do have thumbnails, but i think that was just because i installed ffmpeg. I don’t see exactly what else previewgenerator is supposed to do as the thumbnails in both “photos” and “memories” still seem to load on demand. If you scroll down reasonably fast you have to wait a few seconds for the thumbnails to catch up.

Can some one shed a little light for me, should i remove previewgenerator ? Was i not supposed to use it? Did i use it wrong? Is it working exactly as it is supposed to? Im really not sure.

I was about to remove it & remove the “preview” folder and see what happens because i don’t think its actually doing anything that i can tell.

I thought i would ask here though.

The short answer: it depends.

Mostly on your compute capacity, your desire to save disk space versus on-demand CPU usage, your Nextcloud version, the version of the apps involved (previewgenerator, photos, memories, etc.), what types of files you’re working with, typical size of the files you’re working with (e.g. previews by default aren’t generated for large images), your deployed apps and their expectations (i.e. Memories has different preview needs than Photos), and whether you’re using object/external storage or strictly local storage.

(I’ve probably missed a few! hah)


  • there have been recent capability changes (added in NC26) to better manage concurrency for the on-demand generation
  • there are some alternatives too like Imaginary: Server tuning — Nextcloud latest Administration Manual latest documentation
  • the level of performance in even the smallest NC deployments has probably increased a bit over the years
  • preview configuration (image sizes/quality, memory limits)
  • bugs (it happens)

The docs could probably use some collective revisiting to pull this stuff together a bit better.

Sorry this is more an overview and acknowledgement than a specific “how to” for you. But perhaps it’ll trigger some ideas for you since you’re the one most familiar with what you’re doing, what you’ve got installed, and what you’ve got to work with.

1 Like

CPU: 24-core Intel Xeon E5-2697 v2 (-MCP-) speed: 2693 MHz
OS: 13.1-RELEASE-p7 amd64
Mem: 128GB ECC / 98GB free
Storage: 28.43 TiB (4.4% used)
Procs: 175
Shell: Bash

Nextcloud 26.0.2

Thx for your response. I suppose what i was really after was what exactly is this app supposed to do? what does it look like? Do i even need it.

Well anyhow, I had already removed it and deleted (renamed) the “preview” folder, i rebooted the jail and to tell the truth i can not tell any difference at all. This is why I’m asking what its supposed to do.

I’v moved on to searching for a duplicate photo (file) finder/remover now (any good suggestions?). I might revisit this thumbnail thing if my users complain about the thumbs loading times, but i dont think they will, as it is only a couple of seconds to wait for the thumbs to catch up.

The optional previewgenerator app attempts to minimize the need to generate previews on-demand, which is particularly useful on systems with limited CPU capacity (think Raspberry Pi). Also, in the past the (default) on-demand preview capability would (could) slam a server because it lacked the knobs to tune to CPU/core count. Using the previewgenerator app to create as many of the previews ahead of time rather than on-demand was a workaround for that situation as well.

As of NC26 the lack of awareness of CPU/core count is not an issue (the default on-demand generator detects CPU/core count and also provides manual overrides in config.php if further customization is desired).

The optional previewgenerator app is not necessary for MP4s, no. It just may be effectively necessary for low CPU capacity systems. :slight_smile:

1 Like

Ok, thx for the advice. I suspect that the thumbs dont really affect me to much (just a few seconds wait here and there) as my system can handle it reasonably well.

I may revisit this preview generator a bit later, we shall see.


Only for the record (for people landing here by the search function):

You can safely delete the preview folder or at least move it into an other directory outside of the installation path (not simply renaming it inside of the appdata_<$instanceid> folder).
Then you should create a new empty data/appdata_<$instanceid>/preview folder and run
occ files:scan-app-data preview
to get the database back in sync.

1 Like