Exemplo n.º 1
0
 //录像
 private void btnVideo_Click(object sender, EventArgs e)
 {
     if (btnVideo.Text == "录像")
     {
         sfDialog.Filter           = "*.avi|*.avi";
         sfDialog.Title            = "保存视频文件";
         sfDialog.InitialDirectory = Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("\\")).Substring(0, Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\")) + "\\Video\\";
         if (sfDialog.ShowDialog() == DialogResult.OK)
         {
             btnVideo.Text = "停止录像";
             VideoOperate.VCASetKeyFrmInterval(0, 250);                                                                                                     //设置MPEG压缩的关键帧间隔
             VideoOperate.VCASetBitRate(0, 256);                                                                                                            //设置MPEG压缩的位率
             VideoOperate.VCASetVidCapFrameRate(0, 25, false);                                                                                              //设置视频捕获频率
             VideoOperate.VCASetVidCapSize(0, 320, 240);                                                                                                    //设置视频捕获尺寸,此处即为宽320高240
             VideoOperate.VCASetXVIDQuality(0, 10, 3);                                                                                                      //设置MPEG4_XVID压缩的质量
             VideoOperate.VCASetXVIDCompressMode(0, VideoOperate.COMPRESSMODE.XVID_VBR_MODE);                                                               //设置MPEG4_XVID压缩的模式
             VideoOperate.VCAStartVideoCapture(0, VideoOperate.CAPMODEL.CAP_MPEG4_STREAM, VideoOperate.MP4MODEL.MPEG4_AVIFILE_CALLBACK, sfDialog.FileName); //开始视频捕获
         }
     }
     else if (btnVideo.Text == "停止录像")
     {
         btnVideo.Text = "录像";
         VideoOperate.VCAStopVideoCapture(0);    //停止视频捕获
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 自动录像
        /// </summary>
        private void AutoVideo()
        {
            btnVideo.Text = "停止录像";
            string strPath = Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("\\")).Substring(0, Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\")) + "\\Video\\";

            VideoOperate.VCASetKeyFrmInterval(intFlag, 250);
            VideoOperate.VCASetBitRate(intFlag, 256);
            VideoOperate.VCASetVidCapFrameRate(intFlag, 25, false);
            VideoOperate.VCASetVidCapSize(intFlag, 320, 240);
            VideoOperate.VCASetXVIDQuality(intFlag, 10, 3);
            VideoOperate.VCASetXVIDCompressMode(intFlag, VideoOperate.COMPRESSMODE.XVID_VBR_MODE);
            VideoOperate.VCAStartVideoCapture(intFlag, VideoOperate.CAPMODEL.CAP_MPEG4_STREAM, VideoOperate.MP4MODEL.MPEG4_AVIFILE_CALLBACK, strPath + DateTime.Now.ToString("yyyyMMddhhmmss") + ".avi");
        }