I am using OpenCV to process videos for my research. I have Python 2.7 and OpenCV 3.2 versions installed on Windows 10. When I do background subtraction on a video in Python using OpenCV, it works fine and produces the output. However, when I try to save the background subtracted video, it throws this error:
warning: Error opening file (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:779)
warning: MAH00119.avi (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:780)
OpenCV: FFMPEG: tag 0x34363258/'X264' is not supported with codec id 28 and format 'h264 / raw H.264 video'
Failed to load OpenH264 library: openh264-1.6.0-win64msvc.dll
Please check environment and/or download library: https://github.com/cisco/openh264/releases
[libopenh264 @ 0000000001f5bf60] Incorrect library version loaded
Could not open codec 'libopenh264': Unspecified error
I am processing MP4 videos. And I followed the instructions carefully while installing ffmpeg, like adding the bin's path to environment variables. I don't know what else to do. Stuck on this for three days now.
Any help would be much appreciated! Thanks in advance!!
The error message you are getting says that openCV can't load the H264 codec. H264 doesn't come by default with the default installation of openCV.
To add the H264 codec download 'openh264-1.6.0-win64msvc.dll.bz2' from https://github.com/cisco/openh264/releases/tag/v1.6.0.
Extract the file and move the extracted DLL to the same directory as your python file. OpenCV should now be able to find the DLL and load the H264 codec.
Note that in your error message, openCV is looking for the openh264-1.6.0-win64msvc.dll (failed to load: openh264-1.6.0-win64msvc.dll.bz2) which is what we have now provided.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With