Video preview generating failed

Server: Lokal
Hardware: PC
System: Ubuntu 20.04

  • Nextcloud Version: 24.01
  • PHP Version: 7.4.10
  • Datenbank: MySql

Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, session, standard, sodium, cgi-fcgi, mysqlnd, PDO, xml, apcu, bcmath, bz2, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, gmp, iconv, igbinary, imagick, intl, json, ldap, exif, mysqli, pdlib, pdo_mysql, apc, posix, readline, redis, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, Phar, Zend OPcach

I tried this tutorial to generate video previews

But it won’t work. There are some errors during the generating process.

Many files are on an usb hard disc but the preview generation also ended up with an error with non sftp files.

sudo -u www-data php7.4 /var/www/nextcloud/occ preview:generate-all -vvv

An unhandled exception has been thrown:

TypeError: stream_get_contents() expects parameter 1 to be resource, bool given in /var/www/nextcloud/lib/private/Preview/ProviderV2.php:93
Stack trace:
#0 /var/www/nextcloud/lib/private/Preview/ProviderV2.php(93): stream_get_contents()
#1 /var/www/nextcloud/lib/private/Preview/Movie.php(100): OC\Preview\ProviderV2->getLocalFile()
#2 /var/www/nextcloud/lib/private/Preview/GeneratorHelper.php(65): OC\Preview\Movie->getThumbnail()
#3 /var/www/nextcloud/lib/private/Preview/Generator.php(327): OC\Preview\GeneratorHelper->getThumbnail()
#4 /var/www/nextcloud/lib/private/Preview/Generator.php(159): OC\Preview\Generator->getMaxPreview()
#5 /var/www/nextcloud/lib/private/PreviewManager.php(227): OC\Preview\Generator->generatePreviews()
#6 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(234): OC\PreviewManager->generatePreviews()
#7 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(205): OCA\PreviewGenerator\Command\Generate->parseFile()
#8 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(203): OCA\PreviewGenerator\Command\Generate->parseFolder()
#9 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(203): OCA\PreviewGenerator\Command\Generate->parseFolder()
#10 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(203): OCA\PreviewGenerator\Command\Generate->parseFolder()
#11 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(203): OCA\PreviewGenerator\Command\Generate->parseFolder()
#12 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(183): OCA\PreviewGenerator\Command\Generate->parseFolder()
#13 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(129): OCA\PreviewGenerator\Command\Generate->generateUserPreviews()
#14 /var/www/nextcloud/lib/private/User/Manager.php(656): OCA\PreviewGenerator\Command\Generate->OCA\PreviewGenerator\Command\{closure}()
#15 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(130): OC\User\Manager->callForSeenUsers()
#16 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OCA\PreviewGenerator\Command\Generate->execute()
#17 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run()
#18 /var/www/nextcloud/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#19 /var/www/nextcloud/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#20 /var/www/nextcloud/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run()
#21 /var/www/nextcloud/console.php(99): OC\Console\Application->run()
#22 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')

Error: fopen(sftpread://mnt/ExterneHDD2/Nextcloud//Bilder/2018/07/VID_20180729_213629463.mp4): failed to open stream: "OCA\Files_External\Lib\Storage\SFTPReadStream::stream_open" call failed at /var/www/nextcloud/apps/files_external/lib/Lib/Storage/SFTP.php#381
Can't get app storage, app files_external, user not logged in

Has anyone an idea?

This is my config.php

$CONFIG = array (
  'instanceid' => 'xxxxxxx',
  'passwordsalt' => 'xxxxxxx',
  'secret' => 'xxxxxxx',
  'trusted_domains' => 
  array (
    0 => 'xxxxxxx',
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => 'xxxxxxx',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxxxxxx',
  'dbpassword' => 'xxxxxxx',
  'installed' => true,
  'maintenance' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'overwriteprotocol' => 'https',
  'theme' => '',
  'loglevel' => 2,
  'default_phone_region' => 'GB',
  '' => 'stable',
  'filelocking.enabled' => true,
  'app_install_overwrite' => 
  array (
    0 => 'occweb',
    1 => 'photosphereviewer',
    2 => 'previewgenerator',
    3 => 'gpxmotion',
  'mail_from_address' => 'xxxxxxx',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_smtphost' => 'xxxxxxx',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_domain' => 'xxxxxxx',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'xxxxxxx',
  'mail_smtppassword' => 'xxxxxxx',
  'mail_smtpport' => '587',
  'mail_smtpsecure' => 'tls',
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'jpeg_quality' => '60',
  'encryption.legacy_format_support' => false,
'enable_previews' => true,
  'enabledPreviewProviders' =>
  array (

What do you mean with non sftp files?

Does the preview generation of the Nextcloud demo video work for you? The mp4 file which is in the directory of the user just after creating him or her.

I mean files which are directly uploaded to nextcloud and not that files which are within a sftp mounted directory.

The demo video preview isn’t working

I don’t think this is a bug in the preview app, because it only requests the files from the server to create the preview images in one run. It must have something to do with the external storage, I guess.

I don’t have the preview generator installed, but the preview of the demo video doesn’t work for me either, even though I have the correct provider in config.php and have all the required packages installed.

It doesn’t work with the sftp files and the “normal” uploaded nextcloud files. It has never worked for me and I don’t know why.

Oh, then probably only some php libraries are missing.

And how do I figure it out what’s missing?

no ideas how to fix this?
Its weird because they have a preview picture if i delete the video files. But they have no preview picture if i restore them