Here is the tutorial I followed:http://thebitbangtheory.wordpress.com/2011/10/23/how-to-install-opencv-2-3-1-in-ubuntu-11-10-oneiric-ocelot-with-python-support/ I think the
Check your LD_LIBRARY_PATH and PKG_CONFIG_PATH, along with the location you installed ffmpeg to.
See here for more information on the steps.