private void CloseFile() { motion.Camera camera = cameraWindow.Camera; if (camera != null) { // detach camera from camera window cameraWindow.Camera = null; // signal camera to stop camera.SignalToStop(); // wait for the camera camera.WaitForStop(); camera = null; if (detector != null) { detector.Reset(); } } if (writer != null) { writer.Dispose(); writer = null; } //intervalsToSave = 0; }
private void AviInit() { //获取保存文件名 SaveFileDialog sav = new SaveFileDialog(); sav.Filter = "视频文件 (*.avi)|*.*"; string str = @"E:\sp\sp"; if (sav.ShowDialog() == DialogResult.OK) { str = sav.FileName; if (name != "") { int j = str.LastIndexOf(@"\"); directory = str.Substring(0, j) + @"\sp"; str = directory + name + "-" + System.DateTime.Now.ToString("yyMMdd-HHmm"); } } else { directory = @"E:\sp\sp"; str = directory + name + "-" + System.DateTime.Now.ToString("yyMMdd-HHmm"); } str = str + ".avi"; //视频写初始化 aw = new Tiger.Video.VFW.AVIWriter(); aw.FrameRate = 10; aw.Codec = "divx"; //"DiVx Codec 4.12";//Micro //aw.Open(str, 704, 576); aw.Open(str, width, height); fcc = aw.Fcc; }