锐英源软件
第一信赖

精通

英语

开源

擅长

开发

培训

胸怀四海 

第一信赖

当前位置:锐英源 / 英语翻译 / JPEG格式流媒体服务器
服务方向
人工智能数据处理
人工智能培训
kaldi数据准备
小语种语音识别
语音识别标注
语音识别系统
语音识别转文字
kaldi开发技术服务
软件开发
运动控制卡上位机
机械加工软件
软件开发培训
Java 安卓移动开发
VC++
C#软件
汇编和破解
驱动开发
技术分类
讨论组翻译
视频帧串流
如何在一个网站上运行ImageStreamingServer
联系方式
固话:0371-63888850
手机:138-0381-0136
Q Q:396806883
微信:ryysoft

锐英源精品开源心得,转载请注明:“锐英源www.wisestudy.cn,孙老师作品,电话13803810136。”需要全文内容也请联系孙老师。

JPEG格式流媒体服务器

三星Galaxy SII;

其他客户(如Firefox、Chrome和VLC播放器):

流桌面图像不同的远程客户端

Introduction 介绍

Motion JPEG is a stream of JPG images over HTTP protocol and it is commonly used for many multimedia applications specially in digital cameras (IP cameras). Although there are many ways to send images as a video to any remote computer MJPEG is the preferred one since normally it does not need any client software to be installed in the remote computer!. that is because it is supported by most of the common web browsers like Firefox and Chrome but unfortunately, it is not yet supported by Internet Explorer directly (but there are some plug-ins that make it possible to work with IE).

Motion JPEG是JPG格式的流,基于HTTP协议实现,常用于许多多媒体应用,尤其是在数码相机(IP相机)。 虽然有很多方法可以把图像作为一个视频发送到任何远程计算机上,但MJPEG通常是首选,因为它不需要任何客户端软件安装在远程计算机!。因为最常见的web浏览器都支持MJPEG,所以它可行,比如Firefox和Chrome,但不幸的是,目前还不直接支持Internet Explorer(但有一些插件,可以使用IE)。

Motivation 动机

In many I needed to stream a video of my desktop, camera, or whatever to a remote computer which has no client software to see my stream... In such a case, using Motion-JPEG streams is preferred because it needs no more than an internet browser. In this article I'm not going to describe the internal structure of an MJPEG stream (for more information, please visit Motion_JPEG) instead of that I'm going to describe how to use this library for MJPEG streaming.

在很多情况下,我需要把我的桌面和相机串流视频到其他远程计算机,这些计算机上没有客户端软件能看到我流…… 在这种情况下,使用jpeg流是首选的,因为它仅需要一个网络浏览器。 在本文中我不打算描述MJPEG流的内部结构(有关更多信息,请访问 Motion_JPEG ),我将描述如何使用这个库来实现MJPEG流。

How to use this library 如何使用这个库吗

The main class in our library is ImageSreamingSever() which contains the following methods and properties: 在我们库里主类是 ImageSreamingSever(), 它包含以下方法和属性:

Methods: 方法:

void Start(): Starts the server on a specified TCP port. :启动服务器,使用指定的TCP端口。

void Stop(): Stops the server and closes any open connections. :停止服务器并关闭任何打开的连接

Properties: 属性:

ImagesSource: The images collection (IEnumerable<Image>) to be streamed to any connected client. ImagesSource :图像集合( IEnumerable <Image> ),它被串流到任何连接上的客户端。

Interval: The delay time (in milliseconds) between each sending image from the ImagesSource collection. 时间间隔 :每个发送图像之间的延迟时间(以毫秒为单位) ImagesSource 收集。

IsRunning: Is a read-only bool property indicating the status of the server. 是一个只读 bool 属性指示服务器的状态。

Clients: Returns a read-only collection of the currently connected socket of each client. 返回一个只读集合,里面是当前连接套接字的每一位客户。

Example: 例子:

