Although you'll find a lot of tutorials that help you install opencv and ffmpeg (both go hand in hand almost always) out there, I will post what worked for me here.
Steps for installing ffmpeg correctly
- Download the latest static version of ffmpeg from the download page depending on your os.
- Extract the installed zip file using 7-zip. The folder will be named something like "ffmpeg-20130731-git-69fe25c-win32-static".
- Create a new folder named
ffmpeg in your
C: and copy the contents of the extracted folder into this new one.
- Now click the start button, right-click on computer. Select Properties from the right-click menu. In the System window, click on the “Advanced system settings” link.
- Click the Environmental Variables button in the System Properties window. It will be located at the bottom of the window.
- Select the PATH entry in the "User variables" section. Click the Edit button.
In the “Variable value” field, enter
;c:\ffmpeg\bin after anything that's already written there. If you copied it to a different drive, change the drive letter.
Click OK to save your changes.
If there is no PATH entry in the "User variables" setting, click the New button and create one. Enter PATH for the variable name.
This method will enable FFmpeg for the current user. Other Windows users will not be able to run it from the command line. To enable it for everyone, enter
;c:\ffmpeg\bin in the PATH entry in "System variables". Be very careful not to delete anything that is already in this variable.
- Open the command prompt. Enter the command
ffmpeg –version. If the command prompt returns the version information for FFmpeg, then the installation was successful, and FFmpeg can be accessed from any folder in the command prompt.
If you receive a
libstdc++ -6 is missing error, you may need to install the Microsoft Visual C++ Redistributable Package, which is available for free from Microsoft.
I followed these steps from a site I don't remember but this worked just as fine.
Now to install opencv and get it working, I followed the following steps:
- Download the self-extracting executable from the OpenCV website.
- Run the Executable which will in turn extract the executable.
- Create a folder in
- Copy the contents of the extracted files into
- Edit your PATH environment variable. This will be dependent on the version you want installed (i.e. 32 or 64 bit) and also the version of visual studio you have installed (express editions are fine).
----Installing OpenCV Python
I use Anaconda. So, I copied the
cv2.pyd file from this OpenCV directory (the beginning part might be slightly different on your machine):
Python 2.7 and 32-bit machine:
Python 2.7 and 64-bit machine:
To this Anaconda directory (the beginning part might be slightly different on your machine):
OpenCV also requires that numpy be installed as well. matplolib is also recommended to be installed.
You'll also have to locate the two
.dll files in the
bin folder of your
opencv folder. And copy and paste them into the
ffmpeg/bin folder as well as into the site-packages folder in your Anaconda folder. When I installed opencv, I didn't have the bin folder installed (weird, I know). So, I copied my friend's
.dll files and renamed them to the version of opencv that I was using and it worked!
After installing both OpenCV and ffmpeg you'll need to restart your computer to add the paths to the system path.
Hope this helps! For a lot of people, most of the steps above were not necessary. But for me, this worked! I use Windows 10, Opencv 3.0, Python 2.7!