Successfully transplanted on mini2440 ffmpeg----fwqlzz love are for ever

Source: Internet
Author: User

On mini2440, the whole transplant process is divided into three steps: (1) compiling x264, (2) compiling FFmpeg, and (3) after the transplant is successful, the test is to use ffmpeg recording.

(1) Compiling x264

The official web site under a new x264, address http://www.videolan.org/developers/x264.html. The file I downloaded is last_x264.tar.bz2.

120 version Address

Http://pan.baidu.com/s/1jG81TSq

The decompression command is #tar-jxv-f last_x264.tar.bz2, and the extracted directory is x264-snapshot-20130313-2245.

Enter the extracted directory and execute the command./configure--disable-asm, the Config.mak is generated. After that, you need to modify this Config.mak file, rewrite arch=arm sys=linux cc=arm-linux-gcc, where CC is written in your own cross-compilation environment location, the corresponding AR, Ranlib is also, specifically as shown.

(Note: If you do not make the modifications shown below, the x86 264 environment is compiled

http://blog.csdn.net/to_cm/article/details/7108986

I remember that line 10th and 11th seem to have deleted the-M32 option, and if you do it later, you can do it without any errors.

Then execute make

The make install is executed again, so the x264 has been compiled successfully. In the/usr/local/include/directory there will be a x264.h header file, in the/usr/local/lib/directory there will be a libx264.a library file.

(2) Compiling ffmpeg

Official website Download ffmpeg 0.8.14, address: http://ffmpeg.org/download.html, after decompression tar XZVF

Version 1.0

Http://pan.baidu.com/s/1nt8vNfz

Configuration compilation
(2.1) for x86
#./configure--prefix=/usr/local/ffmpeg/

It will be lazy to yasm some modules, you can download yasm-1.2.0.tar.gz,

Http://pan.baidu.com/s/1hqmlu7q

Unzip directly after the./configure make and make install

(2.2) for ARM

Execute the following command:

./configure--cross-prefix=arm-linux---enable-cross-compile--target-os=linux--cc=arm-linux-gcc--arch=arm-- Prefix=/usr/local/arm_ffmpeg--enable-shared--disable-static--ENABLE-GPL--enable-nonfree--enable-ffmpeg-- Disable-ffplay--enable-ffserver--enable-swscale--enable-pthreads--disable-armv5te--disable-armv6-- Disable-armv6t2--disable-yasm--disable-stripping
There is no use of ffplay, you need to add yourself, reference http://blog.csdn.net/liaozc/article/details/6025610 said to use the SDL library, you can try. Modify the--CC--prefix according to your own directory, then make and do install, and then find the Lib include folder you want to use under--prefix.

Note: "1" After this very long configure command executes, there will be a warning warning, said to find a arm-linux-ptkconfig, what faile such information. I'm not, probably, a warning message, and this can be done without it. I have changed several files, the above steps, will appear this warning, here wasted a lot of time.

"2" It takes a long time to perform the make process, which requires patience.
After "3" executes the make install, a FFmpeg folder is generated under/usr/local/, as shown in.

(3) After the successful transplant, the test, that is, the use of ffmpeg video

Note: Because my mini2440 Development board is not enough space, I am using NFS to launch the Development Board, if the space is enough, directly put the library files on the board is the same.

Copy the library files with the suffix named. So and. so.* under the/usr/local/ffmpeg/lib file to the Development Board (if a library is missing, execute it later./ffmpeg will error, said can not find)

The red box is just a subset of the library files, they are all paired up, but the suffix name is different.

Because there is no ffmpeg this command in the board, you need to copy the FFMP executable file from the/usr/local/ffmpeg/bin/directory to the Development Board, and then increase its executable permissions (chmod +x ffmpeg)

Then execute the command: #./ffmpeg-f video4linux2-s 320x240-i/dev/video0/mnt/test.avi, execute the procedure as shown:

This recording process input q, you can stop the recording. The generated Test.avi file is in the/mnt/directory. We can watch it with a regular player.

FFmpeg Compiling x86 environment

./configure--target-os=linux--cc=gcc--prefix=/usr/local/ffmpeg--enable-shared--disable-static--ENABLE-GPL-- Enable-nonfree--enable-ffmpeg--disable-ffplay--enable-ffserver--enable-swscale--enable-pthreads-- Disable-armv5te--disable-armv6--disable-armv6t2--disable-yasm--disable-stripping




MINI2440-based camera monitoring on the Internet is generally based on Mjpeg-streamer.

This approach leverages the underlying driver of the V4L2, and then works with streaming MJPEG this format, and then browses the video and controls through the browser.

The following is implemented with a scheme that is closer to the real ip-camera.

First look at the Netizen Sunkwei wrote "Webcam application based on V4L2, local pre-supervisor"

http://blog.csdn.net/sunkwei/article/details/6530343

The text copied his code, just to cross-compile his webcam_server to arm, Webcam_shower compiled to the PC.

This scheme is used V4L2 video driver, and then with FFmpeg, x264 software codec, through UDP upload to the PC display, video codec really very troublesome, fortunately there are many open source codec library can be used, hundreds of lines of code can achieve the stream encoding and transmission of H.

USB camera to get the data format is generally YUV422, if using a CMOS camera may be raw raw data format, YUV422, is on the raw based on color extraction point encoding, because the human eye on brightness sensitivity is greater than the sensitivity of the color, so not all color coding, Such data volume will be very large, video codec format is not discussed, many very complex, of course, you will, will not feel difficult.

The role of FFmpeg and x264 is to encode the YUV422 into H.


Look at the results, this is the graph that is connected to Linux, the window shows the video uploaded from the 2440USB camera


It's a real picture, a phone shot.



Less nonsense, a step-by-step realization.

1. Platform

Hardware: Arm MINI2440,USB camera

Software: FEDORA14,ARM-LINUX-GCC v4.4.3

2. Source Files

Ffmpeg-0.10.1.tar.gz

last_x264.tar.bz2

Zlib-1.2.5.tar.gz (There is no libz.so in mini2440, but the library support is required to run the program, so download the source file cross-compile)

The above files can be found by anyone who searches.

Finally,

Netizen Sunkwei wrote the webcam application,:

http://download.csdn.net/detail/sunkwei/3425209


The following start cross-compiling, the compilation process will encounter a few small problems, to solve

1. Compiling zlib

Decompression zlib-1.2.5.tar.gz

#tar-XZVF zlib-1.2.5.tar.gz

Go to source file directory

#cd zlib-1.2.5

Run the Configure configuration makefile

#./configure--prefix=/opt/webcam/ffpeg

--prefix=/opt/webcam/ffpeg means that when you finally execute make install, the file is installed in/opt/webcam/ffmpeg, otherwise it will be installed by default in/usr/local/lib, in fact, this parameter is not written here, Finally, it is also possible to modify together in makefile.

Makefile will be generated in the current directory after configuration

Modify makefile to be able to compile with ARM-LINUX-GCC, in fact, change GCC to Arm-linux-gcc,ar to Arm-linux-ar, etc.

Here's the modified makefile section.

[Plain]View PlainCopy
  1. Sflags=-o3-fpic-d_largefile64_source=1
  2. ldflags=-L LIBZ.A
  3. Test_ldflags=-l. libz.a
  4. Ldshared=arm-linux-gcc-shared-wl,-soname,libz.so.1,--Version-script,zlib.map
  5. Cpp=arm-linux-gcc-e
  6. Staticlib=libz.a
  7. Sharedlib=libz.so
  8. sharedlibv=libz.so.1.2.5
  9. Sharedlibm=libz.so.1
  10. libs=$ (staticlib) $ (SHAREDLIBV)
  11. Ar=arm-linux-ar RC
  12. Ranlib=arm-linux-ranlib
  13. Ldconfig=ldconfig
  14. Ldsharedlibc=-lc
  15. Tar=tar
  16. Shell=/bin/sh
  17. Exe=
  18. Prefix =/opt/webcam/ffmpeg
Run Configure Yes--prefix is the last parameter, here the change is OK

Then Make,make install

#make

#make Install

Zlib compilation should not be the problem, in the/opt/wecam/ffmpeg is a compiled file, in the subfolder lib. So files are finally copied to 2440


2. Compiling x264

You need to add support for x264 when compiling ffmpeg, so compile the x264 first so that you can find it when compiling ffmpeg

Decompression last_x264.tar.bz2

#tar-xvzf last_x264.tar.bz2

#cd x264-snapshot-20120316-2245

#./configure--host=arm-linux--prefix=/opt/wecam/ffmpeg--enable-shared--disable-asm

The options for the host have been added to the configuration options, so the makefile will not have to be modified, but to modify the Config.mak

[Plain]View PlainCopy
  1. Srcpath=.
  2. Prefix=/opt/webcam/ffmpeg
  3. Exec_prefix=${prefix}
  4. Bindir=${exec_prefix}/bin
  5. Libdir=${exec_prefix}/lib
  6. Includedir=${prefix}/include
  7. Arch=arm
  8. Sys=linux
  9. cc=arm-linux-gcc
  10. Cflags=-wshadow-o3-fno-fast-math-wall-i.-i$ (Srcpath)-std=gnu99-fpic-fomit-frame-pointer-fno-tree-vectorize
  11. Depmm=-mm-g0
  12. Depmt=-mt
  13. Ld=arm-linux-gcc-o
  14. ldflags=-lm-lpthread
  15. libx264=libx264.a
  16. Ar=arm-linux-ar RC
  17. Ranlib=arm-linux-ranlib
  18. Strip=arm-linux-strip

#make

#make Install

x264 compile will not be the problem, if any, the previous installation of the PC-side x264 all deleted


3. Compiling ffmpeg

Decompression ffmpeg-0.10.1.tar.gz

#tar-XZVF ffmpeg-0.10.1.tar.gz

#cd ffmpeg-0.10.1

#./configure--enable-cross-compile--target-os=linux--cross-prefix=arm-linux---CC=ARM-LINUX-GCC--enable-shared- -arch=armv6--ENABLE-GPL--enable-libx264--prefix=/opt/webcam/ffmpeg--extra-cflags=-i/opt/webcam/x264/include-- extra-ldflags=-l/opt/webcam/x264/lib/

The configuration needs to be noted--extra-cflags=-i/opt/webcam/ffmpeg/include--extra-ldflags=-l/opt/webcam/ffmpeg/lib/specifies the location of the x264 library

#make

#make Install

Above, all dependent libraries are compiled, and the webcam application is compiled below


All the source files do not do in addition to modify the UDP upload with the IP address and makefile file, do not make any changes, source storage location/opt/webcam

1. Modify Server.cpp IP

Change #define TARGET_IP "192.168.1.220" to the IP of your PC Linux, which is still the IP address of the PC where the client webcam_shower resides.

2, modify the Shower.cpp in the

Inet_addr ("192.168.1.220"); Change IP to PC Linux IP, which is your own ip,socket bound port

3, modify the makefile, in order to cross-compile webcam_server, note that the previous compilation zlib x264 ffmpeg are in the Webcam/ffmpeg

[Plain]View PlainCopy
  1. All:webcam_server
  2. #webcam_shower
  3. cc=arm-linux-g++
  4. Ld=arm-linux-ld
  5. cxxflags=-c-g-o0-fpic-i./ffmpeg/include-l./ffmpeg/lib
  6. objs_server= capture.o VCOMPRESS.O sender.o server.o
  7. objs_shower= VSHOW.O RECVER.O SHOWER.O
  8. Libs_server=-lavcodec-lswscale-lavutil-lx264-lpthread-lz
  9. Libs_shower=-lavcodec-lswscale-lavutil
  10. . CPP.O:
  11. $ (CC) $ (cxxflags) $<
  12. Webcam_server: $ (objs_server)
  13. $ (CC)-o [email protected] $^-l./ffmpeg/lib $ (libs_server)
  14. Webcam_shower: $ (objs_shower)
  15. $ (CC)-o [email protected] $^ $ (libs_shower)
  16. Clean
  17. Rm-f *.O
  18. Rm-f Webcam_server
  19. Rm-f Webcam_shower

#make

This step will be error, reported C and C + + compatibility issues, add the following in Include/libavutil/common.h, you can

[CPP]View PlainCopy
    1. #ifndef Uint64_c   
    2. #define UINT64_C (value) __concat (value,ull)   
    3. #endif   


Finally, we get the compiled web_server, copy the Web_server to mini2440, and copy all the. So files under/lib of the previously compiled third-party codec library to mini2440/usr/lib

Plug in the USB camera, Webcam_server can be run again mini2440


The last is to compile PC-side webcam_shower, this is very simple, in order to compile from the beginning of the good


Successfully transplanted on mini2440 ffmpeg----fwqlzz love are for ever

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.