Compiling the FFmpeg Win32 Platform Library

Source: Internet
Author: User

First, the purpose

FFmpeg is an open-source streaming program that can be used to record, transcode, and convert audio and video into streams. Use the LGPL or GPL license. It contains a very advanced audio/video codec library, in order to ensure high portability and codec quality, many of the code is developed from scratch.

FFmpeg is developed under the Linux platform, and if you want to compile a library for use under the Windows platform, one way is to use cross-compilation. A person on the internet called Zeranoe, who provided the FFmpeg Windows Platform Development SDK (URL: https://ffmpeg.zeranoe.com/builds/), and he also provided a script to build the cross-compilation environment (URL: https:// ffmpeg.zeranoe.com/blog/?cat=4). FFmpeg default There are many libraries do not contain, such as LIBFAAC, libx264, etc., we use the Zeranoe provided by the script to build a cross-compilation environment, and then build the ffmpeg of the Windows Platform SDK (including LIBFAAC, libx264).

Second, the compilation Environment 1, the Computer Configuration

System: ubuntu15.10 64-bit

Cpu:intel®core™2 Duo CPU T6570 @ 2.10ghzx2

2. File directory

I put the files that need to be downloaded into the/home/hjc/, which can be put somewhere else according to your needs.

  

such as ffmpeg storage source code, Ffmpeg_build stored in the compilation generated intermediate files and libraries and executables, ffmpeg_dependency storage you need to ffmpeg additional support library (LIBFAAC, libx264, etc.), Mingw-w64 a file that stores a cross-compilation environment.

  A, FFmpeg download method: Under/home/hjc/execution:

#git Clone Git://source.ffmpeg.org/ffmpeg.git FFmpeg

B, libx264 download method: I am directly in the "Https://ffmpeg.zeranoe.com/builds"/page Download the compressed package, and then extracted to/home/hjc/ffmpeg_dependency/below.

Libfaac Download Method: Enter "http://www.audiocoding.com/downloads.html" to download "Version 1.28 bootstrapped TAR. GZ package, and then extract the same to/home/hjc/ffmpeg_dependency/below.

C, cross-compilation script download method: Enter/home/hjc/mingw-w64/under execution:

#wget http://zeranoe.com/scripts/mingw_w64_build/mingw-w64-build-3.6.7
Third, compile Method 1, build cross-compilation environment

Enter/home/hjc/mingw-w64/

Perform:

#chmod 777 mingw-w64-build-3.6.7

Perform:

#./mingw-w64-build-3.6.7

Start with a hint that some dependent libraries are not installed, install according to the name of the installation package it recommends, execute:

Apt-get install texinfo CVS yasm subversion git Flex Bison "

You can install the corresponding package.

Then execute again:./mingw-w64-build-3.6.7 the installation of the cross-compilation environment can be completed by following the prompts step-after-step.

Finally, the directory where the cross-compiled executable program is located is added to the environment variable.

Perform:

#echo "Export path="/home/hjc/mingw-w64/mingw-w64-i686/bin: $PATH "" >>/etc/profile#source/etc/profile
2. Compile dependent third-party libraries

The Ffmpeg_build directory is as follows:

Third-party libraries and header files are stored under the Third_party directory.

Win32 store FFmpeg compile generated libraries and header files.

A, compile LIBFAAC

Enter/home/hjc/ffmpeg_dependency/faac-1.28/execution:

#./configure--host=i686-w64-mingw32--prefix=/home/hjc/ffmpeg_build/third_party/--enable-static--disable-shared --with-mp4v2=no#make#make Install

B, compiling libx264

Enter/home/hjc/ffmpeg_dependency/x264-20160613-3f5ed56/execution:

After execution, verify that the library and header files are generated under/home/hjc/ffmpeg_build/third_party/.

3. Compiling ffmpeg

Enter/home/hjc/ffmpeg_build/win32/execution:

#.. /.. /ffmpeg/configure--enable-static--disable-shared--enable-version3--ENABLE-GPL--enable-nonfree-- Disable-pthreads--enable-w32threads--enable-runtime-cpudetect--enable-memalign-hack--ENABLE-LIBFAAC-- enable-libx264--enable-zlib--enable-cross-compile--target-os=mingw32--arch=x86--prefix=/home/hjc/ffmpeg_build/ win32/--cross-prefix=i686-w64-mingw32---extra-cflags= "-i/home/hjc/ffmpeg_build/third_party/include"-- extra-ldflags= "-l/home/hjc/ffmpeg_build/third_party/lib" #make #make Install

Then, under /home/hjc/ffmpeg_build/win32/, confirm that the include and Lib folders are generated, as follows:

If the file is generated as shown, the compilation is successful.

Compiling the FFmpeg Win32 Platform Library

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.