Hi,
I maintain an album with pictures and videos of my son. The album is sorted, so that the newest pics are shown first. But whenever I upload a video, the video is placed at the very end of the album because Piwigo/VideoJS does not recognize its creation date. I have to manually set the creation date using the Edit function of the web interface. Although this is a workaround, it is somehow cumbersome, especially when I add many videos at once.
Most of my videos are taken with a Canon IXUS 140. I then convert the .MOV file using ffmpeg to a .mp4
What I tried so far:
1.) add -metadata creation_time=<date> using ffmpeg
2.) add CreateTime, ModifyTime, MediaCreateTime, MediaModifyTime, TrackCreateTime, TrackModifyTime using exiftool
but nothing worked.
Any idea what I can do to add the Creation Date to the video, so it is correctly recognized by Piwigo/VideoJS?
Thanks,
Marcus.
Piwigo version: 2.7.4
PHP version: 5.3.10
MySQL version: 5.5.46
Offline
I have the same problem. Could not get VideoJs plugin to get the date from the video file.
With exiftool you have to set the DateTimeOriginal so that Piwigo will use it. You can get exiftool to take that info from CreateDate. Some of my videos have DateTimeOriginal, but not all. It depends on the device I have used to record the videos. All of my videos have CreateDate.
What I have done is take a .jpg from the videos with avconv, take all exif data from the video with exiftool and put it in the jpg file. Then I update the exif data on the jpg file, CreateDate field to DateTimeOriginal. The command bellow does that. In the beginning the command makes the pwg_representative directory, if it is not there all ready. I'm running it on ubuntu linux. If you have ffmpeg installed and not avconv, just replace the avconv with ffmpeg. Should work. Run the command IN THE DIRECTORY WHERE THE VIDEOS ARE. I just googled a lot and came up with following command. I'm not a superuser, I barely understand the commands. Use at your own risk!
mkdir -p ./pwg_representative; for file in ./*.mp4;do avconv -ss 2.0 -i "$file" -t 1 -s 480x300 -f image2 ./pwg_representative/"${file%.mp4}".jpg;done;for file in ./*.mp4; do exiftool -tagsfromfile "$file" "-all:all>exif:all" -overwrite_original ./pwg_representative/"${file%.mp4}".jpg; done; for file in ./pwg_representative/*.jpg; do exiftool "-CreateDate>DateTimeOriginal" -overwrite_original "$file"; done
mkdir -p ./pwg_representative;
--makes the pwg_representavive directory under current directory
for file in ./*.mp4;do avconv -ss 2.0 -i "$file" -t 1 -s 480x300 -f image2 ./pwg_representative/"${file%.mp4}".jpg;done;
--take a jpg image from all mp4 files at 2 second mark and save them to pwg_representative directory under current directory
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
--update/create exif tag DateTimeOriginal with CreateDate
You don't have to recode you mov files to mp4. You should be able to just put them in the mp4 container with ffmpeg/avconv: for file in ./*.mov; do avconv -i "$file" -vcodec copy -acodec copy ./"${file%.mov}".mp4; done
Jari
I've always had this problem as well and am just manually setting the date/time. Annoying, but doable.
Offline
Jari wrote:
With exiftool you have to set the DateTimeOriginal so that Piwigo will use it. You can get exiftool to take that info from CreateDate. Some of my videos have DateTimeOriginal, but not all. It depends on the device I have used to record the videos. All of my videos have CreateDate.
What I have done is take a .jpg from the videos with avconv, take all exif data from the video with exiftool and put it in the jpg file. Then I update the exif data on the jpg file, CreateDate field to DateTimeOriginal. The command bellow does that. In the beginning the command makes the pwg_representative directory, if it is not there all ready. I'm running it on ubuntu linux. If you have ffmpeg installed and not avconv, just replace the avconv with ffmpeg. Should work. Run the command IN THE DIRECTORY WHERE THE VIDEOS ARE. I just googled a lot and came up with following command. I'm not a superuser, I barely understand the commands. Use at your own risk!
mkdir -p ./pwg_representative; for file in ./*.mp4;do avconv -ss 2.0 -i "$file" -t 1 -s 480x300 -f image2 ./pwg_representative/"${file%.mp4}".jpg;done;for file in ./*.mp4; do exiftool -tagsfromfile "$file" "-all:all>exif:all" -overwrite_original ./pwg_representative/"${file%.mp4}".jpg; done; for file in ./pwg_representative/*.jpg; do exiftool "-CreateDate>DateTimeOriginal" -overwrite_original "$file"; done
Jari
I'm encountering the same problems as well, it has not been fixed, but Jari's suggestions work for me !
Thanks a lot !
Offline
Just to say thanks for this! been tearing my hair out with videos showing up in the wrong sort order!
Cheers
Offline
For mov files, I use this if you want to use ffmpeg:
ffmpeg -i 20210910T191242.MOV -vcodec libx264 -map_metadata 0 20210910T191242.mp4
This copies tags such as creation date that are in the original mov into the mp4.
videojs sees it, at least mine does.
Offline