• 大小: 8.39MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-19
  • 语言: C#
  • 标签: C#  winform  播放  

资源简介

C# Winform 实现 , 可以播放苹果手机mov视频,以及mp4等格式。调用Windows Media Player COM控件,可播放许多种格式视频, 并获取流媒体采集结束时的最后画面作为流媒体的封面。 有录像功能:“开始录像”、“暂停录像”、 “停止录像”、“保存录像”; 播放功能:“开始播放”“暂停播放”、“停止播放”、“播放”功能;“播放”即播放自己录制的

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.IO;
using ICameraDll.DirectX.Capture;
namespace ICameraDll
{
    public  class Camera : ICamera
    {
        private Capture capture;//摄像头录像操作
        private Filters filters = new Filters();//Filter集合
        public string stauts = “NoThing“;//当前状态,默认

        #region 属性

        private string logFilePath;
        private string logFileName;
        /// 
        /// 日志文件路径
        /// 

        public string LogFilePath
        {
            get
            {
                return logFilePath;
            }
            set
            {
                logFilePath = value;
            }
        }
        /// 
        /// 日志文件名
        /// 

        public string LogFileName
        {
            get
            {
                return logFileName;
            }
            set
            {
                logFileName = value;
            }
        }
        private string ImageFilePath;
        private string ImageFileName;
        #endregion

        #region 摄像头开始录制视频
        /// 
        /// 摄像头开始录制视频
        /// 

        /// 展现控件
        /// 视频存储路径
        /// 视频存储文件名
        /// 录像开启成功:1 录像开启失败:0,系统程序:-1,ffshow视频解码器不存在:2视像头录像正在录制:3
        public int StartRecording(Control videoControl string filePath string fileName)
        {
            var state = 0;
            //开始录制前判断摄像头是否在进行录像工作,工作时关掉它
            if (this.capture != null)
            {
                this.capture.Stop();
                this.capture.DisposeCapture();
                this.stauts = “NoThing“;
            }
            CameraManage cameraManage = new CameraManage(logFilePath logFileName);
            //当前不为录像状态时则开始录像
            if (!this.stauts.Equals(“Recing“))
            {
                //获取ffshow视频解码器索引
                var ffshowIndex = cameraManage.GetffshowIndex();
                if (ffshowIndex > 0)//解码器1判断,ffshowIndex
                {
                    try
                    {
                        var Flie = filePath + fileName;
                        cameraManage.CreatFile(Flie);
                        this.capture = new Capture(new Filters().VideoInputDevices[0] null);//实例化视像头对象
                        this.capture.PreviewWindow = videoControl;//设置承载控件
                        this.capture.VideoCompressor = this.filters.VideoCompressors[ffshowIndex];//设置视频解码器
                        this.capture.Filename = Flie;//设置要保存的文件路径和文件名,格式例如d:\\ssss.avi
                        this.capture.frameRate = 15;//设置帧
                        
                        this.capture.frameSize = new Size(320 240);//设置视频分辨率
                        this.capture.

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

    ..A..H.    174080  2017-09-13 12:40  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\.vs\WinFormCameraDemo\v15\.suo

     文件      61440  2010-08-11 17:32  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\DLL\DShowNET.dll

     文件      61440  2010-08-11 17:32  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\bin\Debug\DShowNET.dll

     文件      51200  2013-07-24 15:51  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\bin\Debug\ICameraDll.dll

     文件     161280  2013-07-24 15:51  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\bin\Debug\ICameraDll.pdb

     文件       8780  2013-07-24 15:11  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\Camera.cs

     文件       3570  2013-07-24 09:17  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\CameraManage.cs

     文件       3331  2013-03-25 09:29  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\DirectX\Capture\AudioCapabilities.cs

     文件       1731  2013-03-25 09:28  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\DirectX\Capture\AudioSource.cs

     文件      46866  2013-03-25 11:49  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\DirectX\Capture\Capture.cs

     文件      30042  2013-03-25 11:22  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\DirectX\Capture\CPlay.cs

     文件       4562  2013-03-25 09:28  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\DirectX\Capture\CrossbarSource.cs

     文件        332  2013-03-25 09:29  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\DirectX\Capture\DeviceInUseException.cs

     文件       1959  2013-03-25 09:29  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\DirectX\Capture\DirectShowPropertyPage.cs

     文件       4833  2013-03-25 09:32  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\DirectX\Capture\Filter.cs

     文件       2395  2013-03-25 15:29  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\DirectX\Capture\FilterCollection.cs

     文件        567  2013-03-25 09:29  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\DirectX\Capture\Filters.cs

     文件        809  2013-03-25 09:29  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\DirectX\Capture\PropertyPage.cs

     文件       7280  2013-03-25 09:29  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\DirectX\Capture\PropertyPageCollection.cs

     文件        916  2013-03-25 09:29  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\DirectX\Capture\Source.cs

     文件       7823  2013-03-25 09:29  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\DirectX\Capture\SourceCollection.cs

     文件       2649  2013-03-25 09:30  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\DirectX\Capture\Tuner.cs

     文件        145  2013-03-25 09:29  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\DirectX\Capture\TunerInputType.cs

     文件       1545  2013-03-25 09:29  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\DirectX\Capture\VfwCompressorPropertyPage.cs

     文件       3091  2013-03-25 09:29  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\DirectX\Capture\VideoCapabilities.cs

     文件       1925  2013-07-24 14:23  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\ICamera.cs

     文件       3841  2013-03-25 15:34  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\ICameraDll.csproj

     文件        227  2013-03-22 16:05  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\ICameraDll.csproj.user

     文件       2867  2013-07-23 17:22  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7056  2013-07-24 13:07  C#Winform视频录制播放\WinFormCameraDemo\WinFormCameraDemo\WinFormCameraDemo\ICameraDll\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

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

评论

共有 条评论