#1 2022-01-09 18:24:57


Automatic Sort order not working with videos


Ideally i would like my albums to auto sort from Old->new (by date creation read from the exif data) now this seemingly works fine for photos, but any videos i add (which have valid exif data) just get put to the first file in the album.
I'd just started a new 2022 album last week, and so far so good any pictures i uploaded, are correctly sorted, but adding my first video to this album today, and it just gets put at the first slot, not actually where it should be in relation to the exif/date/time

e.g the exif data of this video

and where it gets put in the album is before a picture taken on 01/01/2022

my method for importing (i dont use the web uploader as its too slow)

Winscp -> upload to Galleries/albumname
Piwigo Admin - Synconise Album
VideoJS - Syncronise exif/generate poster/add film effect
Batch -  generate multisize thumbnails

Quite happy with this method as its fast especially if adding a lot of pictures, however im getting bogged down with any albums that have video;s as they are just not getting sorted to the correct time.

Im wondering, is piwigo possibly reading the timestamp of the thumbnail? instead fo teh actual mp4 file?
is there any method to get videos to auto get put in the correct sort order? or is it a manual sorting job?


Piwigo 12.2.0 Check for upgrade
Operating system: Linux
PHP: 7.4.25 (Show info) [2022-01-09 17:12:47]
MySQL: 5.5.5-10.5.12-MariaDB-0+deb11u1 [2022-01-09 17:12:47]
Graphics Library: ImageMagick 6.9.11-60
Cache size 13156.06 MB   calculated right now Refresh
Activated plugin list8
Exif View
LocalFiles Editor
Physical Photo Move
Posted Date Changer
Presync AutoRename
Reset manual order
RV Thumb Scroller



#2 2022-01-09 20:18:42


Re: Automatic Sort order not working with videos

in my file process, videos creation dates are not recognized too, but each file is named according to its creation date. So I just have to run this SQL query to get this problem solved.


UPDATE `pwg_images` SET `date_creation`=LEFT(`file`, 15) WHERE `file` REGEXP '.(avi|ogg|ogm|ogv|oga|mov|mp4|m4v|mpg|mpeg|mjpeg|3gp|flv|webm)$' AND `file` REGEXP '^[0-9]{8}T[0-9]{6}' AND `date_creation` IS NULL;

For sure, VideoJS could provide a better solution than this personal workaround.

Have you searched on github project page issues?

This 2016 topic gives a solution via the pwg_representative picture:



#3 2022-01-09 22:11:57


Re: Automatic Sort order not working with videos

thanks for the help! not all my videos are named with dates, but i think that other workaround from Jari may work, will give that a spin... thankyou for the pointers!!



#4 2022-01-10 13:50:13


Re: Automatic Sort order not working with videos

Hi Yes Jari's script worked wonders here, although using it in full gave some weird stretched thumbnails & also  I like the "filmstrip" to easier show its a video....

just in case it helps anyone else

heres what i did (per album)
deleted all the contents of my pwg_representative folder
batch process to delete all multiple size generated images
synchronised library
ran videoJS created poster with film

then in putty, browse to the album folder and run the last lines of Jari's script

for file in ./*.mp4; do exiftool -tagsfromfile "$file" "-all:all>exif:all" -overwrite_original ./pwg_representative/"${file%.mp4}".jpg; done;
--take exif data from the video and put in the jpg files
for file in ./pwg_representative/*.jpg; do exiftool "-CreateDate>DateTimeOriginal" -overwrite_original "$file"; done

next Synchronise Library again & then generated multisize images.....

now the videos are correctly sorted in the correct timestamp! bit of a faff! but saves manually sorting videos

Thankyou again for the pointers!



Board footer

Powered by FluxBB

github twitter newsletter Donate © 2002-2022 · Contact