当前位置: 首页 > wzjs >正文

2022年ppt模板下载aso排名优化

2022年ppt模板下载,aso排名优化,wordpress中修改内容,wordpress theme 企业C#AForge 实现视频录制 ​ 在C#中,使用AForge 库实现视频录制功能是一个比较直接的过程。AForge 是一个开源的.NET框架,提供了许多用于处理图像和视频的类库。 开发步骤 安装AForge库 ​ 首先,确保你的项目中已经安装了 AForge.Video和AFo…

C#+AForge 实现视频录制

​ 在C#中,使用AForge 库实现视频录制功能是一个比较直接的过程。AForge 是一个开源的.NET框架,提供了许多用于处理图像和视频的类库。

在这里插入图片描述

开发步骤

安装AForge库

​ 首先,确保你的项目中已经安装了 AForge.VideoAForge.Video.FFMPEG.你可以通过NuGet包管理器来实现安装这些库:

  1. 打开你的Visual Studio 项目
  2. 转到工具->NuGet包管理器->管理解决方案的NuGet包
  3. 搜索并安装 AForgeAForge.Video 以及 AForge.Video.FFMPEG

在这里插入图片描述

打开与关闭摄像头

/// <summary>
/// 打开摄像头
/// </summary>
private void OpenCamera()
{//设置视频源并启动this.videoCaptureDevice = new VideoCaptureDevice(filterInfoCollection[this.comboBox1.SelectedIndex].MonikerString);this.videoSourcePlayer1.VideoSource = this.videoCaptureDevice;this.videoSourcePlayer1.Start();isOpen = true;this.btnOpen.Text = "关闭";
}/// <summary>
/// 关闭摄像头
/// </summary>
private void CloseCamera()
{if (this.videoSourcePlayer1.VideoSource != null){this.videoSourcePlayer1.SignalToStop();this.videoSourcePlayer1.WaitForStop();this.videoSourcePlayer1.VideoSource = null;isOpen = false;this.btnOpen.Text = "打开";}
}

实现拍照

/// <summary>
/// 拍照
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button2_Click(object sender, EventArgs e)
{if (!this.isOpen){MessageBox.Show("请先打开摄像头!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);return;}try{//拍照bmp = this.videoSourcePlayer1.GetCurrentVideoFrame();this.pictureBox1.Image = bmp;if (!Directory.Exists("images"))Directory.CreateDirectory("images");string fileName = string.Format("images/图片_{0}.jpg", DateTime.Now.ToString("yyyy-MM-dd hh-mm-ss"));bmp.Save(fileName);}catch (Exception ex){MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);}
}

实现录像

/// <summary>
/// 开始录像
/// </summary>
private void StartRecord()
{if (!Directory.Exists("videos"))Directory.CreateDirectory("videos");string fileName = string.Format("videos/录像_{0}.avi", DateTime.Now.ToString("yyyy-MM-dd hh-mm-ss"));this.videoFileName = fileName;// 创建视频文件写入器videoWriter = new VideoFileWriter();videoSourcePlayer1.NewFrame += VideoSourcePlayer1_NewFrame;videoWriter.Open(fileName, 1280, 960, 30, VideoCodec.MPEG4, 1000000); // 设置分辨率、帧率和比特率
}/// <summary>
/// 停止录像
/// </summary>
private void StopRecord()
{this.CloseCamera();if (videoWriter != null){videoWriter.Close();videoWriter = null;}this.FlushVideoPlayList();
}

实现录屏

/// <summary>
/// 开始录屏
/// </summary>
/// <param name="path"></param>
public void StartRecording(string path) //该方法需要有一个路径参数,前面我们设置过了
{var directory = Path.GetDirectoryName(path);if (!Directory.Exists(directory)) //检查路径是否存在,不存在就自动创建{Directory.CreateDirectory(directory);}try{FrmMain.videoWriter = new VideoFileWriter();//用于生成视频文件,参数分别为路径、视频的宽度、高度、帧数、编码格式以及视频码率FrmMain.videoWriter.Open(path, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, 25, VideoCodec.MPEG4, 5000000);recordingThread = new Thread(RecordScreen);recordingThread.Start();}catch (Exception err){Console.WriteLine(err.ToString());MessageBox.Show("屏幕录制开启失败: " + err.Message, "提示!");}
}/// <summary>
/// 停止录屏
/// </summary>
public void StopRecording()
{try{recordingThread.Join();FrmMain.videoWriter.Close();}catch (Exception err){MessageBox.Show("屏幕录制停止失败: " + err.Message, "提示!");Console.WriteLine(err.ToString());}
}

视频播放

在这里插入图片描述

/// <summary>
/// 双击视频列表
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
{if (this.listBox1.SelectedItem == null) return;this.axWindowsMediaPlayer1.URL = string.Format("videos/{0}", this.listBox1.SelectedItem.ToString());
}

object sender, MouseEventArgs e)
{
if (this.listBox1.SelectedItem == null) return;

this.axWindowsMediaPlayer1.URL = string.Format("videos/{0}", this.listBox1.SelectedItem.ToString());

}


# 源码下载
CSDN: [C#+AForge 实现视频下载](https://download.csdn.net/download/m0_37631902/90477114?spm=1001.2014.3001.5503)
http://www.dtcms.com/wzjs/343641.html

相关文章:

  • 学校做网站的软件网站页面分析作业
  • 政府网站群建设方案百度文库成都专业的整站优化
  • 好的公文写作网站好看的网站设计
  • 国外可以做推广的网站有哪些做销售怎样去寻找客户
  • 通辽做网站新手怎么入行seo
  • 泉州市知名网站建设公司微信推广软件有哪些
  • 邯郸网络名称官网seo是什么
  • 溧水建设局网站焊工培训心得体会
  • 网站开发中如何实现gps定位电商网站对比表格
  • 网站建设得多少钱baidu百度网盘
  • wordpress 开发教程seo专员岗位职责
  • 佛山购物网站建设武汉百度推广代运营
  • 科技馆网站建设方案seo外链技巧
  • 班级网页模板html源码seo优化方式
  • 软件开发怎么自学seo精准培训课程
  • 安监局网站建设网站seo策划方案
  • 网站建设培训西安大数据营销是什么
  • 可以免费做3dLOGO的网站国外域名注册网站
  • 网站开发师是做什么的免费开通网站
  • 福田网站建设设计电销外包团队在哪找
  • 经典手机网站营销型网站外包
  • 中原区快速建站公司电话个人发布信息的免费平台
  • 网站优化 seo和sem河南疫情最新情况
  • 建设银行网站登录不上去网络运营师
  • 徐州做网站的公司哪些好网站推广怎么弄
  • 做网站怎么找客户seo数据优化教程
  • 北京网站推广技巧seo排名查询工具
  • 北京新鸿儒做的网站网站seo排名优化价格
  • 网站产品二级分类泰安seo培训
  • 如何做白日梦的网站深圳网络营销公司