I recently installed OpenCV 2.4.2 in Ubuntu 12.04.
cap = VideoCapture(0)
is working. but I can\'t grab frames from some video source.
To run a full installation of OpenCV try the following:
sudo apt-get install libopencv-dev python-opencv
For more details check out the following link http://milq.github.io/install-opencv-ubuntu-debian/
So, I realized there was some problem with ffmpeg. and I rebuilt and installed ffmpeg and then changed flags for cmake to make opencv.
For ffmpeg,
./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab
make
sudo make install
For OpenCV,
cmake -D CMAKE_BUILD_TYPE=RELEASE ..
make
sudo make install
Here's the complete script to install OpenCV 2.4.2 https://github.com/jayrambhia/Install-OpenCV/blob/master/Ubuntu/2.4/opencv2_4_2.sh
and here's my blogpost about OpenCV 2.4.2 installation in detail http://jayrambhia.com/blog/install-opencv-2-4-in-ubuntu-12-04-precise-pangolin/