Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6403 Discussions

OpenCV Error creating VIdeoWriter object

DaveInPA
New Contributor I
2,842 Views

I'm on windows 10 (64 bit) and finally got OpenVino installed and working correctly using the windows installation tool. I had to run the "setupvars.bat" batch program and then see the resulting environment variables to set manually at the system level for it to work. I also installed Python 3.8.10. Before i started i removed anything remotely connected to prior OpenCV installations.

 

when i try to create a VideoWriter object using....

fourcc = cv2.VideoWriter_fourcc( 'M', 'J', 'P', 'G') 
out = cv2.VideoWriter('Videos\driveway.avi', fourcc, 20.0, (640, 480))
 
i'm getting the following errors:
MFX: Can't initialize session
[ERROR:0] global C:\jenkins\workspace\OpenCV\OpenVINO\2021.4\build\windows\opencv\modules\videoio\src\cap.cpp (589) cv::VideoWriter::open VIDEOIO(CV_IMAGES): raised OpenCV exception:

OpenCV(4.5.3-openvino) C:\jenkins\workspace\OpenCV\OpenVINO\2021.4\build\windows\opencv\modules\videoio\src\cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find 
starting number (in the name of file): Videos\driveway.avi in function 'cv::icvExtractPattern'

 
Somewheres on the Internet they said i'm missing "opencv_videoio_ffmpeg_64.dll" which i was. So i found a copy of that somewhere and put that into my opencv/bin directory. I've tried different codecs and other Python programs but getting the same results.
 
Any idea what causes this?

 

0 Kudos
1 Solution
DaveInPA
New Contributor I
2,806 Views

** SOLVED **

 

For whatever reason the OpenVino windows installed failed to install a few dlls/libs. From the opencv folder there is a POWERSHELL script called ffmpeg-download.ps1 that needs to be run that will install the missing files. Not sure why there is a script to do this and maybe that script wasn't executed during the install?

 

Regardless run that script and you'll get past this problem...

 

View solution in original post

6 Replies
DaveInPA
New Contributor I
2,807 Views

** SOLVED **

 

For whatever reason the OpenVino windows installed failed to install a few dlls/libs. From the opencv folder there is a POWERSHELL script called ffmpeg-download.ps1 that needs to be run that will install the missing files. Not sure why there is a script to do this and maybe that script wasn't executed during the install?

 

Regardless run that script and you'll get past this problem...

 

Zulkifli_Intel
Moderator
2,799 Views

Hello David Rosner,


Thank you for reaching out to us.


Have you installed FFmpeg on your Windows 10? Here is the quickstep to install it:


  1. Go to this directory: C:\Program Files (x86)\Intel\openvino_2021.4.582\opencv
  2. Right-click on ffmpeg-download.ps1
  3. Click on Run with PowerShell
  4. Reboot your PC once the installation is done.


Please let us know whether the above method resolves the issue or not.


Sincerely,

Zulkifli


0 Kudos
DaveInPA
New Contributor I
2,791 Views

Hi - Yes i eventually figured out i needed to do that and discovered that script. Solve that problem! You should ask the team who owns the windows installer product to add that to the step.

0 Kudos
Zulkifli_Intel
Moderator
2,766 Views

Hello David Rosner,

 

Thank you for your feedback. We will inform the developer of this matter.

 

Sincerely,

Zulkifli

 

0 Kudos
Zulkifli_Intel
Moderator
2,704 Views

Hello DaveInPA,

 

The step to install the FFmpeg can be found in the demos documentation such as:

-       3D Human Pose Estimation Python* Demo

-       Action Recognition Python* Demo

-       Crossroad Camera C++ Demo

 

Sincerely,

Zulkifli


0 Kudos
Zulkifli_Intel
Moderator
2,628 Views

Hello DavelnPA,


This thread will no longer be monitored since this issue has been resolved. If you need any additional information from Intel, please submit a new question.


Sincerely,

Zulkifli


0 Kudos
Reply