post score 0 times, average 0.0

One, Mjpg-streamer open source library

Due to the development of a real-time video push system, it may involve the implementation of a streaming media server, but it can be realized quickly and easily through the "MJPG-streamer" open source tool."MJPG-streamer" is a mature, lightweight video server software that can be used to capture camera images and publish them on real-time video servers.MJPG-streamer adopts the modularized design idea, including input module and output module. The input module defines the input source, such as camera, file, etc. MJPG-streamer then outputs the video through the output module, such as http output and other network output. Local output of the file [8]. This article uses a binocular camera supporting UVC protocol as the input source of image data. The http protocol is used to push the video stream. Therefore, the components involved are the output_http output component and the input_uvc input component.With MJPG-streamer, it is easy to push the binocular camera video on the pcDuino to the http protocol.

Second, to achieve and test

The use of MJPG-streamer library to develop a real-time image transmission system is convenient and efficient. Its installation command is as follows:

After the installation is complete, you can use the command:

After mjpg_streamer is installed, it can be started as a system service and input/output parameters can be configured to work normally.The following command is involved in the above command: -i "input_uvc.so -d /dev/video0 -y -r 1280x480 -f 10" part is the input parameter,

  • So means use input_uvc.so as input module
  • -d /dev/video0 Defines the device path of the accessed camera as /dev/video0.
  • -r 1280x480 defines the resolution of the camera as 1280x480
  • -f defines the frame rate of live video as 10 frames per second
  • -y Indicates that the YUV mode of mjpg_streamer is enabled.Since the video data format handled by mjpg_streamer is MJPEG, the camera used in this design is the YUV format. The YUV mode of mjpg_streamer is enabled for compatibility with the video stream format of the camera.

The -o "output_http.so -p 8090 -w /var/www/mjpg_streamer" section is the output parameter,

  • So means use output_http.so as output module
  • -p defines the http output port as 8090
  • -w defines the root directory of the http service

[5] Real-time image transmission of binocular camera - Smart car under Pcduino platform

After starting in the command line, it is as follows: After the mjpg_streamer video server is started, the smart car's IP and service port tests can be entered in the Chrome browser.Mjpg_streamer default video port is 8090, of course, can also be set in the startup parameters. Assume that the smart car IP is 192.168.137.2. You can visit http://192.168.137.2:8090/?action=stream to access the dynamic video stream. Visit http://192.168.137.2:8090/?action=snapshot to access the static Take a picture. When the browser accesses the above URL, the page source code actually rendered by the browser is: <img src=”http://192.168.137.2:8090/?action=snapshot ”/> <img src=”http: //192.168.137.2:8090/?action=stream”/> In other words, the browser uses the img image tag to display the binocular camera video. It is worth noting that even when the action parameter is a stream, the img tag can continue Dynamically pulling and displaying video streams from and to the server is an interesting phenomenon: Of course, using the img tag to display live video streams is not supported in all browsers, such as IE. In order to study the video stream display problem with the img tag, the HTTP debugger "review element" can be used to analyze the HTTP request: As shown in the figure above, according to the response header of this HTTP request, its file extension Content-Type (Mime) can be known. -Type) is multipart/x-mixed-replace. In the HTTP hypertext protocol, the response message of the HTTP request is composed of a status line, a message header, and a body [10]. The message header is descriptive information describing the response data, including server information, status codes, cache control policies, and the like. The Content-Type (Mime-Type) included therein is for informing the browser of the data format and type of the currently transmitted data. When the web server responds to the client's HTTP request, the returned data is encapsulated using the MIME message format.In general, an HTTP response can only contain one data block. However, MIME has a special MIME type: "multipart/mixed". This MIME type can use an HTTP response data block to represent multiple data blocks.Among them, the multipart/x-mixed-replace MIME type is one of "multipart/mixed", where "replace" indicates that each new data block will replace the previous data block, which tells the browser that this type of new data block Instead of appending to old data blocks, it replaces it [15].In this article, the browser shows the video stream in the img tag. This means that video frames are constantly being refreshed, resulting in a coherent video.

 

本文已在版权印备案,受著作权法律保护,未经允许不得转载!如需转载请联系作者或访问版权印获取授权,如果你觉得这篇文章对你有用,可以点击下面的“赞助作者”打赏作者!

转载注明原文出处:Baiyuan's Blog>>http://wangbaiyuan.cn/en/5-of-binocular-camera-pcduino-real-time-image-transmission-platform-of-smart-car-2.html

Post comment

Style

No Comment

登录

Forget password?

您也可以使用第三方帐号快捷登录

切换登录

注册

TW