Intel® Distribution of OpenVINO™ Toolkit
Community support and discussions about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all things computer vision-related on Intel® platforms.

OpenCV Error creating VIdeoWriter object

DaveInPA
New Contributor I
981 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
945 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
946 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
938 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


DaveInPA
New Contributor I
930 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.

Zulkifli_Intel
Moderator
905 Views

Hello David Rosner,

 

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

 

Sincerely,

Zulkifli

 

Zulkifli_Intel
Moderator
843 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


Zulkifli_Intel
Moderator
767 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


Reply