资源简介
该Demo实现了基本的AForge录制视频等功能。
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Timers;
//using AForge
using AForge;
using AForge.Video;
using AForge.Video.DirectShow;
using AForge.Video.FFMPEG;
using AForge.Controls;
namespace video_record
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//关闭窗口响应函数
private void button2_Click(object sender EventArgs e)
{
if (this.writer.IsOpen)
{
MessageBox.Show(“视频流还没有写完,请点击结束录制。“ “错误“ MessageBoxButtons.OK MessageBoxIcon.Error);
return;
}
this.videoSource.SignalToStop();
this.videoSource.WaitForStop();
this.videoSourcePlayer.SignalToStop();
this.videoSourcePlayer.WaitForStop();
this.Hide();
this.Close();
this.Dispose();
}
private FilterInfoCollection videoDevices; //摄像头设备
private VideoCaptureDevice videoSource; //视频的来源选择
private VideoSourcePlayer videoSourcePlayer; //AForge控制控件
private VideoFileWriter writer; //写入到视频
private bool is_record_video = false; //是否开始录像
System.Timers.Timer timer_count;
int tick_num = 0;
//窗体初始化函数
private void Form1_Load(object sender EventArgs e)
{
this.label5.Visible = false;
this.videoSourcePlayer = new AForge.Controls.VideoSourcePlayer();
this.videoSource = new VideoCaptureDevice();
this.writer = new VideoFileWriter();
//设置视频编码格式
this.comboBox_videoecode.Items.Add(“Raw“);
this.comboBox_videoecode.Items.Add(“MPEG2“);
this.comboBox_videoecode.Items.Add(“FLV1“);
this.comboBox_videoecode.Items.Add(“H263p“);
this.comboBox_videoecode.Items.Add(“MSMPEG4v3“);
this.comboBox_videoecode.Items.Add(“MSMPEG4v2“);
this.comboBox_videoecode.Items.Add(“WMV2“);
this.comboBox_videoecode.Items.Add(“WMV1“);
this.comboBox_videoecode.Items.Add(“MPEG4“);
this.comboBox_videoecode.SelectedIndex = 1;
//设置视频来源
try
{
// 枚举所有视频输入设备
videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
if (videoDevices.Count == 0)
throw new ApplicationException(); //没有找到摄像头设备
foreach (FilterInfo device in videoDevices)
{
this.comboBox_camera.Items.Add(device.Name);
}
//this.comboBox_camera.SelectedIndex = 0; //注释掉,选择摄像头来源的时候才会才会触发显示摄像头信息
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 44544 2013-07-15 23:04 video_record\video_record\AForge\AForge.Controls.dll
文件 66108 2013-07-15 23:04 video_record\video_record\AForge\AForge.Controls.xm
文件 20480 2013-07-15 23:07 video_record\video_record\AForge\AForge.DebuggerVisualizers (2010).dll
文件 17920 2013-07-15 23:04 video_record\video_record\AForge\AForge.dll
文件 15872 2013-07-15 23:04 video_record\video_record\AForge\AForge.Fuzzy.dll
文件 80837 2013-07-15 23:04 video_record\video_record\AForge\AForge.Fuzzy.xm
文件 25600 2013-07-15 23:04 video_record\video_record\AForge\AForge.Genetic.dll
文件 119443 2013-07-15 23:04 video_record\video_record\AForge\AForge.Genetic.xm
文件 262656 2013-07-15 23:04 video_record\video_record\AForge\AForge.Imaging.dll
文件 16384 2013-07-15 23:04 video_record\video_record\AForge\AForge.Imaging.Formats.dll
文件 28416 2013-07-15 23:04 video_record\video_record\AForge\AForge.Imaging.Formats.xm
文件 5632 2013-07-15 23:08 video_record\video_record\AForge\AForge.Imaging.IPPrototyper.dll
文件 944046 2013-07-15 23:04 video_record\video_record\AForge\AForge.Imaging.xm
文件 8704 2013-07-15 23:04 video_record\video_record\AForge\AForge.MachineLearning.dll
文件 22480 2013-07-15 23:04 video_record\video_record\AForge\AForge.MachineLearning.xm
文件 68096 2013-07-15 23:04 video_record\video_record\AForge\AForge.Math.dll
文件 270650 2013-07-15 23:04 video_record\video_record\AForge\AForge.Math.xm
文件 21504 2013-07-15 23:04 video_record\video_record\AForge\AForge.Neuro.dll
文件 83378 2013-07-15 23:04 video_record\video_record\AForge\AForge.Neuro.xm
文件 23040 2013-07-15 23:04 video_record\video_record\AForge\AForge.Robotics.Lego.dll
文件 94429 2013-07-15 23:04 video_record\video_record\AForge\AForge.Robotics.Lego.xm
文件 18432 2013-07-15 23:04 video_record\video_record\AForge\AForge.Robotics.Surveyor.dll
文件 69963 2013-07-15 23:04 video_record\video_record\AForge\AForge.Robotics.Surveyor.xm
文件 18432 2013-07-15 23:04 video_record\video_record\AForge\AForge.Robotics.TeRK.dll
文件 51688 2013-07-15 23:04 video_record\video_record\AForge\AForge.Robotics.TeRK.xm
文件 61440 2013-07-15 23:04 video_record\video_record\AForge\AForge.Video.DirectShow.dll
文件 195287 2013-07-15 23:04 video_record\video_record\AForge\AForge.Video.DirectShow.xm
文件 20992 2013-07-15 23:04 video_record\video_record\AForge\AForge.Video.dll
文件 61952 2013-07-15 23:07 video_record\video_record\AForge\AForge.Video.FFMPEG.dll
文件 241743 2013-07-15 23:07 video_record\video_record\AForge\AForge.Video.FFMPEG.xm
............此处省略60个文件信息
相关资源
- springmvcDemo
- MMTools控件的demo,包含从TMemoryStream内
- mybatis maven demo
- 20110610162910c调用demo.rar
- spring内置jdbctemplate使用demo
- 百度定位demo,能显示经纬度和具体地
- Bluetooth demo 打开 关闭 绑定 解绑全都
- spring使用demo
- 指纹识别demo
- struts1的简单demo含数据库
- TTS文字变语音朗读DEMO
- 地形渲染DEMO lod地形代码
- h264码流rtp传输demo
- LPB120串口转WiFi的实现
- 网口相机连接Demo
- supersocket 服务端+客户端 DEMO
- Node学生管理系统Express+MongoDB
- wifidemo123
- 百度定位和路线规划Demo
- 拉杆抽奖小demo
- WebRTCDemo.zip
- SpirePdfDemo.zip
- Bootstrap后台主题框架demo
- WinceChart曲线控件显示Demo
- myServiceDemo
- unity推箱子完整项目源码
- SPI主从通讯最终版Demo2019_3_24
- 滑动切换Activity Demo
- NTKO office的Demo自己写的,还有官方D
- demo3d初级教程
评论
共有 条评论