Mjpg-streamer Learning Note 1----mjpg-streamer transplant

Source: Internet
Author: User
Tags naming convention

1. What is Mjpg-streamer

Mjpg-streamer is a free IP address-based video streaming server, its input plug-in from the camera to read video data, the input plug-in to generate video data and copy video data into memory, it has multiple output plug-ins to the video data processing, One of the most important output plug-ins is the Web server plug-in, which transmits video data to the user's browser, and Mjpg-streamer's job is to bind one of the input plug-ins and multiple output plugins together, all of which are done through its various plugins.

The individual files are as follows:

(1) input_testpicture.so. This is an image test plug-in that compiles a pre-set image into a header file that transmits images without a camera, making it easy to debug a program.

(2) input_uvc.so. This file calls the USB camera driver v4l2, which reads video data from the camera.

(3) input_control.so. This file implements the control interface for camera rotation.

(4) output_http.so. This is a full-featured Web server that not only handles files from a single folder, but also executes commands that can process an image from the input plug-in, or output the video file of the input plug-in as an HTTP video data service stream based on the existing M-jpeg standard.

(5) output_file.so. The function of this plugin is to store the JPEG image of the input plug-in into a specific folder, which can be used to fetch images.

2, how to transplant Mjpg-streamer to the Development Board

(1) libjpeg migration (because Mjpg-streamer relies on the JPEG library)

Unzip the Libjpeg library

Tar xzvf libjpeg-turbo-1.2.1.tar.gz

Switch to the Libjpeg library directory

CD libjpeg-turbo-1.2.1

Build directory tmp

mkdir tmp

Meaning of the./configure--host=arm-linux--prefix=$ (pwd)/_install

$./configure The following two are all parameters given when running configure

--host=arm-linux Operating Environment (cross-compiling into arm)

--prefix=$ (PWD)/_install installation directory

PWD is the current user directory.

To configure the--prefix= is to specify the installation directory/work/nfs_root/libpeg-turbo-1.2.1/tmp,--Host=arm-linux is the specified operating environment is arm./configure--prefix=/ Work/nfs_root/libjpeg-turbo-1.2.1/tmp--host=arm-linux

Compile

Make

Installation

Make install

Copy the dynamic library under the/work/nfs_root/libjpeg-turbo-1.2.1/tmp/lib/directory to the/work/nfs_root/fs_mini_mdev_new/lib/directory (- D indicates that the original link file was also copied over as a linked file) cp/work/nfs_root/libjpeg-turbo-1.2.1/tmp/lib/*so*/work/nfs_root/fs_mini_mdev_new/lib/-D


(2) Transplantation of Mjpg-streamer:

Extract

Tar xvf mjpg-streamer-r63.tar.gz

Switch to the MJPG-STREAMER-R63 directory under CD mjpg-streamer-r63


Modify all the Makefile

ARM-LINUX-GCC is a cross-compilation toolchain that compiles programs that run on an arm platform, and GCC-compiled programs run on the x86 platform
--(1) Change CC=GCC to CC=ARM-LINUX-GCC

--(2) Modify Plugins/input_uvc/makfile

-o2 is an optimization option,-dlinux-d_gnu_source,-wall means to open all warning messages that need attention,-shared specify to generate a dynamic connection library,-fpic to compile to a location-independent code,

-i/work/nfs_root/libjpeg-turbo-1.2.1/tmp/include indicates that the required header file is specified
A. The
CFLAGS + =-o2-dlinux-d_gnu_source-wall-shared-fpic
Switch
CFLAGS + =-o2-dlinux-d_gnu_source-wall-shared-fpic-i/work/nfs_root/libjpeg-turbo-1.2.1/tmp/include
Attention:
-i/work/jz2440/libjpeg-turbo-1.2.1/tmp/include//is a compiled libjpeg generated file

O: Compiled target file
A: Static library, in fact, is to put a number of O files in a package so
: Dynamic link library (shared library)
lo: Using Libtool to compile the target file, is actually in the O file added some information
LA: A library file compiled with Libtool is actually a text file that records information about a dynamic library and a static library with the same name.

$@--the target file, $^--all dependent files, $<--the first dependent file.

-L.: Indicates the library to be connected in the current directory

-ltest: The compiler has an implicit naming convention when looking for dynamic connection libraries, which is to precede the given name with Lib, followed by. So to determine the name of the library, which is libtest.so
B. The
Input_uvc.so: $ (other_headers) input_uvc.c V4l2uvc.lo Jpeg_utils.lo Dynctrl.lo
$ (CC) $ (CFLAGS)-ljpeg-o $@ input_uvc.c V4l2uvc.lo
Jpeg_utils.lo Dynctrl.lo
Switch
Input_uvc.so: $ (other_headers) input_uvc.c V4l2uvc.lo Jpeg_utils.lo Dynctrl.lo
$ (CC) $ (CFLAGS)-ljpeg-l/work/jz2440/libjpeg-turbo-1.2.1/tmp/lib-o
$@ input_uvc.c V4l2uvc.lo J Peg_utils.lo Dynctrl.lo
Compile

Make

Copy the dynamic library file under the mjpg_streamer/work/nfs_root/fs_mini_mdev_new/bin/directory to the/work/nfs_root/fs_mini_mdev_new/lib/directory CP mjpg_ streamer/work/nfs_root/fs_mini_mdev_new/bin/

CP *so*/work/nfs_root/fs_mini_mdev_new/lib/-D

Mjpg_streamer-i "Input_uvc.so-f 10-r 320*240"-o "output_http.so-w www"

3. Command Parameters

This is the parameters I set: input UVC, web output, image output (more detailed settings, suggest to see the source)

Mjpg_streamer-i "Input_uvc.so-f 10-r 320*240-y"-O "output_http.so-c" Ruoyun:liufeng "-W www-p 8888"-O "output_file . so-d 1000-f/mnt "

-I. Input

"Input_uvc.so-f 10-r 320*240-y"

Input_uvc.so:UVC Input Components

-F 10: represents 10 Frames

-R 320*240: Resolution

-Y:YUV format input (with lag), no indication of mjpg input (requires webcam support)


-O Output

"Output_http.so-c" Ruoyun:liufeng "-W www-p 8888"

Output_http.so: Web Output component

-C "Ruoyun:liufeng": User name: Ruoyun Password: Liufeng

-W www: web output

-P 8888: Port 8888


"Output_file.so-d 1000-f/mnt"

output_file.so: Picture Output component

-D 1000: Time 1S

-f/mnt: Where to put the output picture, I am the boot directly to the/MNU mounted to the local folder

4. Use

Enter Http://192.168.1.1:8080/?action=stream in the Firefox browser, you should be able to see the video captured by the camera.

Dynamic Video: 192.168.1.1:8080/?action=stream
Still Image: 192.168.1.1:8080/?action=snapshot

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.