Ffmpeg in opencv

On windowsGPU I’ m getting the following error after the command “deeplabcut.create_new_project”:

warning: Error opening file (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:901)
warning: C:\Users\namel\Downloads\test-user-2019-06-28\videos\monkey.avi (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:902)
Cannot open the video file!

I tried installing ffmpeg from https://ffmpeg.org/download.html and adding to PATH, but it did not solve the problem. Could anyone help me with this error?

can you post some more information please; what type of video, i.e. is is a openCV supported type?

The video is a MPEG-4 H.264.

Maybe ffmpeg is not present in default conda channel: https://stackoverflow.com/questions/29249611/videocapture-does-not-work-in-anaconda/42984587

I have tried the solution proposed on the link above, but it was not successful either.

could you convert it to an .mp4 just to check?


ffmpeg -i example.mov example.mp4

No change, still the same error. Is OpenCV version 3.4.5 the correct one?

that’s the correct version, but my guess is your ffmpeg is broken (unless you just used it to convert the video…), either way, I would re-create the conda env …

Thank you for the suggestion. I have recreated the environment and also uninstalled and reinstalled Anaconda. Unfortunately the error persists. I also used ffmpeg for the conversion, so that is probably not the problem.

Just to confirm, OpenCV is only installed at the DeepLabCue env, not at the base, right?

Please forgive my lack of experience on the matters. I will keep trying to solve the problem and post here if I discover the cause.

no problem, yeah very strange error! sorry it’s a bit hard to troubleshoot from afar …

and yes, openCV is only inside the env not in (base) that you see…

could you perhaps paste a screen shot how you are creating the project, and the output?

On Anaconda Prompt:

(dlc-windowsGPU) C:\Users\Rafael\Downloads>conda env create -f dlc-windowsGPU.yaml
Warning: you have pip-installed dependencies in your environment file, but you do not list pip itself as one of your conda dependencies.  Conda may not use the correct pip to install your packages, and they may end up in the wrong place.  Please add an explicit pip dependency.  I'm adding one for you, but still nagging you.
Collecting package metadata (repodata.json): done
Solving environment: failed

  - msvc_runtime

Then I comment <- msvc_runtime> out and try again, which works with no errors (the output gets cropped in the windows prompt and I can’t see all of it).

After that I activate the environment, enter in the IPython shell, import deeplabcut, and get the error when trying to load the video in the new project:

(base) C:\Users\Rafael\Downloads>conda activate dlc-windowsGPU

(dlc-windowsGPU) C:\Users\Rafael\Downloads>ipython
Python 3.6.7 (default, Feb 28 2019, 07:28:18) [MSC v.1900 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 6.0.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import deeplabcut

In [2]: deeplabcut.create_new_project('test','rafael',['C:/Users/Rafael/Download/monkey.mp4'])
Created "C:\Users\Rafael\Downloads\test-rafael-2019-07-01\videos"
Created "C:\Users\Rafael\Downloads\test-rafael-2019-07-01\labeled-data"
Created "C:\Users\Rafael\Downloads\test-rafael-2019-07-01\training-datasets"
Created "C:\Users\Rafael\Downloads\test-rafael-2019-07-01\dlc-models"
Creating the symbolic link of the video
symbolic link created for C:\Users\Rafael\Downloads\test-rafael-2019-07-01\videos\monkey.mp4 <<===>> C:\Users\Rafael\Download\monkey.mp4
Created the symlink of C:\Users\Rafael\Download\monkey.mp4 to C:\Users\Rafael\Downloads\test-rafael-2019-07-01\videos\monkey.mp4
warning: Error opening file (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:901)
warning: C:\Users\Rafael\Downloads\test-rafael-2019-07-01\videos\monkey.mp4 (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:902)
Cannot open the video file!
Generated "C:\Users\Rafael\Downloads\test-rafael-2019-07-01\config.yaml"

A new project with name test-rafael-2019-07-01 is created at C:\Users\Rafael\Downloads and a configurable file (config.yaml) is stored there. Change the parameters in this file to adapt to your project's needs.
 Once you have changed the configuration file, use the function 'extract_frames' to select frames for labeling.
. [OPTIONAL] Use the function 'add_new_videos' to add new videos to your project (at any stage).
Out[2]: 'C:\\Users\\Rafael\\Downloads\\test-rafael-2019-07-01\\config.yaml'

Ah, I see, you don’t have the paths correct…

Hence why it can’t read them.

please see the user-guide:

NOTE: Windows users, you must input paths as: rC:\Users\computername\Videos\reachingvideo1.avi’ ` or


Needs to be:


Thank you very much, that was it! I will check the documentation more carefully next time.

'C:\\Users\\computername\\Videos\\reachingvideo1.avi' worked but r'C:\Users\computername\Videos\reachingvideo1.avi' didn’t.