本文介绍了如何使用网络摄像头录制视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨!我是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.
推荐答案
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();
}
此解决方案基于此 []。我希望我能提供帮助。
This solution is based on this onvif camera software[^]. I hope I could help.
这篇关于如何使用网络摄像头录制视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!