Ask Your Question

Revision history [back]

Trying to load a .mp4 Video fails

Hey guys,

I've installed ffmpeg and opencv on my linux server, like that:

git clone <ffmpeg_git_repositiory>
cd FFmpeg
./configure --enable-shared
make
sudo make install

sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

git clone <opencv_git_repositiory>
cmake <path to the OpenCV source directory>
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install

I wrote a little Python script:

import cv2
cap = cv2.VideoCapture('video.mp4')
total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))

But I'm not able to load that video and total_frames are always 0.

I did some research why this doesn't work and found tons of answers tried so many ways to install it, but it didn't worked for me.

What did I do wrong? Am I missing some detail?

I'm really annoyed and from installing it