After my comment on #42 I have more hours spent ty trying why I can't upload on Windows videos as normal photos. My explanations in the old comments are not quite right. The right solution I have found and want to explain it here. I hope that it will be useful to the Piwigo developers and give notes for her updates.
The declaration refers to piwigo 2.7.3 with VideoJS 2.7.a.
In /plugins/piwigo-videojs/include/functions_sync2.php must the single quotes in front of and behind the file/pathnames changed to double quotes.
Which is important for Windows when a blank is in the pathname.
All 4 lines in the source, where ffmpeg is called must be corrected to:
$ffmpeg = $sync_options['ffmpeg'] . " -itsoffset -" . $sync_options['postersec'] . " -i "" . $in . "" -vcodec mjpeg -vframes 1 -an -f rawvideo -y "" . $out . '"';
For videos without exif-data must the source-part, that the MySql-table updated, corrected to:
isset($sync_options['batch_manager']) ? $infos[] = $filename . ' metadata: ' . implode(",", array_keys($exif)) : '';
$sync_arr['metadata'] = count($exif) . " " . implode(",", array_keys($exif));
if ($sync_options['metadata'] and ! $sync_options['simulate']) {
$dbfields = explode(",", "filesize,width,height,latitude,longitude,date_creation,rotation");
$dbset = vjs_dbSet($dbfields, $exif);
$dbset = ($dbset !== FALSE && $dbset != '') ? ($dbset . ',') : '';
$query = "UPDATE " . IMAGES_TABLE . " SET " . $dbset . " date_metadata_update=CURDATE() WHERE id=" . $row['id'] . ";"; //print $query;
pwg_query($query);
In /plugins/piwigo-videojs/include/mediainfo.php must the mediainfo-call corrected to double-quotes (like the ffmpeg call):
$output = shell_exec($sync_options['mediainfo'] . " --Full --Output=XML --Language=raw "" . $filename . """);
In /admin/include/functions_upload.inc.php I have changed the function pwg_image_infos($path).
This is necessary because getimagesize() on php on windows no width and height for mp4 files returns. To determine the sizes, I use ffmpeg if getimiagesize() does not work:
(I use the newest ffmpeg version N-69060-gcd960c8 Copyright (c) 2000-2015 the FFmpeg developers built on Jan 14 2015 22:13:45 with gcc 4.9.2 (GCC))
function pwg_image_infos($path) {
global $conf;
$size = getimagesize($path);
if (($size === FALSE || $size == 0) && isset($conf['vjs_sync'])) { //use ffmpeg
$ffmpeg = unserialize($conf['vjs_sync']);
$ffmpeg_return = shell_exec($ffmpeg['ffmpeg'] . ' -i "' . $path . '" -vstats 2>&1');
$regex_sizes = "/\s([0-9]{1,4})x([0-9]{1,4})\s/";
preg_match($regex_sizes, $ffmpeg_return, $regs);
$size = explode('x', $regs[0]);
}
$filesize = floor(filesize($path) / 1024);
list($width, $height) = $size;
return array(
'width' => $width,
'height' => $height,
'filesize' => $filesize,
);
}
With these changes VideoJS an Piwigo works perfectly on my windows server.
I have another piwigo installation on a Qnap system (any Linux version).
There VideoJS works without all these changes, but I do not know why
because I have very little knowledge of linux.
I hope I could help many windows-users.
Photonensammler