For some reason this doesn’t work out of the box. The official pHash 0.9.6 from phash.org won’t build on CentOS even though ffmpeg-devel is installed. I don’t even think this is the fault of pHash, I think the CentOS package is broken.

When trying to build it I get:

libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -pthread -I/usr/local/include -I/usr/include/libavcodec -I/usr/include/libavformat -I/usr/include/libswscale -Dcimg_use_png -Dcimg_use_jpeg -Dcimg_use_fftw3 -O2 -ffast-math -O3 -MT pHash.lo -MD -MP -MF .deps/pHash.Tpo -c pHash.cpp -fPIC -DPIC -o .libs/pHash.o
In file included from pHash.cpp:28:0:
cimgffmpeg.h:38:37: fatal error: ./libavformat/avformat.h: No such file or directory
#include "./libavformat/avformat.h"

What’s missing is some symbolic links. These are the commands I needed to run:

ln -s /usr/include/ffmpeg/libavformat/ /usr/include/libavformat
ln -s /usr/include/ffmpeg/libavcodec/ /usr/include/libavcodec
ln -s /usr/include/ffmpeg/libavutil/ /usr/include/libavutil
ln -s /usr/include/ffmpeg/libswscale/ /usr/include/libswscale

I was worried it would be something more serious, but that was the only problem :)