Piwigo and Video
I settled on piwigo for a web photo gallery, after the demise of ZangZing. I looked at the others and I'm aware that most people use twitbook for sharing family photos, but I don't really trust them with my data in the long term. Plus I'm just too much of a DIY dinosaur to use any of the modern trendy sites like candygram or whatever.
So here's a short list of pitfalls I encountered whilst getting piwigo up and running, including video.
Piwigo is nice. Its simple, clean and modern. It had the right set of features for what I was after, without being too heavy weight. I found it thanks to a blog posting comparing the 10 best php web galleries.
1) Piwigo Install
Piwigo is here.
It would be really helpful for piwigo to check dependencies, or at least list them somewhere. If they are listed, then I couldn't find them easily. The requirements page lists them out in a generic form, but I was being spectacularly dumb so I missed one.
So, the dependencies are for version 2.4.x;
yum install -y php-mysql, mysql-server, gd, gd-util, php-gd
Note to future self; if you get a blank white screen after filling in the piwigo install form, then you're missing php-mysql. Also, "can't connect to server" can also mean you got the mysql auth wrong. It seems to be a generic message.
2) Jplayer Install
This went pretty smoothly - following the instructions from https://github.com/d-matt/piwigo-jplayer I copied it to the plugin directory. Then I hit a roadblock - I uploaded a test video and created a pwg_representative directory for the thumbnail, but nothing showed. To cut a tedious story short, the trick is to not do that in the root of the galleries subdirectory. You have to give it an abum name.
i.e. galleries/foo/video.ogm and galleries/foo/pwg_representative/video.png
Then hit synchronise in the piwigo gui.
3) For HTML5 video, configure apache.
Continuing on with the rookie errors, the next problem was that videos played in one browser (chrome) but not in another (firefox). Even after navigating the swamp of which browser supports what codec - and deciding that I was going to use theora because I can't be bothered to cater to the various proprietary browsers that don't handle it, things were still going wrong for me in firefox. Mac and Windows users can always use Chrome or Firefox anyhow.
So, after all it was a basic error. As this helpful page points out - video files need to be served with the correct mimetype.
So,
AddType video/ogg .ogv
to the appropriate apache httpd.conf file was all that was required.
4) video conversion and thumbnailing.
To save me having to google this again when I lose the script, here's how to convert videos taken on my phone to something suitable for jplayer and make a thumbnail.
#!/bin/bash
if [ "$1" == "" ]
then
echo "usage convert: video file"
exit
fi name="$1" base="`basename $name .mp4`" # thumbnail vlc $name --video-filter=scene --aout=dummy --vout=dummy --start-time=10 \ --stop-time=11 --scene-format=png --scene-ratio=24 --scene-prefix=$base \ --scene-replace --scene-path=. vlc://quit #theora
ffmpeg2theora -p videobin $name
Some days you're just not that smart...