问题描述
我正在使用C#将一组图像转换为视频,我使用编码器将图像转换为视频...我正在从网络摄像头捕获图像。
现在捕获正常工作问题来了当我点击按钮进行转换并开始执行代码块时出现错误,vshost32.exe已停止工作..
该块的块代码是 - >
I am converting a set of images into video using C# and i am using encoder for converting the images into video... and i am capturing images from a webcamera.
now capturing is working fine the problem coming is when i click on button for convert and it start executing the code block it comes an error that vshost32.exe has stop working..
my block code for that block is -->
string[] files = { };
foreach (string f in files)
{
Debug.Print(f);
}
WMEncoder encoder = new WMEncoder();
try
{
files = System.IO.Directory.GetFiles(@"C:\Users\gaurav.STRINGNET\Desktop\New folder\video capture\video capture\bin\Debug\img\");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
foreach (string f in files)
{
Debug.Print(f);
}
//profile for each frame
IWMEncProfile2 pro = new WMEncProfile2();
try
{
pro.LoadFromFile(@"C:\Users\gaurav.STRINGNET\test.prx");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "error1");
}
//build up the collection of frames
IWMEncSourceGroup2 frameSourceGroup;
try
{
foreach (string filename in files)
{
frameSourceGroup = ( IWMEncSourceGroup2)encoder.SourceGroupCollection.Add(filename);
frameSourceGroup.set_Profile(pro);
//odd to have to do it this way instead of via property
IWMEncVideoSource2 sourceVideo = (IWMEncVideoSource2)frameSourceGroup.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
sourceVideo.SetInput(filename," ", " ");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "error 2");
}
try
{
encoder.File.LocalFileName=
@"C:\Users\gaurav.STRINGNET\output.wmv";
encoder.PrepareToEncode(true);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "error 3");
}
// --------------
请尽快帮助我,我正在使用Windows 7 32位操作系统和Visual Studio 2010,我已经下载并安装了Microsoft网站的Windows Encoder库..
有一个美好的一天..请帮助我asap
//--------------
Kindly help me asap its urgent and i am using Windows 7 32-Bit OS with Visual Studio 2010 and i had already downloaded and installed the Windows Encoder library for Microsoft Website..
have a nice day .. Please help me asap
推荐答案
这篇关于Vshost32.exe停止工作...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!