C#屏幕摄像头录像软件代码


C#基于第三方控件开发的屏幕,摄像头录像软件代码,可实现二次开发。
资源截图
代码片段和文件信息
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 Oraycn.MCapture;
using Oraycn.MFile;
using ESBasic;

namespace Video
{
    public partial class Form1 : Form
    {
        private ICapturer audioCapturer;
        private ICapturer videoCapturer;
        private VideoFileMaker videoFileMaker;
        private int starTime = 0;//开始录制初始时间
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender EventArgs e)
        {
            comboBox1.SelectedIndex = 1;
            comboBox2.SelectedIndex = 0;

            textBox1.Enabled = false;
            textBox2.Enabled = false;

            button2.Enabled = false;
            停止ToolStripMenuItem.Enabled = false;
            notifyIcon1.Visible = false;
        }
        //开始录像
        private void button1_Click(object sender EventArgs e)
        {
            this.button1.Enabled = false;//禁用按钮同时作为标记位
            开始ToolStripMenuItem.Enabled = false;
            //采样率
            int audioSampleRate = 16000;
            //声道
            int channelCount = 1;

            if (this.comboBox1.SelectedItem.ToString() == “麦克风“)
            {
                this.audioCapturer = CapturerFactory.CreateMicrophoneCapturer(0);
                ((IMicrophoneCapturer)this.audioCapturer).AudioCaptured += new ESBasic.CbGeneric(AudioCaptured);
            }
            else //声卡
            {
                this.audioCapturer = CapturerFactory.CreateSoundcardCapturer();
                ((ISoundcardCapturer)this.audioCapturer).AudioCaptured += new ESBasic.CbGeneric(AudioCaptured);
                audioSampleRate = ((ISoundcardCapturer)this.audioCapturer).SampleRate;
                channelCount = ((ISoundcardCapturer)this.audioCapturer).ChannelCount;
            }

            int frameRate = 15;
            System.Drawing.Size videoSize = new Size(int.Parse(this.textBox1.Text ) int.Parse(this.textBox2.Text ));

            if (this.comboBox2.SelectedItem.ToString ()==“摄像头“) //摄像头
            {
                this.videoCapturer = CapturerFactory.CreateCameraCapturer(0 videoSize frameRate);
                ((ICameraCapturer)this.videoCapturer).ImageCaptured += new ESBasic.CbGeneric(ImageCaptured);
            }
            else // 桌面
            {
                this.videoCapturer = CapturerFactory.CreateDesktopCapturer(frameRate false);
                ((IDesktopCapturer)this.videoCapturer).ImageCaptured += new ESBasic.CbGeneric(ImageCaptured);
            }
            videoFileMaker = new VideoFileMaker();
            this.videoFileMaker.Initialize(“Video.mp4“ VideoCodecType.H264 videoSize.Width videoSize.Height frameRate AudioCodecType.AAC audioSampleRate channelCou

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件    7984428  2015-06-05 16:15  屏幕录像Oraycn.RecordDemo.rar

     文件        187  2015-06-08 08:04  屏幕录像VideoApp.config

     文件   13496832  2012-12-06 15:38  屏幕录像VideoinDebugavcodec-53.dll

     文件     349696  2012-12-06 15:37  屏幕录像VideoinDebugavdevice-53.dll

     文件     890880  2012-12-06 15:37  屏幕录像VideoinDebugavfilter-2.dll

     文件    2462208  2012-12-06 15:38  屏幕录像VideoinDebugavformat-53.dll

     文件     137728  2012-12-06 15:37  屏幕录像VideoinDebugavutil-51.dll

     文件     398336  2015-05-27 17:24  屏幕录像VideoinDebugESBasic.dll

     文件     142336  2015-06-01 10:14  屏幕录像VideoinDebugOMFile.dll

     文件    1164800  2015-06-01 09:33  屏幕录像VideoinDebugOraycn.MCapture.dll

     文件     118272  2015-06-01 10:14  屏幕录像VideoinDebugOraycn.MFile.dll

     文件     296960  2012-12-06 15:37  屏幕录像VideoinDebugswscale-2.dll

     文件        187  2015-06-08 08:04  屏幕录像VideoinDebugVideo.vshost.exe.config

     文件        490  2010-03-17 22:39  屏幕录像VideoinDebugVideo.vshost.exe.manifest

     文件      24064  2015-06-13 16:18  屏幕录像VideoinDebug录像工具.exe

     文件        187  2015-06-08 08:04  屏幕录像VideoinDebug录像工具.exe.config

     文件      30208  2015-06-13 16:18  屏幕录像VideoinDebug录像工具.pdb

     文件      24224  2015-06-13 16:15  屏幕录像VideoinDebug录像工具.vshost.exe

     文件        187  2015-06-08 08:04  屏幕录像VideoinDebug录像工具.vshost.exe.config

     文件        490  2010-03-17 22:39  屏幕录像VideoinDebug录像工具.vshost.exe.manifest

     文件       9216  2015-06-13 16:18  屏幕录像VideoForm1.cs

     文件      17235  2015-06-13 16:17  屏幕录像VideoForm1.Designer.cs

     文件      11493  2015-06-13 16:17  屏幕录像VideoForm1.resx

     文件       1406  2015-06-08 16:33  屏幕录像Video
oti.ico

     文件       1453  2015-06-08 10:58  屏幕录像VideoobjDebugDesignTimeResolveAssemblyReferences.cache

     文件       7295  2015-06-13 16:11  屏幕录像VideoobjDebugDesignTimeResolveAssemblyReferencesInput.cache

     文件          0  2015-06-08 08:04  屏幕录像VideoobjDebugTemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2015-06-08 08:04  屏幕录像VideoobjDebugTemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2015-06-08 08:04  屏幕录像VideoobjDebugTemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

     文件       1206  2015-06-13 16:18  屏幕录像VideoobjDebugVideo.csproj.FileListAbsolute.txt

............此处省略27个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)