# HEIC/MOV previews

**URL:** <https://help.nextcloud.com/t/heic-mov-previews/62973>\
**Category:** ℹ️ Support\
**Tags:** preview, nc16, heic\
**Created:** [October 28, 2019, 7:35pm UTC](https://help.nextcloud.com/t/heic-mov-previews/62973 "2019-10-28T19:35:18Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dridhas](https://help.nextcloud.com/letter_avatar/dridhas/32/6_449c533f586939b6e5f246632a46421f.png) [@Dridhas](https://help.nextcloud.com/u/Dridhas)\
**Post date:** [October 28, 2019, 7:35pm UTC](https://help.nextcloud.com/t/heic-mov-previews/62973/1 "2019-10-28T19:35:18Z")

</div>

Hello All,

i recently cleared the cache on my Nextcloud iOS app and realized that the previews are not being regenerated because they are HEIC pics or MOV videos.

The previews will only come on only when accessing the picture, not the mov video.

is there a way to generate previews like with JPEG/MP4?

im running Nextcloud on Ubuntu server 18.04.

Thanks in advance for your help/assistance.

Regards!

---

<div class="post-metadata">

**Author:** ![anon9582441](https://help.nextcloud.com/letter_avatar/anon9582441/32/6_449c533f586939b6e5f246632a46421f.png) [@anon9582441](https://help.nextcloud.com/u/anon9582441)\
**Post date:** [October 28, 2019, 9:07pm UTC](https://help.nextcloud.com/t/heic-mov-previews/62973/2 "2019-10-28T21:07:42Z")

</div>

It is probably because of missing support in ffmpeg or Imagemagick. Check that.

---

<div class="post-metadata">

**Author:** ![Dridhas](https://help.nextcloud.com/letter_avatar/dridhas/32/6_449c533f586939b6e5f246632a46421f.png) [@Dridhas](https://help.nextcloud.com/u/Dridhas)\
**Post date:** [October 29, 2019, 1:24am UTC](https://help.nextcloud.com/t/heic-mov-previews/62973/3 "2019-10-29T01:24:00Z")

</div>

i just installed both, restarted apache and nothing so far.

unless im missing something else on those 2.

Regards!

---

<div class="post-metadata">

**Author:** ![Dridhas](https://help.nextcloud.com/letter_avatar/dridhas/32/6_449c533f586939b6e5f246632a46421f.png) [@Dridhas](https://help.nextcloud.com/u/Dridhas)\
**Post date:** [October 29, 2019, 2:01am UTC](https://help.nextcloud.com/t/heic-mov-previews/62973/4 "2019-10-29T02:01:05Z")

</div>

Safari works normally for MOV videos, but not preview HEIF.

Opera works only when downloading a plugin for MOV, but will not preview HEIF

Chrome does not play completely MOV files, will not preview HEIF files

Regards!

---

<div class="post-metadata">

**Author:** ![j-ed](https://help.nextcloud.com/user_avatar/help.nextcloud.com/j-ed/32/7281_2.png) [@j-ed](https://help.nextcloud.com/u/j-ed)\
**Post date:** [October 29, 2019, 9:09am UTC](https://help.nextcloud.com/t/heic-mov-previews/62973/5 "2019-10-29T09:09:52Z")

</div>

> [@Dridhas](#):
>
> is there a way to generate previews like with JPEG/MP4?

If you’ve installed the [Preview Generator app](https://apps.nextcloud.com/apps/previewgenerator) you should be able to pre-generate new previews.

---

<div class="post-metadata">

**Author:** ![Dridhas](https://help.nextcloud.com/letter_avatar/dridhas/32/6_449c533f586939b6e5f246632a46421f.png) [@Dridhas](https://help.nextcloud.com/u/Dridhas)\
**Post date:** [October 29, 2019, 1:21pm UTC](https://help.nextcloud.com/t/heic-mov-previews/62973/6 "2019-10-29T13:21:50Z")

</div>

i do have the Preview Generator App and if im not mistaken, ive got a cron job to run it every 15 mins (need to confirm what is running).

Unless the cron job is not running the preview generator and is running something else.

---

<div class="post-metadata">

**Author:** ![Dridhas](https://help.nextcloud.com/letter_avatar/dridhas/32/6_449c533f586939b6e5f246632a46421f.png) [@Dridhas](https://help.nextcloud.com/u/Dridhas)\
**Post date:** [November 5, 2019, 12:30am UTC](https://help.nextcloud.com/t/heic-mov-previews/62973/7 "2019-11-05T00:30:36Z")

</div>

so, these are the cron jobs running on my Nextcloud (taken from webmin) and they are running every 15 mins.

php -f /var/www/html/nextcloud/cron.php  
php -f /var/www/html/nextcloud/occ preview:pre-generate

this is what the cron.php looks like for me:

require\_once **DIR**. ‘/lib/versioncheck.php’;

try {

```
require_once __DIR__. '/lib/base.php';

if (\OCP\Util::needUpgrade()) {
	\OC::$server->getLogger()->debug('Update required, skipping cron', ['app' => 'cron']);
	exit;
}
if ((bool) \OC::$server->getSystemConfig()->getValue('maintenance', false)) {
	\OC::$server->getLogger()->debug('We are in maintenance mode, skipping cron', ['app' => 'cron']);
	exit;
}

// load all apps to get all api routes properly setup
OC_App::loadApps();

\OC::$server->getSession()->close();

// initialize a dummy memory session
$session = new \OC\Session\Memory('');
$cryptoWrapper = \OC::$server->getSessionCryptoWrapper();
$session = $cryptoWrapper->wrapSession($session);
\OC::$server->setSession($session);

$logger = \OC::$server->getLogger();
$config = \OC::$server->getConfig();

// Don't do anything if Nextcloud has not been installed
if (!$config->getSystemValue('installed', false)) {
	exit(0);
}

\OC::$server->getTempManager()->cleanOld();

// Exit if background jobs are disabled!
$appMode = $config->getAppValue('core', 'backgroundjobs_mode', 'ajax');
if ($appMode === 'none') {
	if (OC::$CLI) {
		echo 'Background Jobs are disabled!' . PHP_EOL;
	} else {
		OC_JSON::error(array('data' => array('message' => 'Background jobs disabled!')));
	}
	exit(1);
}

if (OC::$CLI) {
	// set to run indefinitely if needed
	if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
		@set_time_limit(0);
	}

	// the cron job must be executed with the right user
	if (!function_exists('posix_getuid')) {
		echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL;
		exit(1);
	}
	$user = posix_getpwuid(posix_getuid());
	$configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php'));
	if ($user['name'] !== $configUser['name']) {
		echo "Console has to be executed with the same user as the web server is operated" . PHP_EOL;
		echo "Current user: " . $user['name'] . PHP_EOL;
		echo "Web server user: " . $configUser['name'] . PHP_EOL;
		exit(1);
	}

	// We call Nextcloud from the CLI (aka cron)
	if ($appMode !== 'cron') {
		$config->setAppValue('core', 'backgroundjobs_mode', 'cron');
	}

	// Work
	$jobList = \OC::$server->getJobList();

	// We only ask for jobs for 14 minutes, because after 15 minutes the next
	// system cron task should spawn.
	$endTime = time() + 14 * 60;

	$executedJobs = [];
	while ($job = $jobList->getNext()) {
		if (isset($executedJobs[$job->getId()])) {
			$jobList->unlockJob($job);
			break;
		}

		$job->execute($jobList, $logger);
		// clean up after unclean jobs
		\OC_Util::tearDownFS();

		$jobList->setLastJob($job);
		$executedJobs[$job->getId()] = true;
		unset($job);

		if (time() > $endTime) {
			break;
		}
	}

} else {
	// We call cron.php from some website
	if ($appMode === 'cron') {
		// Cron is cron :-P
		OC_JSON::error(array('data' => array('message' => 'Backgroundjobs are using system cron!')));
	} else {
		// Work and success :-)
		$jobList = \OC::$server->getJobList();
		$job = $jobList->getNext();
		if ($job != null) {
			$job->execute($jobList, $logger);
			$jobList->setLastJob($job);
		}
		OC_JSON::success();
	}
}

// Log the successful cron execution
$config->setAppValue('core', 'lastcron', time());
exit();

```

} catch (Exception $ex) {  
\OC::$server-\>getLogger()-\>logException($ex, [‘app’ =\> ‘cron’]);  
} catch (Error $ex) {  
\OC::$server-\>getLogger()-\>logException($ex, [‘app’ =\> ‘cron’]);  
}

thanks!

---

<div class="post-metadata">

**Author:** ![Dridhas](https://help.nextcloud.com/letter_avatar/dridhas/32/6_449c533f586939b6e5f246632a46421f.png) [@Dridhas](https://help.nextcloud.com/u/Dridhas)\
**Post date:** [November 5, 2019, 1:55am UTC](https://help.nextcloud.com/t/heic-mov-previews/62973/8 "2019-11-05T01:55:58Z")

</div>

i also ran the command **php -u www-data /var/www/nextcloud/occ preview:generate-all** and the heic pictures taken from today didnt get the preview generated.

---

<div class="post-metadata">

**Author:** ![j-ed](https://help.nextcloud.com/user_avatar/help.nextcloud.com/j-ed/32/7281_2.png) [@j-ed](https://help.nextcloud.com/u/j-ed)\
**Post date:** [November 5, 2019, 8:57am UTC](https://help.nextcloud.com/t/heic-mov-previews/62973/9 "2019-11-05T08:57:54Z")

</div>

How are your preview settings in the config.php file look like? Have you explicitly set the “ **enabledPreviewProviders** ” parameter or are you using the default settings, like:

```auto
'enabledPreviewProviders' => array(
    'OC\Preview\PNG',
    'OC\Preview\JPEG',
    'OC\Preview\GIF',
    'OC\Preview\HEIC',
    'OC\Preview\BMP',
    'OC\Preview\XBitmap',
    'OC\Preview\MP3',
    'OC\Preview\TXT',
    'OC\Preview\MarkDown'
),

```

Could you find any related message in your Nextcloud log file if you run a scan command (make sure that “`'loglevel' => 0,`” is set)?

BTW, you can most likely speed-up your tests if you place some HEIC files in a dedicated directory and use the `preview:generate --path=<path-to-dedicated-dir>`" command as documented in the command help.

---

<div class="post-metadata">

**Author:** ![Dridhas](https://help.nextcloud.com/letter_avatar/dridhas/32/6_449c533f586939b6e5f246632a46421f.png) [@Dridhas](https://help.nextcloud.com/u/Dridhas)\
**Post date:** [November 5, 2019, 4:32pm UTC](https://help.nextcloud.com/t/heic-mov-previews/62973/10 "2019-11-05T16:32:36Z")

</div>

after adding the enable\_previews and the providers, i went ahead and checked the log and found this:

Memcache \OC\Memcache\APCu not available for local cache  
Memcache \OC\Memcache\APCu not available for distributed cache

Regards!

---

<div class="post-metadata">

**Author:** ![Dridhas](https://help.nextcloud.com/letter_avatar/dridhas/32/6_449c533f586939b6e5f246632a46421f.png) [@Dridhas](https://help.nextcloud.com/u/Dridhas)\
**Post date:** [November 5, 2019, 5:02pm UTC](https://help.nextcloud.com/t/heic-mov-previews/62973/11 "2019-11-05T17:02:51Z")

</div>

i got those errors removed by executing the following command:

echo ‘apc.enable\_cli=1’ \>\> /etc/php/7.2/mods-available/apcu.ini  
sudo service apache2 restart

then i ran sudo -u www-data php -f /var/www/htm/nextcloud/occ preview:generate-all --path=path-to-heicphotos

no errors on the log so far, but still no previews of the HEIC photos on the gallery app via web.

---

<div class="post-metadata">

**Author:** ![j-ed](https://help.nextcloud.com/user_avatar/help.nextcloud.com/j-ed/32/7281_2.png) [@j-ed](https://help.nextcloud.com/u/j-ed)\
**Post date:** [November 5, 2019, 6:50pm UTC](https://help.nextcloud.com/t/heic-mov-previews/62973/12 "2019-11-05T18:50:46Z")

</div>

Nextcloud relies on the imagick program command line program to convert images. If this program supports the HEIC format, Nextcloud should also be able to create the preview files.

See how it could be enabled:

> **[5 minutes to Install Imagemagick with HEIC support on Ubuntu 18.04 DigitalOcean](https://medium.com/@eplt/5-minutes-to-install-imagemagick-with-heic-support-on-ubuntu-18-04-digitalocean-fe2d09dcef1)**
>
> 5 mins guide. How to setup Imagemagick with HEIC/HEIF support on Ubuntu 18.04. I am writing this because the default…

Afaik, the following command can be used to check if the HEIC format is supported:

```auto
# php -r 'phpinfo();' | grep HEIC

```

The imagick support can be checked by executing this command:

```auto
 convert --version

```

---

<div class="post-metadata">

**Author:** ![Dridhas](https://help.nextcloud.com/letter_avatar/dridhas/32/6_449c533f586939b6e5f246632a46421f.png) [@Dridhas](https://help.nextcloud.com/u/Dridhas)\
**Post date:** [November 5, 2019, 7:41pm UTC](https://help.nextcloud.com/t/heic-mov-previews/62973/13 "2019-11-05T19:41:25Z")

</div>

OMG, after following the link provided, i was able to get my Nextcloud to preview the HEIC files on the web browser!

Kudos to you sir for the amazing advise/help. 😃

Thanks a lot!!

---

<div class="post-metadata">

**Author:** ![eddi1984](https://help.nextcloud.com/user_avatar/help.nextcloud.com/eddi1984/32/15410_2.png) [@eddi1984](https://help.nextcloud.com/u/eddi1984)\
**Post date:** [November 18, 2019, 10:53pm UTC](https://help.nextcloud.com/t/heic-mov-previews/62973/14 "2019-11-18T22:53:21Z")

</div>

Hi,

did not want to open another thread, hope its ok to post here.

I have nc 17.0.1 and imagemagic 7.x. I can see HEIC preview and when I right click and select details, I can see a picture on the right hand corner.

However, if I click on the name of the picture, or the small thumbnail of the HEIC itself, the browser attempts to download the image. If I do the same to an jpg or png file, the image opens nice and big and I can view it in browser. How can I have the same behaviour for the HEIC file as I get with a jpg or png file?

Thanks.

---

<div class="post-metadata">

**Author:** ![Dridhas](https://help.nextcloud.com/letter_avatar/dridhas/32/6_449c533f586939b6e5f246632a46421f.png) [@Dridhas](https://help.nextcloud.com/u/Dridhas)\
**Post date:** [November 18, 2019, 11:09pm UTC](https://help.nextcloud.com/t/heic-mov-previews/62973/15 "2019-11-18T23:09:35Z")

</div>

That happened to me as well and it got fixed after restarting the browser

---

<div class="post-metadata">

**Author:** ![eddi1984](https://help.nextcloud.com/user_avatar/help.nextcloud.com/eddi1984/32/15410_2.png) [@eddi1984](https://help.nextcloud.com/u/eddi1984)\
**Post date:** [November 18, 2019, 11:46pm UTC](https://help.nextcloud.com/t/heic-mov-previews/62973/16 "2019-11-18T23:46:59Z")

</div>

I have setup the HEIC compatibility a few month ago already and have used various browsers on many different devices and platforms, and the behavior is the same.

Any other ideas?

---

<div class="post-metadata">

**Author:** ![Dridhas](https://help.nextcloud.com/letter_avatar/dridhas/32/6_449c533f586939b6e5f246632a46421f.png) [@Dridhas](https://help.nextcloud.com/u/Dridhas)\
**Post date:** [November 19, 2019, 12:20am UTC](https://help.nextcloud.com/t/heic-mov-previews/62973/17 "2019-11-19T00:20:45Z")

</div>

I just replicated your issue.

This is what I did, if you open the “files/fotos and try to open an picture, web browser will download the picture.

If you go to the gallery and click on the picture, the browser will show it on it.

---

<div class="post-metadata">

**Author:** ![j-ed](https://help.nextcloud.com/user_avatar/help.nextcloud.com/j-ed/32/7281_2.png) [@j-ed](https://help.nextcloud.com/u/j-ed)\
**Post date:** [November 19, 2019, 1:36pm UTC](https://help.nextcloud.com/t/heic-mov-previews/62973/18 "2019-11-19T13:36:09Z")

</div>

Displaying HEIC pictures seem not to be fully supported yet. See [https://github.com/nextcloud/viewer/issues/4](https://github.com/nextcloud/viewer/issues/4)

---

<div class="post-metadata">

**Author:** ![eddi1984](https://help.nextcloud.com/user_avatar/help.nextcloud.com/eddi1984/32/15410_2.png) [@eddi1984](https://help.nextcloud.com/u/eddi1984)\
**Post date:** [November 19, 2019, 5:12pm UTC](https://help.nextcloud.com/t/heic-mov-previews/62973/19 "2019-11-19T17:12:11Z")

</div>

@Dridhas  
I have exactly the same behaviour. When I work with the pictures, its easier to do with the file view and not the gallery. Problem is, I like to preview the picture before I delete or download it. With JPEG and other older formats, its no problem, just HEIC.

@j-ed  
Thank you. I hope this will be implemented soon. It seems like the preview is working in gallery view, it just needs to be “ported” to the file view. But I don’t know the inner workings of nextcloud …

Thanks to all!

---

<div class="post-metadata">

**Author:** ![Dridhas](https://help.nextcloud.com/letter_avatar/dridhas/32/6_449c533f586939b6e5f246632a46421f.png) [@Dridhas](https://help.nextcloud.com/u/Dridhas)\
**Post date:** [November 19, 2019, 5:29pm UTC](https://help.nextcloud.com/t/heic-mov-previews/62973/20 "2019-11-19T17:29:09Z")

</div>

you probably need to get the Preview Generator app and have a cron job run every so often to get the previews generated.

Also, this article will get imagick to work with HEIC/HEIF photos.

[https://medium.com/@eplt/5-minutes-to-install-imagemagick-with-heic-support-on-ubuntu-18-04-digitalocean-fe2d09dcef1](https://medium.com/@eplt/5-minutes-to-install-imagemagick-with-heic-support-on-ubuntu-18-04-digitalocean-fe2d09dcef1)

now gallery and files show a small preview.

[Next page](https://help.nextcloud.com/t/heic-mov-previews/62973.md?page=2)
