Skip to content

Allow videos support #55

@Gotcha26

Description

@Gotcha26

Video Support for PiwigoPublish

Date: 2026-02-15
Status: Feasible — Moderate development effort


Table of Contents

  1. Overview
  2. Lightroom Classic Side
  3. Piwigo Server Side
  4. Server Verification Guide
  5. Piwigo Configuration Guide
  6. Plugin Modifications
  7. Limitations & Caveats
  8. References

Overview

Publishing videos from Lightroom Classic to Piwigo is fully feasible. Both the Lightroom SDK and the Piwigo API support video handling, though both require explicit configuration. The current PiwigoPublish plugin has video support explicitly disabled — the changes needed are moderate and localized to 3 files.


Lightroom Classic Side

Video Export Capabilities

The Lightroom SDK natively supports video publication in Publish Services via the canExportVideo property. When enabled, Lightroom displays a "Video" section in the export/publish dialog.

Available Export Formats

Format Description EN
H.264 (MP4) Transcodes to MP4 H.264 + AAC. Quality presets: Max (4K), High, Medium, Low. Applies basic LrC adjustments.
DPX Image sequence for professional/cinema use. Very large files. Not relevant here.
Original Raw copy of the original file without any transcoding or adjustments.

Recommendation: H.264/MP4 is the ideal choice — universal browser compatibility and natively produced by Lightroom.

SDK API for Video Detection

-- Detect whether a rendition is a video
local fileFormat = photo:getRawMetadata("fileFormat")
local isVideo = (fileFormat == "VIDEO")

The processRenderedPhotos workflow is identical for photos and videos — no separate callback exists. The plugin must detect video renditions itself.


Piwigo Server Side

API Compatibility

The pwg.images.upload API endpoint accepts video files with the same parameters as photos, provided the server is configured to allow video extensions. There is no API difference between uploading a photo and a video.

Required Server Plugin

The piwigo-videojs plugin (official, GPL-3.0) is required for proper video playback in the gallery.

Features provided / Fonctionnalités fournies :

Feature / Fonctionnalité Description EN
HTML5 Player Integrates VideoJS player into the gallery
Metadata extraction Reads filesize, dimensions, GPS, date, duration, bitrate, framerate
Poster/Thumbnail generation Extracts a frame from the video via FFmpeg

What it does NOT do :

  • No live transcoding
  • No automatic format conversion
  • No adaptive bitrate streaming (HLS/DASH)

File Storage

Videos follow the exact same directory structure as photos.

./upload/YYYY/MM/DD/
    video_file.mp4              ← original video file
./_data/i/upload/YYYY/MM/DD/
    video_file-th.jpg           ← thumbnail generated by VideoJS+FFmpeg

Server Verification Guide

1. Check FFmpeg Installation

FFmpeg is required on the Piwigo server for automatic thumbnail/poster generation from videos. Without it, videos will display with a generic placeholder.

Via SSH

# Check if FFmpeg is installed
ffmpeg -version

# Expected output (example)
# ffmpeg version 4.4.2 Copyright (c) 2000-2021 the FFmpeg developers
# built with gcc 11 ...

# If not found, check for avconv (legacy alternative)
avconv -version

Via Piwigo Admin Panel

  1. Go to Administration > Plugins > VideoJS > Configuration

  2. The plugin displays detected tools:

    • ffmpeg — Required for poster generation
    • ℹ️ exiftool — Optional, metadata extraction
    • ℹ️ mediainfo — Optional, metadata extraction
  3. If FFmpeg is not detected, you'll see a warning.

Install FFmpeg (if missing)

# Debian / Ubuntu
sudo apt update && sudo apt install ffmpeg

# CentOS / RHEL
sudo yum install ffmpeg

# Alpine
apk add ffmpeg

# Verify after installation / Vérifier après installation
ffmpeg -version

Note: On shared hosting, FFmpeg may not be available and you cannot install it yourself. Contact your hosting provider.

2. Check PHP Upload Limits

Videos are significantly larger than photos. Ensure your PHP configuration allows large uploads.

