NextCloud: Enable video previews

Photo by Ingo Joseph on Pexels
Published 7 November 2021 Last updated 21 June 2022 An older guide that hasn't been re-checked yet, so commands or versions may have moved on. How guides are made and checked

This guide will show you how to enable video previews on NextCloud hosted on Debian/Ubuntu. You can apply the same steps if you are running the Docker version of NextCloud or different distribution.

What is NextCloud?

NextCloud allows you to share files in a similar way to Dropbox and Google Drive. It is, however, more than a file share! You can use it as a collaboration platform and customize it with a wide selection of useful apps.

What is FFmpeg?

FFmpeg is a multimedia framework that can decode, encode, transcode, mux, demux, stream, filter, and play almost anything multimedia format. Also, FFmpeg runs on a wide variety of build environments, machine architectures, and configurations.

Install FFmpeg for video previews

Follow these steps to enable video, image, and PDF previews on your NextCloud.

Standard install

First, you want to update your Linux distribution.

sudo apt update

Second, you want to install FFmpeg using the following command:

sudo apt install ffmpeg

Docker install

You can also enable video previews in NextCloud using Docker.

The example below shows you how to do this using Docker exec:

/usr/bin/docker exec -it --user root {{ your_container_name }} /bin/bash -c 'apt update && apt install -y ffmpeg'

You will, of course, need to replace “{{ your_container_name }}” with the name of your container. Additionally, note that you may need to rerun this command if you restart your container. However, you can overcome this by building a new Docker image.

Configure NextCloud previews

Next, you must edit your config.php file and add the following lines:

  'enable_previews' => true,
  'enabledPreviewProviders' =>
  array (
    0 => 'OC\\Preview\\Movie',
    1 => 'OC\\Preview\\PNG',
    2 => 'OC\\Preview\\JPEG',
    3 => 'OC\\Preview\\GIF',
    4 => 'OC\\Preview\\BMP',
    5 => 'OC\\Preview\\XBitmap',
    6 => 'OC\\Preview\\MP3',
    7 => 'OC\\Preview\\MP4',
    8 => 'OC\\Preview\\TXT',
    9 => 'OC\\Preview\\MarkDown',
    10 => 'OC\\Preview\\PDF',
  ),

The configuration mentioned above will enable the movie, PNG, JPEG, GIF, BMP, XBitmap, MP3, MP4, TXT, Markdown, and PDF preview provider within NextCloud.

Wrapping up

In conclusion, you have now configured your NextCloud to display video previews on Debian/Ubuntu installs.

You may also be interested in

Sources: