VideoWriter不能在Win7-64Bit VM上工作 [英] VideoWriter not working on Win7-64Bit VM
问题描述
我编码下面尝试持有一个图片,并计数数百,最终抓住所有他们下面的编解码器MP42(MPEG4-V2)的视频
I coded the below which tries to hold a picture and count number hundred and finally grab all them to a video with following codec MP42(MPEG4-V2)
#include <stdAfx.h>
#include <iostream>
#include <opencv2\opencv.hpp>
using namespace cv;
using namespace std;
int n=0;
char a;
int main(int, char** argv)
{
Mat image= imread("C:\\Users\\Metin\\Desktop\\images.jpg");
Mat newimage;
VideoWriter vide ("Hopdedik.avi",CV_FOURCC('M','P','4','2'),30.0,image.size());
vide.open("Hopdedik.avi",CV_FOURCC('M','P','4','2'),30.0,image.size());
for(int n=0; n<100;n++){
cout<<n<<'\n';
std::string s= to_string(static_cast<long long>(n));
image.copyTo(newimage);
putText(newimage,s,Point(100,40),cv::FONT_HERSHEY_COMPLEX,2,cv::COLORMAP_COOL,2,2,false);
imshow("asd",newimage);
if(!vide.isOpened())cout<<"can not opened";
vide.write(newimage);
waitKey(10);
}
vide.release();
return 0;
}
我开始在发布模式下调试,并将.exe文件复制到Virtualbox Win7- 64位。
I started debugging on Release mode and copied the .exe files to Virtualbox Win7-64 bit. Right after I put necessary .dll files exe works but the code can't properly create the video.
我试图安装以下两种编解码器:
< a href =http://www.fourcc.org/downloads/angel-potion-mpeg-4--8/ =nofollow> http://www.fourcc.org/downloads/angel-potion- mpeg-4--8 /
和Indeo是: http://www.afreecodec.com/codec-by-code/iv45-160.html
I have tried to install following two codecs: http://www.fourcc.org/downloads/angel-potion-mpeg-4--8/ and Indeo which is: http://www.afreecodec.com/codec-by-code/iv45-160.html
但它没有工作。 / p>
But it did not work.
推荐答案
一旦我遇到类似的问题,opencv无法读取视频。没有任何警告。原因是一个自动化的字符串生成器导致opencv_mmpeg.dll,这是从系统中丢失。所以,我调试到cap_ffmpeg.cpp,发现这:
Once I faced a similar problem where opencv couldn't read a video. There was no warning at all. The reason was that an automated string maker resulted in "opencv_mmpeg.dll" which was missing from the system. So, I debugged up to cap_ffmpeg.cpp and found this:
#if defined WIN32 || defined _WIN32
const char* module_name = "opencv_ffmpeg"
CVAUX_STR(CV_MAJOR_VERSION) CVAUX_STR(CV_MINOR_VERSION) CVAUX_STR(CV_SUBMINOR_VERSION)
#if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__)
"_64"
#endif
".dll";
因此,将 opencv_ffmpeg_64.dll 复制到您的文件夹,结果。否则,你需要深入调试。首先,将文件opencv / modules / highgui / src / cap.cpp(以及需要编译的头文件)插入到项目中,以便可以逐行调试。我假设很多其他文件将需要进一步下降到代码。
So, copy opencv_ffmpeg_64.dll to your folder and you might have some results. Else, you need to debug deeply. Start by inserting into your project the file opencv/modules/highgui/src/cap.cpp (and the headers needed to be compiled) so you can debug line by line. I suppose many other files will be needed to go further down into the code.
这篇关于VideoWriter不能在Win7-64Bit VM上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!