In order to implement a streaming server that can send a video of your desktop screen to any connected client, you'll need only two lines of code using our ImageStreamingServer, as follow: 为了实现一个流媒体服务器,可以发送视频到你的桌面屏幕连接的任何客户端, 使用我们的 ImageStreamingServer,你只需要两行代码 如:

ImageStreamingServer server = new ImageStreamingServer(); 
server.Start(8080);

That's it !!!.. 就是这样! ! ! . .

Now if you open (for example) the chrome internet explorer and write the IP of the server followed by colon and then the port number, in our example it is something like this :如果你打开(例如)chrome浏览器internet explorer和写服务器的IP后跟冒号的端口号,在我们的示例中是这样的:

http://127.0.0.1:8080   

you will properly see a video of your computer screen in the explorer .. and same if you do this from another computer (with the correct IP of your server), you should see something like this : 你会正确地看到你的电脑屏幕上的视频浏览器. . 同样,如果你这样做从另一台计算机(使用正确的IP的服务器),您应该看到是这样的:

谷歌浏览器

Implementing your own ImagesSource  实现自己的ImagesSource

Actually I've chosen IEnumerable<Image> as a source of images because of the flexibility that this interface is providing, for example the default ImagesSource property of the class ImageStreamingServer is an IEnumerable<Image> of the desktop screen, but at the same time you are free to implement any other type of image source you like by changing the value of that property.

其实我选择 IEnumerable<Image> 做为图像源,因为这个接口提供的灵活性,例如ImageStreamingServer类的默认 ImagesSource属性是一个 桌面的屏幕的IEnumerable<Image> ,但同时您可以通过改变这个属性的值,自由实现任何其他你喜欢的类型图像来源。

Suppose you want to make the images source from the camera or from the images file of any folder in your computer, then your code should be something like this: 假设你想让来自摄像机的图像源,图像文件的文件夹为源,那么您的代码应该是这样的:

IEnumerable<Image> CameraImagesSource() 
     { 
     // Your code must be here 
     }  
     IEnumerable<Image> FolderImagesSource(string path) 
     { 
     // Your code must be here 
     }

As a real example, let's implement a source of images that streams all "*.jpg" photos from a specified folder path as follows:作为一个实际的例子,让我们实现从一个指定的文件夹路径为图像流的来源 “* . jpg” ,代码如下:

 private IEnumerable<Image> FolderImagesSource(string path)
     {
     var files = System.IO.Directory.GetFiles(path, "*.jpg"); 
      foreach (var file in files)
     yield return Image.FromFile(file);
      yield break;
     } 
     private void Form1_Load(object sender, EventArgs e)
     {
     var source = FolderImagesSource(@"C:\Pictures\");

_Server = new ImageStreamingServer(); _Server.ImagesSource = source; _Server.Start(8080); }

Note: the above code can be shortened as follows (thanks for IEnumerable extensions and LINQ): 注意:上面的代码可以缩短如下(谢谢IEnumerable扩展和LINQ):

var source = System.IO.Directory.GetFiles(@"C:\Pictures\", "*.jpg").Select(s => Image.FromFile(s));
   _Server = new ImageStreamingServer(source);
     _Server.Start(8080);

Supported client software 支持客户端软件

To see the streaming video of our server, you will need to use any software that supports Motion-JPEG streaming such as a Mozilla Firefox, Google's Chrome or VideoLAN Player (VLC) :看到我们的视频服务器,您将需要使用任何软件支持jpeg流等 Mozilla Firefox , 谷歌的Chrome 或 VideoLAN播放器 (VLC):

对于Windows PC免费的客户端软件

And finally for your mobile (android) use FireFox or any other free app that can be found on Google's market such as tinyCamMonitor (that was used in the picture below): 最后为您的移动(android)使用FireFox或者其他免费的应用程序,可以在谷歌上找到的市场等 tinyCamMonitor (这是用于下图):

Samsung Galaxy SII

友情链接
版权所有 Copyright(c)2004-2021 锐英源软件
公司注册号:410105000449586 豫ICP备08007559号 最佳分辨率 1024*768
地址:郑州大学北校区院(文化路97号院)内