mjpg-streamer 这个软件背景
About the project
- "MJPG-streamer", is a command line application to stream JPEG files over an IP-based network from the webcam to a viewer like Firefox, Cambozola, VLC, a Windows Mobile device or mobilephone that has a webbrowser. It can make use of hardware compression of certain webcams, in order to reduce CPU cycles of the server. This makes it a light and less CPU hungry solution for embedded devices and regular servers, that should not spend most of their computing power for compressing videoframes. For example it consumes less then 10% CPU on a 200 MHz router hardware when streaming a 960x720 pixel video.
MJPG-streamer,是一个命令行应用程序,从摄像头采集数据,然后通过网络将JPEG流文件传输到视频播放设备,比如:火狐浏览器,摄像头播发器,视频线路连接器,手机设备等等。
MJPG-streamer,可以使用硬件受限制的摄像头上,减少了CPU的开销。这样产生了一个更轻更消耗少的嵌入式设备。这样,就不需要为 处理视频帧 消耗大量的电耗。比如说,它减少了CPU 10%的电耗,在主频200Mhz的,960*720分辨率的一个设备上。
About the name
- Other appropriate names would also be MJPEG-streamer or M-JPEG-streamer, the decision was done at an early project state and we just keep it.
What it does 怎样工作?工作原理
- here is a source for images, the input-plugin. This input-plugin produces images and copies it to the memory. There are (several) output-plugins that take those images and do something with the images. Most popular is the webserver-output-plugin, it allows to transport the images to a viewers webbrowser. MJPG-streamer job is to glue together the single input and multiple out plugins, nearly all the important stuff is done by the plugins.
Plugins
Input-Plugins
- Common to all Input-Plugins is, that they copy JPEG images to a global accessible memory and signal this to waiting processes.
- input_testpicture.so
-
- This input-plugin has compiled in images and can be used without a webcam. If you want to write your own input-plugin, this is the best to start with, because it is as simply as possible. It converts the testpictures from JPEG-files to a header file. The header files, containing the images ins compiled into the input-plugin. Once activated, the plugin simply serves those compiled-in-images in a loop.
- input_uvc.so
-
- This input-plugin grabs images from a Linux-UVC V4L2 compatible device, like a Logitech Quickcam Sphere AF or Logitech QC Pro 5000. The source code for this plugin is based on "luvcview" and was changed in many ways. In contrast to "luvcview" it initializes the new Logitech commands for pan/tilt/focus without the need for a helper library or fiddling with XML files, udev rules etc. It is right now the most exiting input plugin, because you can stream up to 960x720 pixel large images from your webcam at a high frame rate (>= 15 fps) without a mentionable CPU load. If you do not care for CPU load, it can even grab 1600x1200 large uncompressed images, compress them in software and stream them to clients.
- input_control.so
-
- This input-plugin only implements the pan/tilt control interface, leaving the video stream available for other applications. I use this to provide a web interface for others to control the pan/tilt of my Logitech Orbit AF while Skype does the audio and video stream. This works great at work where we have remote co-workers attend meetings via skype. They get to control the camera during the meeting.
Output-Plugins
- output_http.so
-
- This plugin is a fully functional HTTP 1.0 webserver. It can serve files from a single folder and it can execute certain commands. For example it can serve a single JPEG file of the input plugin, or stream them according to existing M-JPEG standards. By serving files from a folder, it enables you to design your own webpage, that embeds the webcam images and streams. A working and stylish example for such a webpage is part of the MJPG-streamer package. Multiple instances of this plugin can be started in parallel, so the server-threads can operate with different passwords and layouts or command-restrictions.
- output_file.so
-
- This plugin is used to store JPEG images of the input plugin in a specified folder. It can be used to grab images and just store them, or to forward them to a FTP account by executing a command after storing the picture. More documentation is available at the page output_file.