The first step of source code download
Download via git
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
or download directly
wget http://ffmpeg.org/releases/ffmpeg-3.3.tar.bz2
If the downloaded ffmpeg-3.3.tar.bz2 need to be decompressed
TAR-JXVF ffmpeg-3.3.tar.bz2
If your foreign site is slow to access, you can also download it to Www.ffmpeg.club, which you can download in Windows and then copy to Linux.
The second step installs the compilation dependent environment
sudo apt-get update
sudo apt-get-y install autoconf automake build-essential \
Libass-dev Libfreetype6-dev Libsdl2-dev libtheora-dev \
Libtool libva-dev libvdpau-dev Libvorbis-dev libxcb1-dev \
Libxcb-shm0-dev Libxcb-xfixes0-dev pkg-config Texinfo Zlib1g-dev
sudo apt-get install yasm
Third step to install optional dependent libraries
X264 Installation
sudo apt-get install Libx264-dev
If you select compile to add
--ENABLE-GPL--enable-libx264
If the installation fails, you can choose the source installation
wget Http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2tar XJVF LAST_X264.TAR.BZ2CD x264-snapshot* Path= "$HOME/bin: $PATH"./configure--prefix= "$HOME/ffmpeg_build"--bindir= "$HOME/bin"--enable-static-- Disable-openclpath= "$HOME/bin: $PATH" Makemake Install
Aac
sudo apt-get install Libfdk-aac-dev
If you select compile Add--ENABLE-LIBFDK-AAC
If you add--ENABLE-GPL, you need to add--enable-nonfree.
MP3
sudo apt-get install Libmp3lame-dev
If you select compile Add--enable-libmp3lame
Opus
sudo apt-get install Libopus-dev
If you select compile Add--enable-libopus
VPX VP8 Video Encoding Guide
sudo apt-get install Libvpx-dev
If you select compile Add--enable-libvpx
Fourth step compile to static library
Path= "$HOME/bin: $PATH" pkg_config_path= "$HOME/ffmpeg_build/lib/pkgconfig"./configure \
--prefix= "$HOME/ffmpeg_build" \
--pkg-config-flags= "--static" \
--extra-cflags= "-i$home/ffmpeg_build/include" \
--extra-ldflags= "-l$home/ffmpeg_build/lib" \
--bindir= "$HOME/bin" \
--ENABLE-GPL \
--enable-libass \
--ENABLE-LIBFDK-AAC \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libtheora \
--enable-libvorbis \
--ENABLE-LIBVPX \
--enable-libx264 \
--enable-nonfree
Path= "$HOME/bin: $PATH" make
Make install
Hash-r
Compile to be seen in Ffmpeg_build (generated header file, static library file)
Bin include Lib Share
The FFmpeg tool is still under the source directory.
Fast compilation as a dynamic library method
Download the source code after the direct access to the source directory
./configure--enable-shared--prefix=/usr/local/ffmpeg
Make
Make install
Where--enable-shared is compiled as a dynamic library,--prefix represents the path of the installation
Once the compilation is complete, you can see the header files and the dynamic link library files in the/usr/local/ffmpeg directory. If it is convenient for the project to compile and run, you can copy the dynamic link library directly into the/usr/lib directory so that you do not have to specify the library path.
Compile the project time to note that the library path to set to/usr/lib to prevent the old version of the conflict, many software installation will be installed in the FFmpeg, such as installation OpenCV will also put FFmpeg installed, it is possible to cause version conflict.
More information can also focus on my 51CTO video course
Teach you how to develop a video player
Http://edu.51cto.com/course/course_id-8059.html
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/8C/17/wKiom1hhpxiBk1CeAAHvubpXcZo754.png-wh_500x0-wm_3 -wmp_4-s_3448310056.png "title=" Baidu.png "alt=" Wkiom1hhpxibk1ceaahvubpxczo754.png-wh_50 "/>
This article is from the "Xia Chaojun" blog, make sure to keep this source http://xiacaojun.blog.51cto.com/12016059/1923603
FFmpeg's Ubuntu compilation process (compile static libraries and dynamic libraries)