# Check current limits
php -i | grep -E "upload_max_filesize|post_max_size|max_execution_time"

**Recommended values

Parameter Recommended File to edit
upload_max_filesize 512M or higher php.ini
post_max_size 512M or higher php.ini
max_execution_time 300 (5 min) php.ini
memory_limit 256M or higher php.ini
; In php.ini:
upload_max_filesize = 512M
post_max_size = 512M
max_execution_time = 300
memory_limit = 256M

Restart your web server after changes : sudo systemctl restart apache2 or sudo systemctl restart nginx && sudo systemctl restart php-fpm

3. Check piwigo-videojs Plugin

  1. Go to Administration > Plugins

  2. Search for VideoJS in the plugin list

  3. If not installed: click Install then Activate

  4. If installed but inactive: click Activate


Piwigo Configuration Guide

Step 1: Enable Video File Types

By default, Piwigo only accepts image files. You need to explicitly allow video extensions.

Method A: Via LocalFiles Editor (Recommended)

  1. Go to Administration > Tools > LocalFiles Editor

  2. Edit local/config/config.inc.php

  3. Add the following lines:

<?php
// Enable all file types for upload
$conf['upload_form_all_types'] = true;

// Add video extensions
$conf['file_ext'] = array_merge(
    $conf['picture_ext'],
    array('mp4', 'm4v', 'mpg', 'ogg', 'ogv', 'webm', 'webmv')
);
  1. Save the file

Method B: Via direct file editing

# Edit the local config file
nano /var/www/piwigo/local/config/config.inc.php

Add the same PHP code as above.

Step 2: Configure VideoJS Plugin

  1. Go to Administration > Plugins > VideoJS > Configuration

  2. Recommended settings :

Setting Value Description EN
Video player width 720 Default player width in pixels
Poster generation Enabled Auto-generate poster from video
Poster second 4 Frame to extract for poster (seconds)
Metadata sync Auto Auto-extract metadata on upload

Step 3: Synchronize Existing Videos

After uploading videos, you may need to trigger metadata extraction and poster generation.

  1. Go to Administration > Tools > Batch Manager

  2. Filter by video files

  3. Select VideoJS — Synchronize metadata from the action menu

  4. Apply to all selected videos

Quick Verification Checklist

[ ] FFmpeg installed and accessible
[ ] piwigo-videojs plugin installed & active
[ ] upload_form_all_types = true
[ ] Video extensions added to file_ext
[ ] PHP upload_max_filesize >= 512M
[ ] PHP post_max_size >= 512M
[ ] PHP max_execution_time >= 300
[ ] Test: manual video upload via Piwigo UI

Plugin Modifications

Files to Modify

File Change Impact
PublishServiceProvider.lua Set canExportVideo = true, add allowVideoExportPresets Enables video selection in LrC UI
PiwigoAPI.lua Add video/mp4 content-type, remove file-type restriction Allows video upload to Piwigo
PublishTask.lua Detect video renditions, adapt metadata handling Proper video processing in publish workflow

Detection Logic

-- In processRenderedPhotos
local fileFormat = rendition.photo:getRawMetadata("fileFormat")
local isVideo = (fileFormat == "VIDEO")

if isVideo then
    -- Video-specific handling
    -- - Limited EXIF metadata
    -- - Content-type: video/mp4
    -- - File extension must be preserved
end

Limitations & Caveats

# EN
1 File size: Videos are much larger than photos (100s of MB to GBs). The existing chunked upload will help.
2 Limited metadata: Videos don't have full EXIF data (no lens/camera info). Title, caption, keywords, and date are available.
3 File extension: The uploaded filename must retain its extension (e.g., .mp4). Without it, Piwigo rejects the upload.
4 No server-side transcoding: Piwigo streams the video as-is. The format sent by Lightroom must be browser-compatible (H.264/MP4 is).
5 FFmpeg dependency: Without FFmpeg on the server, video thumbnails won't be auto-generated. Videos will show a generic placeholder.
6 MOV format discouraged: MOV has poor browser support. Prefer MP4. If users export as "Original" and the source is MOV, playback may fail.

References

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions