Mjpg-streamer and using---fwqlzz love are for ever

Source: Internet
Author: User
Tags mkdir svn

Porting and building the embedded Network Camera Mjpg-streamer on the Zedboard. The steps are as follows:

From: http://blog.csdn.net/xzyiverson/article/details/13741451

1. Installing the Libtool tool

1.1 Download Libtool Tools libtool-2.2.10.tar.gzhttp://mirrors.ustc.edu.cn/gnu/libtool/

1.2 Tar-xvzf libtool-2.2.10.tar.gz-c/home/xzy/sdb1/jpeg/

1.3 Enter the extracted directory and execute the./configure

1.4 Make

1.5 Make Install


2.JPEG code library porting

2.1 Download JPEG source package, select Jpegsrc.v6b.tar.gz http://www.ijg.org/files/

2.2 Unzip the tar jpegsrc.v6b.tar.gz -c/home/xzy/sdb1/jpeg/

2.3 Enter the extracted directory and copy the Libltdl/config/config.sub and config.guess from the libtool-2.2.10 directory to this directory.

2.4 configuration./configure CC=ARM-XILINX-LINUX-GNUEABI-GCC--host=arm-unknown-linux

–prefix=/home/xzy/sdb1/jpeg/jpeg-6b --enable-shared--enable-static

2.5 Make

2.6 go to the installation path and create the following directory MkDir bin Lib include man Man/man1, my installation directory is in this directory, note that you have to create these directories, or else make install (tried. )

2.7 make install, and then it's OK.


3.mjpg-streamer Transplant

3.1 Download Source http://sourceforge.net/projects/mjpg-streamer/files/mjpg-streamer/Sourcecode/

3.2 Decompression Tar-xvzf mjpg-streamer-r63.tar.gz-c /home/xzy/sdb1/jpeg/


3.3 Enter the extracted directory, modify the./PLUGINS/INPUT_UVC directory under the makefile file

Change 1: Change CFLAGS + =-o2-dlinux-d_gnu_source-wall-shared-fpic to CFLAGS + =-o2-dlinux-d_gnu_source-wall-shared -fpic-i /home/xzy/sdb1/jpeg/jpeg-6b/include
Revision 2: Change $ (CC) $ (CFLAGS)-ljpeg-o $@ input_uvc.c V4l2uvc.lo jpeg_utils.lo Dynctrl.lo to $ (cc) $ (CFLAGS)-ljpeg–l/home/x zy/sdb1/jpeg/jpeg-6b/lib-o $@ input_uvc.c v4l2uvc.lo jpeg_utils.lo Dynctrl.lo
3.4 Compiling make CC=ARM-XILINX-LINUX-GNUEABI-GCC, error


The linux/videodev.h was not found because the 2.6.38 kernel removed support for v411, and the new header file was linux/videodev2.h

Modify Mjpg-streamer-r63/plugins/input_uvc/v4l2uvc.h

Modify mjpg-streamer-r63/plugins/input_uvc/uvcvideo.h

Modify mjpg-streamer-r63/plugins/input_uvc/input_uvc.c

Modify mjpg-streamer-r63/mjpg_streamer.c

Modify MJPG-STREAMER-R63/PLUGINS/OUTPUT_FILE/OUTPUT_FILE.C

Modify MJPG-STREAMER-R63/PLUGINS/OUTPUT_HTTP/OUTPUT_HTTP.C

Modify MJPG-STREAMER-R63/PLUGINS/INPUT_TESTPICTURE/INPUT_TESTPICTURE.C

Modify MJPG-STREAMER-R63/PLUGINS/OUTPUT_AUTOFOCUS/OUTPUT_AUTOFOCUS.C

Modify Mjpg-streamer-r63/plugins/input_gspcav1/spcav4l.h

Modify the makefile file under the Mjpg-streamer-r63 directory, will $ (CC) $ (CFLAGS) $ (lflags) $ (OBJECTS)-O $ (app_binary) to $ (cc) $ (CFLAGS) $ (OBJECTS) $ (lflags)-O $ (app_binary)

execute make CC=ARM-XILINX-LINUX-GNUEABI-GCC in the mjpg-streamer-r63/directory

Compile or error, as shown below, but some LIB files have been generated, the cause of the specific error needs to be identified.


LS to look at:


Copy out the mjpg_streamer,output_http.so,input_uvc.so we need, some libraries that have been libjpg, have the following



4 Testing

Start the demo system, copy those lib to/usr/lib below, mkdir/www/camwww this directory, plug the network cable and USB camera.

Run./mjpg_streamer-i "/USR/LIB/INPUT_UVC.SO-YUV"-o "/usr/lib/output_http.so-p 8080-w/www/camwww"

There must be-YUV on my camera, or I'll get an error.

_http.so-p 8080-w/www/camwww "
Mjpg-streamer [726]: Starting Application
MJPG streamer Version.: 2.0
Mjpg-streamer [726]: MJPG streamer Version.: 2.0

I:using v4l2 device.:/dev/video0
Mjpg-streamer [726]: Using v4l2 device.:/dev/video0

i:desired resolution:640 x 480
Mjpg-streamer [726]: desired resolution:640 x 480

I:frames Per Second.: 5
Mjpg-streamer [726]: Frames Per Second.: 5

I:format ...: MJPEG...
Mjpg-streamer [726]: Format ......: MJPEG

Unable to set format:invalid argument
Init V4L2 failed!! Exit fatal
I:init_videoin failed
Mjpg-streamer [726]: Init_videoin failed


Also need to note is: It is best to directly put the camera on the USB-OTG, I plugged in no external power hub can not be successful, or error unable to start capture:no space leave on device (insufficient equipment)

I:error grabbing frames





Mjpg‐streamer is an open source software for capturing images from webcam cameras, streaming them over an IP-based network to a browser such as a FIREFOX,CAMBOZOLA,VLC player, Windows Mobile devices or other mobile devices that have browsers; there is a lot of information about it on the Internet, readers can understand it, and there are many porting on the internet, and some problems and solutions are given in the process of porting and compiling.
Libjpeg must be transplanted before Mjpg-streamer is transplanted, because the following sentence is in the Readme file under the Mjpg-streamer source package:
* The input plugin "input_uvc.so" depends on libjpeg, make sure it is installed.
The journey to begin the transplant below
First, the environment
Host Environment: Fedora 15
Target machine: Friendly arm Company's mini2440 Development Board
Main tool chain: gcc-4.6.3
Cross tool chain: arm-none-linux-gnueabi-gcc-4.5.2 (because the name is too long to write the time, with a soft connection "ARM-LINUX-GCC" point to it)
Second, the transplant process
First step porting of JPEG libraries
1, download JPEG source package from http://www.ijg.org/files/;
2, unzip, enter its directory,
cd/home/wu/jpeg-6b
3, configure the source code, (Specific configuration items can run commands.)/configure--help See what it means, change according to the actual situation)

./CONFIGURECC=ARM-LINUX-GCC--host=arm-unknown-linux--prefix=/home/wu/jpeg-6b/jpeg--enable-shared-- Enable-static
Where/home/wu/jpeg-6b/jpeg is the compiled post-installation directory, modified according to the actual situation
4. Compiling: Make
5. Installation: Make install
6, copy the library file to the Development Board file system
Copy all files under the/home/wu/jpeg-6b/jpeg/lib/directory to the Development Board file system/nfs/rootfs/usr/local/mjpg-streamer (this directory is mjpg-streamer in the installation directory of the Development Board, Of course you can also put it in the/lib/directory of the Development Board)


Step two, transplant Mjpg-streamer
1, download the source code, in the https://sourceforge.net/projects/mjpg-streamer/download source (mjpg-streamer-r63) a bit old, the latest version using the following command to download,
SVN Cohttps://mjpg-streamer.svn.sourceforge.net/svnroot/mjpg-streamermjpg-streamer
2. Enter its catalogue
cd/home/wu/mjpg-streamer/mjpg-streamer/
3. Modify the source code
Modify Plugins/input_uvc/makfile,
Modify
CFLAGS =-o2-dlinux-d_gnu_source-wall-shared-fpic
For
CFLAGS =-o2-dlinux-d_gnu_source-wall-shared-fpic-i/home/wu/jpeg-6b/jpeg/include

Modify
$ (CC) $ (CFLAGS)-ljpeg-o $ @input_uvc. C V4l2uvc.lo Jpeg_utils.lo Dynctrl.lo
For
$ (CC) $ (CFLAGS)-ljpeg-l/home/wu/jpeg-6b/jpeg/lib-o $@ input_uvc.c v4l2uvc.lo jpeg_utils.lo Dynctrl.lo
Note:/home/wu/jpeg-6b/jpeg is the directory installed after porting the JPEG library
4. Compiling: MAKECC=ARM-LINUX-GCC
5. Set up the Mjpg-streamer installation directory in the Development Board
Mkdir/nfs/rootfs/usr/local/mjpg-streamer
CP *.so/nfs/rootfs/usr/local/mjpg-streamer
CP Mjpg-stream/nfs/rootfs/usr/local/mjpg-streamer
Copy the start.sh and directory www from the source directory to the/nfs/rootfs/mjpg-streamer directory, and then you can test it.
6. Test:
Modify the start.sh file, and then run start.sh; open a webpage on the PC and enter Http://192.168.1.1:8080/?action=stream to see the image.
7. Get Help
The way to get help in start.sh is described in the following example, run./mjpg_streamer--help It will print out the following help to set parameters as needed
The following parameters can bepassed to this plugin:
[-D |--device] ...: Video device to open (your camera)
[-r |--resolution] ...: The resolution of the video device,
Can be one of the following strings

Qsif QCIF CGA QVGA CIF VGA
SVGA XGA SXGA
Or a custom value like the following
example:640x480
[-f |--fps] ....: Frames per second
[-y |--yuv] ....: Enable YUYV format and disable MJPEG mode
[-Q |--quality] ...: JPEG compression quality in percent
(Activates YUYV format, disables MJPEG)
[-M |--minimum_size].: Drop frames Smaller then this limit,useful
If the webcam produces small-sized garbage frames
May happen under low light conditions
[-n |--no_dynctrl] ...: Do not initalize dynctrls of LINUX-UVC driver
[-l |--led] ...: Switch the LED "on", "off", Let It "blink" orleave
It up to the driver using the value "Auto"

The above is the whole process of the transplant of Mjpg-streamer, the following is the possible errors and solutions in this process.
1. Error when compiling mjpg-stream-mini2440-read-only
[root@wumjpg-streamer-mini2440-read-only]# MAKECC=ARM-LINUX-GCC
Arm-linux-gcc-o3-dlinux-d_gnu_source-wall-c-OMJPG_STREAMER.O mjpg_streamer.c
Mjpg_streamer.c:27:28:fatalerror:linux/videodev.h:no such file or directory
Compilation terminated.

Make: [MJPG_STREAMER.O] Error 1
[root@wumjpg-streamer-mini2440-read-only]#
Reason: This is because the kernel 2.6.38 and later versions have been removed from the V4L1 's support, this thing may be more old. The new header file is Video4linux2.h, and many interfaces change compared to V4L1
Workaround: You can select a previous low version of the kernel, or with a new version of Mjpg-streamer, the download address is described when you start porting Mjpg-streamer.

2, when the compilation is successful, run with excitement, the following error is suddenly printed when
Mjpg-streamer [703]: startingapplication
MJPG Streamer VERSION:SVN Rev : 3:154m
Mjpg-streamer [703]: MJPG streamerversion:svn rev:3:154m
.....
inconsistencydetected by ld.so:dl-deps.c:622: _dl_map_object_deps:assertion ' nlist > 1 ' failed!
.......
or the following error when
Vcioc_ctrl_map-error:invalidargument
Mapping control for led1frequency
Uvcioc_ctrl_map- Error:invalidargument
Mapping control for Disable videoprocessing
Uvcioc_ctrl_map-error:invalidargument
Mapping control for Raw bits perpixel

Uvcioc_ctrl_map-error:invalidargument
O:www-folder-path ...:/www/
O:http TCPport ...: 8080
O:username:password.: Disabled
O:commands .....: Enabled
Wrong JPEG libraryversion:library is caller expects 80
Cause: This is caused by the JPEG library file version does not correspond, now run using 80, but it actually needs 62 version, the high version of the JPEG library and the low version Mjpg-streamer conflict.
Workaround: Go to download the 62 version of the JPEG library file and compile the JPEG and Mjpeg-streamer once again from the beginning.

3. Use the camera to appear the following information
....................
Init v4l2failed!! Exit fatal
Init_videoinfailed
....................
Reason: Most of the cameras in the market are supported by YUV, not jpeg.
Workaround: Since Mjpg-stream supports JPEG and YUV two formats, simply modify the start.sh to include "-y" in the input
If it turns out to be./mjpg_streamer-i "./input_uvc.so"-o "./output_http.so-w./www", replace
./mjpg_streamer-i "./input_uvc.so-y"-o "./output_http.so-w./www".

Summary: After a round of Google + Baidu finally can be seen in Firefox video camera capture image, but there are still some unsatisfactory is in the PC to achieve 640x320, but even the mini2440 is not smooth, there is a trailing phenomenon (reduce the sample rate effect is not obvious), Lower the screen is a bit "unsightly", but also need to improve.


First, obtain the source code and compile

$sudo apt-get Install Libjpeg-dev subversion ImageMagick
$ svn Checkout Svn://svn.code.sf.net/p/mjpg-streamer/code/mjpg-streamer-code
$ CD Mjpg-streamer/mjpg-streamer
$ make clean all


Second, the operation

$ export ld_library_path=.
$./mjpg_streamer-i "input_uvc.so"-O "output_http.so-w./www"
To view the video, enter the address in your Web page: http://127.0.0.1:8080


Third, installation

If you need to install the app, execute the following command:
sudo make destdir=/usr install


Four, the resolution can be used

YUV2
1600x1200 5 fps
960x720 fps
800x600 fps
640x480 fps
352x288 fps
Max fps
176x144 fps
160x120 fps
MJPG
960x720 fps
800x600-fps
640x480 fps
352x288 fps
Max fps
176x144 fps
160x120 fps
Example one:
$./mjpg_streamer-i "Input_uvc.so-d/dev/video0-y-R 1600x1200"-O "output_http.so-w./www"
Example two:
$./mjpg_streamer-i "input_uvc.so-d/dev/video0-f 15-r 960x720"-O "output_http.so-w./www"


V. Create a startup script

#!/bin/bash
resolution= "960x720"
Framerate= "15"
mjpg_web_root= "/home/philipp/downloads/mjpg-streamer/mjpg-streamer/www"
Port= "8081"

Mjpg_streamer-i "input_uvc.so-d/dev/video0-f $FRAME _rate-r $RESOLUTION"-o "output_http.so-w $MJPG _web_root-p $PORT "


Vi. Other

1.HTTP Certification

$./mjpg_streamer-i "input_uvc.so-d/dev/video1-f 15-r 800x600"-O "output_http.so-w./www-c username:s3cure-passw0r D

2.mplayer Playback

$ mplayer-fps 30-demuxer lavf "Http://127.0.0.1:8080/?action=stream&ignored.mjpg"


Ubuntu Linux Compilation Run Mjpg-streamer steps: http://www.linuxdiyf.com/linux/7742.html

Ubuntu under Mjpg-streamer Installation:

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.