libav와 apt-get으로 설치한 ffmpeg 삭제
sudo apt-get remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
공통 툴 설치
sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libx11-dev libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev
설치 작업 폴더
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
Yasm: the modular assembler
sudo apt-get install yasm
x264: H.264 video encoder
sudo apt-get install libx264-dev
fdk-aac: AAC audio encoder
sudo apt-get install unzip
cd ~/ffmpeg_sources
wget -O fdk-aac.zip https://github.com/mstorsjo/fdk-aac/zipball/master
unzip fdk-aac.zip; cd mstorsjo-fdk-aac*
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean
libmp3lame: MP3 audio encoder
sudo apt-get install libmp3lame-dev
libopus: Opus audio decoder and encoder
sudo apt-get install libopus-dev
libvpx: VP8/VP9 video encoder and decoder
cd ~/ffmpeg_sources
wget http://webm.googlecode.com/files/libvpx-v1.3.0.tar.bz2
tar xjvf libvpx-v1.3.0.tar.bz2
cd libvpx-v1.3.0
PATH="$PATH:$HOME/bin" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples
PATH="$PATH:$HOME/bin" make
make install
make clean
rtmp
sudo apt-get install -y librtmp-dev
FFmpeg 소스 다운로드
cd ~/ffmpeg_sources
wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
FFmpeg 빌드
./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --bindir="$HOME/bin" --extra-libs="-ldl" --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab --enable-librtmp --enable-ffplay --enable-libfreetype
make
make install
make distclean
실행 파일 설치 장소: ~/bin
~/bin에는 FFmpeg의 실행 파일들이 설치된다. 이 디렉토리를 $PATH 환경 변수에 반영시킨다. (export PATH="$HOME/bin:$PATH")
파일명 내용
ffmpeg audio and video encoder/decoder
ffplay media player
ffprobe media file characteristics viewer
ffserver broadcast server for multimedia streaming using HTTP and RTSP protocols
라이브러리 및 헤더 파일 설치 장소: ~/ffmpeg_build/
라이브러리 파일들이 설치되는 위치는 다음과 같다.
디렉토리 내용
include/libavcodec/ multimedia codec header
include/libavdevice/ device header
include/libavfilter/ filter header
include/libavformat/ media format header
include/libavutil/ utility header
include/libpostproc/ post processing header
include/libswresample/ audio resampling header
include/libswscale/ media scaling header
lib/ *.a, *.so 등
share/
pkg-config 패스(Path) 설정
vi .bash_profile
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/hl1sqi/ffmpeg_build/lib/pkgconfig
공유 라이브러리 추가
sudo vi /etc/ld.so.conf.d/ffmpeg.conf
/home/<YOUR HOME DIRECTORY>/ffmpeg_build/lib
sudo ldconfig