Video thumbnails not generated or showing

Nextcloud version (eg, 29.0.5): 27.1.3
Operating system and version (eg, Ubuntu 29.04): Ubuntu 20.04.4 LTS
Apache or nginx version (eg, Apache 2.4.25): nginx/1.18.0
PHP version (eg, 8.3): 8.1

The issue you are facing:
I have mp4 files that are missing thumbnails.

ffmpeg is installed. It’s path is included in the PATH environment variable and the path is one of the paths used by NextCloud when looking for ffmpeg (can’t seem to find the GitHub link to that code anymore). ffmpeg has execute permissions for User, Group, and Other.

imagemagick and ghostscript are both installed and up to date.

My config includes;

'enable_previews' => true,
  'enabledPreviewProviders' =>
  array (
    0 => 'OC\\Preview\\TXT',
    1 => 'OC\\Preview\\MarkDown',
    2 => 'OC\\Preview\\OpenDocument',
    3 => 'OC\\Preview\\PDF',
    4 => 'OC\\Preview\\MSOffice2003',
    5 => 'OC\\Preview\\MSOfficeDoc',
    6 => 'OC\\Preview\\Image',
    7 => 'OC\\Preview\\Photoshop',
    8 => 'OC\\Preview\\TIFF',
    9 => 'OC\\Preview\\SVG',
   10 => 'OC\\Preview\\Font',
   11 => 'OC\\Preview\\MP3',
   12 => 'OC\\Preview\\Movie',
   13 => 'OC\\Preview\\MKV',
   14 => 'OC\\Preview\\MP4',
   15 => 'OC\\Preview\\AVI',
  ),

Running occ preview:generate-all, I can see that it finds the video files and I get “Generating previews for…” and no errors. Nothing is output to the log.

I’ve read through every post I can find on the issue, and many are either related to ffmpeg or config not being correct. It seems many of those posting never find a solution. Is there anything else I can try / anything else I can do to troubleshoot short of stepping through the code?

First of all you should check your Nextcloud log file for any related errors. As I activated the video preview, some required libraries were missing on the server which ffmpeg requires to generate the files.

":"Movie preview generation failed Output: /usr/bin/ffmpeg: error while loading shared libraries: libzimg.so.2: cannot open shared object file: No such file or directory"

Next I tested if the preview generation is worked without any errors by execution the following command on the console. (The movie file has been moved to a test folder):

/usr/bin/ffmpeg -y -ss 3 -i /tmp/PREVIEW/test.mp4 -f mjpeg -vframes 1 /tmp/PREVIEW/test.jpg; echo $?

After this has worked without any issues and the generated jpg-file showed what I expected, I restarted my web server and php to make sure the image isn’t fetched from the cache.

It’s path is included in the PATH environment variable

BTW, I found out that a new configuration parameter has been introduced with NC 28.x (?) which allows to set the ffmpeg path:

'preview_ffmpeg_path' => '/usr/bin/ffmpeg',

Thanks for a response with definite actions I could take.

Nothing is written to the log during preview generation.

Executing ffmpeg directly results in a valid jpg from an mp4 file that I copied from NextCloud, so we know ffmpeg and it’s dependencies are there.

I’ve tried restarting php and nginx, but it’s made no difference.

There ain’t no preview providers "MKV", "MP4" and/or "AVI". Only "Movie".
Remove those fantasy providers from the array and then it should normaly work.

Fingers crossed!
:hand_with_index_finger_and_thumb_crossed:


Much and good luck,
ernolf

1 Like