Compile FFMPEG in Linux

Source: Internet
Author: User
Tags svn client

Environment: RedHat as4

1. Obtain FFMPEG first

Download through SVN:

Download the svn client from the http://subversion.tigris.org.

First install the Subversion to ensure that APR and APR-util are installed.

Wget http://subversion.tigris.org/downloads/subversion-1.3.2.tar.gz

Tar zvxf subversion-1.3.2.tar.gz
CD subversion-1.3.2
./Configure -- With-Apr =/usr/local/APR-HTTPd -- With-Apr-util =/usr/local/APR-util-httpd/
Make; make install

At this point, we can use the svn command to obtain the latest FFMPEG.

SVN checkout SVN: // SVN. mplayerhq. hu/FFMPEG/trunk FFMPEG

You will find that an FFMPEG directory automatically appears in your directory, which is the source code you downloaded. We cannot compile FFMPEG so quickly. We need to do some preliminary work if we want FFMPEG to support conversion of more formats.

2. MP3 is supported. Linux is of course lame. Download and decompress it.

CD lame-3.96.1
./Configure -- enable-shared -- prefix =/usr
Make; make install

We recommend that you install it in/usr by default. In this way, FFMPEG compilation can smoothly find library files.

3. Support for Ogg Vorbis:

As4 comes with the corresponding RPM package. You can install the following RPM package

Libvorbis, libvorbis-devel, libogg, libogg-devel

4. Supports Xvid x264. Currently, the two most popular high quality compression formats

Xvid compilation and Installation

Wget http://downloads.xvid.org/downloads/xvidcore-1.1.0.tar.gz
Tar zvxf xvidcore-1.1.0.tar.gz
./Configure -- prefix =/usr
Make; make install

The method for obtaining x264 is also SVN.

SVN Co SVN: // svn.videolan.org/x#/trunk x264
CD x264
./Configure -- prefix =/usr -- enable-shared
Make; make install

5. Support for Ac3 and DTS Encoding

The as4 system seems to have supported AC3 encoding, as long as the -- enable-a52 -- enable-GPL parameter is added during compilation.

Libdts compilation Parameters

./Configure -- prefix =/usr
Make; make install

6. Support for the mpg4 AAC format. Because the server is still targeting mobile user services, we also need to do the support for AAC and mpg4 ringtone formats. Here we can install faad2 and faac.

Please download to http://www.audiocoding.com/modules/mydownloads/

Faad2 Compilation

CD faad2
Autoreconf-VIF
./Configure -- prefix =/usr -- with-mp4v2 -- enable-shared
Make; make install

Faac Compilation

CD faac
Chmod + x Bootstrap
./Bootstrap
./Configure -- prefix =/usr -- with-mp4v2 -- enable-shared
Make; make install

7. Support for 3GP format, which is also supported by many mobile phones. Because mobile phone users are our main users, compilation must be supported.

Add -- enable-amr_nb -- enable-amr_wb parameters when compiling, according to the prompts of the compilation system, so we have to download some files required to compile 3GP.

Wget http://www.3gpp.org/ftp/Specs/ar. .. 6.204/26204-510.zip

Decompress the package and copy all the files to libavcodec/amrwb_float.

Wget http://www.3gpp.org/ftp/Specs/ar. .. 6.104/26104-510.zip

Decompress the package and copy all the files to libavcodec/amr_float.

Well, we have prepared the basic formats supported by FFMPEG. The following is the compilation of FFMPEG.

. /Configure -- prefix =/usr -- enable-GPL -- enable-shared -- enable-mp3lame -- enable-amr_nb -- enable-amr_wb -- enable-libogg -- enable-Vorbis -- enable-Xvid -- enable-amr_if2 -- enable-a52 -- enable-a52bin -- enable-faadbin -- enable-DTS -- enable-PP -- enable-faad -- enable-faac -- enable-x264 -- enable-pthreads -- disable-ffserver -- disable-ffplay
Make; make install

Supplement 1:

About 3GP compilation, If You Want To compile -- enable-amr_nb-fixed, it can not be compiled with -- enable-amr_nb at the same time, I do not know the difference between the two in the end, it seems that fixed is a revision, regardless of him, compilation Method:

Wget http://www.3gpp.org/ftp/Specs/ar. .. 6.073/26073-510.zip

Decompress the package and copy all the files to the libavcodec/AMR directory.

Modify libavcodec/AMR/makefile and find cflags =-wall-pedantic-errors-I. $ (cflags _ $ (mode)-d $ (VAD) to cflags =-wall-I. $ (cflags _ $ (mode)-d $ (VAD)-dmms_io

The overall compilation parameter is
. /Configure -- prefix =/usr -- enable-GPL -- enable-shared -- enable-mp3lame -- enable-amr_nb-fixed -- enable-amr_wb -- enable-libogg -- enable-Vorbis -- enable-Xvid -- enable-amr_if2 -- enable-a52 -- enable-a52bin -- enable-DTS -- enable-PP -- enable-faad -- enable-faadbin -- enable-faac -- enable-x264 -- enable-pthreads -- disable-ffserver -- disable-ffplay
Make
Make install

Supplement 2:

Some friends say that when the CPU is x86, it cannot be compiled. I have never done this here. If you cannot compile it, try adding CPU = CPU.

Supplement 3:

Mencoder provided by wmplayer can be used for RM and WMV processing.

This article from: Linux Learning Network (http://www.5dlinux.com) detailed source: http://www.5dlinux.com/article/4/2007/linux_1373.html

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.