Skip to content

Configure Piwigo for Uploading Videos

Eddy Lelièvre-Berna edited this page Aug 15, 2024 · 12 revisions

For uploading videos to your Piwigo server, please install the VideoJS extension as explained below but also here.

Then, configure your server with the LocalFiles Editor extension so that it accepts video files. It is highly recommended to not add the MOV format which is supported by only a very few web browsers. To check that the Piwigo Mobile app accepts the new formats, look at the list of accepted formats shown in the Preferences page below the Logout button (please logout to reload accepted formats after changing settings on the server):

/* Photo file formats — to allow HEIC with Piwigo 14+ if an appropriate image library available */
$conf['picture_ext'] = array('jpg','jpeg','png','gif','webp','heic');

/* File extensions — to allow video and other file types */
$conf['file_ext'] = array_merge(
    $conf['picture_ext'],
    array('tif','tiff','mp4','m4v','mpg','ogg','ogv','webm','webmv')
);
$conf['upload_form_all_types'] = true;

/* File names — to allow special characters */
$conf['sync_chars_regex'] = '/^[a-zA-Z0-9-_. ]+$/';

Add these lines to add metadata support:

/* VideoJS — to add video metadata support */
$conf['show_exif'] = true;
$conf['show_exif_fields'] = array(
  'Make',
  'Model',
  'ExifVersion',
  'Software',
  'DateTimeOriginal',
  'FNumber',
  'ExposureBiasValue',
  'FILE;FileSize',
  'ExposureTime',
  'Flash',
  'ISOSpeedRatings',
  'FocalLength',
  'FocalLengthIn35mmFilm',
  'WhiteBalance',
  'ExposureMode',
  'MeteringMode',
  'ExposureProgram',
  'LightSource',
  'Contrast',
  'Saturation',
  'Sharpness',
  'bitrate',
  'channel',
  'date_creation',
  'display_aspect_ratio',
  'duration',
  'filesize',
  'format',
  'formatprofile',
  'codecid',
  'frame_rate',
  'latitude',
  'longitude',
  'make',
  'model',
  'playtime_seconds',
  'sampling_rate',
  'type',
  'resolution',
  'rotation',
  );    

VideoJS requires MediaInfo or ffprobe or Exiftool to retrieve metadata, and ffmpeg to produce posters i.e. thumbnails:

  • If you can compile MediaInfo on your server, download the source code from the MediaInfo website. Add the necessary libraries if needed and compile it. Then, enter the path to the MediaInfo directory as shown below so that the plugin knows how to call it.
  • If you cannot compile software on your server for some reason, ExifTool is the solution because it is a platform-independent Perl library delivered with a command-line application. Download the ExifTool version corresponding to your server and make it executable. Then, enter the path to the ExifTool directory as shown below so that the plugin knows how to call it.
  • ffmpeg and ffprobe binaries (executables) can be downloaded from FFbinaries for most platforms. So in most cases, it is not necessary to compile the FFmpeg source code. Once it is installed and made executable, enter the path to the FFmpeg directory as shown below so that the plugin knows how to call it.

Copy/paste the below lines in LocalFiles Editor and replace the paths with those of your server. Put the lines in comment for the software that are not available (by adding // at the beginning):

/* VideoJS — to gather metadata and produce thumbnails */
// - requires 'MediaInfo' or 'ffprobe' or 'Exiftool' to sync metadata
// - requires 'FFmpeg' to produce posters i.e. thumbnails
// - define below the full path of the directories of the available executables
//=> MediaInfo:
//   1. download the source from https://mediaarea.net/en/MediaInfo/Download
//   2. compile the source as explained here: https://github.com/MediaArea/MediaInfo
//   3. check with './mediainfo --version' (on Linux)
$conf['vjs_mediainfo_dir'] = '/home/clients/.../mediainfo/';
//=> ExifTool:
//   1. download the library and CLI from https://exiftool.org
//   2. make it executable with e.g. chmod +x exiftool on Linux
//   3. check it with e.g. './exiftool -ver' on Linux
$conf['vjs_exiftool_dir'] = '/home/clients/.../exiftool/Image-ExifTool-12.92/';
//=> FFmpeg:
//   1. download binaries from https://ffbinaries.com/downloads
//   2. on Linux: make ffmpeg and ffprobe executable with:
//      > chmod +x ffmpeg
//      > chmod +x ffprobe
//   3. check it with e.g. './ffmpeg -version' on Linux
$conf['vjs_ffprobe_dir'] = '/home/clients/.../ffmpeg/ffmpag-6.1/';
$conf['vjs_ffmpeg_dir'] = '/home/clients/.../ffmpeg/ffmpag-6.1/';

If you encounter difficulties, for example to determine the full paths, add the following lines so that errors are displayed in the browser and logs are gathered in the _data/logs folder when you sync files:

$conf['log_level'] = 'DEBUG';
$conf ['show_php_errors'] = E_ERROR;
$conf['show_php_errors_on_frontend'] = true;

Playing video with Piwigo Mobile: Video Playing

iOS devices record HEVC or H.264 movies. The iOS app converts and uploads these movies to Piwigo servers in MP4 format for compatibility with VideoJS and web servers. You can then watch the movies stored on your server with the iOS app (streaming). You can also download and share MP4 movies with your iOS device.


Video presented with toolbar: Video with toolbar