如何使用网络摄像头录制视频?
问题描述:
嗨!我是c#的新手,我有一个项目,通过我的网络摄像头录制视频并保存。但我不知道如何用c#编程语言做到这一点。顺便感谢你的帮助。
Hi! I am new in c# and i have an project which is recording a video via my webcam and save it. But i don't know how to do this in c# programming language. By the way thanks for help.
答
https://www.google.it/搜q = C%23 +的网络摄像头和安培;的SourceID = IE7&安培; RLS = com.microsoft:它-IT:IE-地址&安培,即=安培; OE =&安培; gfe_rd = CR安培; EI = DqImVObHGaXD8gfr-4DQAQ&安培; gws_rd = SSL [ ^ ]
和
Versatile WebCam C#库 [ ^ ]
还有
如何使用带有.NET Framework 4.0和Microsoft Expression Encoder 4的C#中的Web摄像头 [
href =http://www.codeproject.com/Articles/202464/How-to -use-a-WebCam-in-C-with-the-NET-Frameworktarget =_ blanktitle =New Window> ^ ]
但据我所知,最后一个要求Expression Encoder与Windows 8不兼容。
LG
https://www.google.it/search?q=C%23+webcam&sourceid=ie7&rls=com.microsoft:it-IT:IE-Address&ie=&oe=&gfe_rd=cr&ei=DqImVObHGaXD8gfr-4DQAQ&gws_rd=ssl[^]
And
Versatile WebCam C# library[^]
And also
How to use a web cam in C# with .NET Framework 4.0 and Microsoft Expression Encoder 4[
href="http://www.codeproject.com/Articles/202464/How-to-use-a-WebCam-in-C-with-the-NET-Framework" target="_blank" title="New Window">^]
But the last requires Expression Encoder which is not compatible with Windows 8 as far as I know.
LG
如果此问题仍然存在,我建议您学习本视频指南: C#相机教程#6 - 录制视频 [ ^ ]
观看视频后,您将看到首先需要在相机和应用程序之间建立连接。在此之后,您需要按如下方式实现录制功能:
If this issue is still relevant, I can recommend you to study this video guide: C# camera tutorial #6 - Recording video[^]
After watching the video you will see that first you need to create connection between your camera and the application. After this you need to implement the recording feature as follows:
private void StartCapture_Click(object sender, RoutedEventArgs e)
{
if (_videoSender == null) return;
var date = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" +
DateTime.Now.Hour + "-" + DateTime.Now.Minute + "-" + DateTime.Now.Second;
var currentpath = AppDomain.CurrentDomain.BaseDirectory + date + ".mpeg4";
_recorder = new MPEG4Recorder(currentpath);
_recorder.MultiplexFinished += _recorder_MultiplexFinished;
_connector.Connect(_videoSender, _recorder.VideoRecorder);
}
void _recorder_MultiplexFinished(object sender, Ozeki.VoIP.VoIPEventArgs<bool> e)
{
_recorder.MultiplexFinished -= _recorder_MultiplexFinished;
_recorder.Dispose();
}
private void StopCapture_Click(object sender, RoutedEventArgs e)
{
if (_videoSender == null) return;
_connector.Disconnect(_videoSender, _recorder.VideoRecorder);
_recorder.Multiplex();
}
此解决方案基于此 onvif相机软件 [ ^ ]。我希望我能提供帮助。
This solution is based on this onvif camera software[^]. I hope I could help.