• 大小: 13.37MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-07-22
  • 语言: 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  屏幕录像\Video\App.config

     文件   13496832  2012-12-06 15:38  屏幕录像\Video\bin\Debug\avcodec-53.dll

     文件     349696  2012-12-06 15:37  屏幕录像\Video\bin\Debug\avdevice-53.dll

     文件     890880  2012-12-06 15:37  屏幕录像\Video\bin\Debug\avfilter-2.dll

     文件    2462208  2012-12-06 15:38  屏幕录像\Video\bin\Debug\avformat-53.dll

     文件     137728  2012-12-06 15:37  屏幕录像\Video\bin\Debug\avutil-51.dll

     文件     398336  2015-05-27 17:24  屏幕录像\Video\bin\Debug\ESBasic.dll

     文件     142336  2015-06-01 10:14  屏幕录像\Video\bin\Debug\OMFile.dll

     文件    1164800  2015-06-01 09:33  屏幕录像\Video\bin\Debug\Oraycn.MCapture.dll

     文件     118272  2015-06-01 10:14  屏幕录像\Video\bin\Debug\Oraycn.MFile.dll

     文件     296960  2012-12-06 15:37  屏幕录像\Video\bin\Debug\swscale-2.dll

     文件        187  2015-06-08 08:04  屏幕录像\Video\bin\Debug\Video.vshost.exe.config

     文件        490  2010-03-17 22:39  屏幕录像\Video\bin\Debug\Video.vshost.exe.manifest

     文件      24064  2015-06-13 16:18  屏幕录像\Video\bin\Debug\录像工具.exe

     文件        187  2015-06-08 08:04  屏幕录像\Video\bin\Debug\录像工具.exe.config

     文件      30208  2015-06-13 16:18  屏幕录像\Video\bin\Debug\录像工具.pdb

     文件      24224  2015-06-13 16:15  屏幕录像\Video\bin\Debug\录像工具.vshost.exe

     文件        187  2015-06-08 08:04  屏幕录像\Video\bin\Debug\录像工具.vshost.exe.config

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

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

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

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

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

     文件       1453  2015-06-08 10:58  屏幕录像\Video\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7295  2015-06-13 16:11  屏幕录像\Video\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件          0  2015-06-08 08:04  屏幕录像\Video\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2015-06-08 08:04  屏幕录像\Video\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2015-06-08 08:04  屏幕录像\Video\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

     文件       1206  2015-06-13 16:18  屏幕录像\Video\obj\Debug\Video.csproj.FileListAbsolute.txt

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

评论

共有 条评论

相关资源