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…

Any opinions, news, research, analyses, prices or other information ("information") contained on this Blog, constitutes marketing communication and it has not been prepared in accordance with legal requirements designed to promote the independence of investment research. Further, the information contained within this Blog does not contain (and should not be construed as containing) investment advice or an investment recommendation, or an offer of, or solicitation for, a transaction in any financial instrument. LMAX Group has not verified the accuracy or basis-in-fact of any claim or statement made by any third parties as comments for every Blog entry.

LMAX Group will not accept liability for any loss or damage, including without limitation to, any loss of profit, which may arise directly or indirectly from use of or reliance on such information. No representation or warranty is given as to the accuracy or completeness of the above information. While the produced information was obtained from sources deemed to be reliable, LMAX Group does not provide any guarantees about the reliability of such sources. Consequently any person acting on it does so entirely at his or her own risk. It is not a place to slander, use unacceptable language or to promote LMAX Group or any other FX and CFD provider and any such postings, excessive or unjust comments and attacks will not be allowed and will be removed from the site immediately.