资源简介

该资源是基于supersocket——Aforge,调用摄像头并发送UDP数据到服务端并写入视频到服务端,可以结合web端操作。

资源截图

代码片段和文件信息

using Accord.Video.FFMPEG;
using AForge.Video;
using AForge.Video.DirectShow;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace UdpSocketClient
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        
        Socket udpSocket = new Socket(AddressFamily.InterNetwork SocketType.Dgram ProtocolType.Udp); //UDPsocket

        private static string IP = “127.0.0.1“;
        private static int PORT = 6602;
        EndPoint SERVER_ADDRESS = new IPEndPoint(IPAddress.Parse(IP) PORT);
        public static int SIZE = 40;
        private FilterInfoCollection VIDEO_DEVICES;  //摄像头设备
        private VideoCaptureDevice VIDEO_SOURCE;     //视频的来源选择
        public System.Timers.Timer Timer ;
        /// 
        /// web 发送的数据类型 密钥+设备号+录像时间+结束标志
        /// 

        /// 
        /// 
        private void webButton_Click(object sender EventArgs e)
        {
            string privateKey = “f21c2a0689443179082e02f8f44079“;
            string sessionId = “001“;
            byte[] body = Encoding.Default.GetBytes(“20|Second“);
            string endFlag =“**“;
       
            byte[] datas = initData(privateKeysessionIdendFlagbody);
            udpSocket.SendTo(datas SERVER_ADDRESS);
        }


        private void Form1_Load(object sender EventArgs e)
        {
            Timer = new System.Timers.Timer();
            Timer = new System.Timers.Timer();
            Timer.Elapsed += new System.Timers.ElapsedEventHandler(webButton_Click);   //到达时间的时候执行事件;
            Timer.AutoReset = true;   //设置是执行一次(false)还是一直执行(true);
            Timer.Interval = 3000;//设置定时间隔(毫秒为单位)
            Timer.Enabled = true;

            VIDEO_DEVICES = new FilterInfoCollection(FilterCategory.VideoInputDevice);
            foreach (FilterInfo item in VIDEO_DEVICES)
            {
                VIDEO_SOURCE = new VideoCaptureDevice(item.MonikerString);
                
                VIDEO_SOURCE.Newframe += new NewframeEventHandler(showVideo); //自动读帧
                VIDEO_SOURCE.Start();
            }
        }


        /// 
        /// 密钥构造成字节数组 (客户端)
        /// 

        /// 
        /// 
        private static byte[] InitBytes(string str)
        {
            byte[] fixedBytes = new byte[SIZE];
            if (String.IsNullOrEmpty(str))
                return fixedBytes;
            var bytes = Encoding.Default.GetBytes(str);

            for (int i = 0; i < bytes.Length; i++)
                fixedBytes[i] = byt

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

    ..A..H.     77312  2018-07-23 21:55  UdpSocketServer\.vs\UdpSocketServer\v14\.suo

     文件    1017749  2018-07-23 16:05  UdpSocketServer\packages\Accord.3.8.0\Accord.3.8.0.nupkg

     文件        213  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\build\Accord.dll.config

     文件        400  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\build\Accord.targets

     文件     151552  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\net35\Accord.dll

     文件     488904  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\net35\Accord.xml

     文件     151552  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\net35-unity full v3.5\Accord.dll

     文件     488904  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\net35-unity full v3.5\Accord.xml

     文件     151552  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\net35-unity micro v3.5\Accord.dll

     文件     488904  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\net35-unity micro v3.5\Accord.xml

     文件     151552  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\net35-unity subset v3.5\Accord.dll

     文件     488904  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\net35-unity subset v3.5\Accord.xml

     文件     151552  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\net35-unity web v3.5\Accord.dll

     文件     488904  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\net35-unity web v3.5\Accord.xml

     文件     131072  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\net40\Accord.dll

     文件     428413  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\net40\Accord.xml

     文件     131072  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\net45\Accord.dll

     文件     417885  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\net45\Accord.xml

     文件     131072  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\net46\Accord.dll

     文件     417885  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\net46\Accord.xml

     文件     131072  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\net462\Accord.dll

     文件     417885  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\net462\Accord.xml

     文件     121856  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\netstandard1.4\Accord.dll

     文件     416483  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\netstandard1.4\Accord.xml

     文件     115200  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\netstandard2.0\Accord.dll

     文件     417831  2017-10-19 00:59  UdpSocketServer\packages\Accord.3.8.0\lib\netstandard2.0\Accord.xml

     文件     220900  2018-07-23 16:05  UdpSocketServer\packages\Accord.Video.3.8.0\Accord.Video.3.8.0.nupkg

     文件      40960  2017-10-19 00:59  UdpSocketServer\packages\Accord.Video.3.8.0\lib\net35\Accord.Video.dll

     文件      65588  2017-10-19 00:59  UdpSocketServer\packages\Accord.Video.3.8.0\lib\net35\Accord.Video.xml

     文件      40960  2017-10-19 00:59  UdpSocketServer\packages\Accord.Video.3.8.0\lib\net35-unity full v3.5\Accord.Video.dll

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

评论

共有 条评论