ffmpeg build

http://alvastro.tistory.com/86

ffmpeg compile
OS : Fedora core 8
kernel : 2.6.26.8-57.fc8
외부 코덱 라이브러리 설치 위치 /usr/alvastro/extras
ffmpeg 설치 위치 /usr/alvastro/ffmpeg
외부코덱 라이브러리 패키지 PATH 지정
export PKG_CONFIG_PATH=/usr/alvastro/extras/lib/pkgconfig:$PKG_CONFIG_PATH

faad2 compile
wget http://downloads.sourceforge.net/faac/faad2-2.7.tar.gz
./configure --prefix=/usr/alvastro/extras --enable-shared --enable-static
make ; mak install

faac-1.28 compile
wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gz
./configure --prefix=/usr/alvastro/extras --enable-shared --enable-static
make ;make install

libmpeg2 compile
wget http://libmpeg2.sourceforge.net/files/libmpeg2-0.5.1.tar.gz
./configure --prefix=/usr/alvastro/extras --enable-shared --enable-static
make;make install

speex를 컴파일 할때 libogg를 포함한다.
libogg
wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
./configure --prefix=/usr/alvastro/extras --enable-shared --enable-static
make;make install

speex
wget http://downloads.xiph.org/releases/speex/speex-1.2rc1.tar.gz
./configure --prefix=/usr/alvastro/extras --enable-shared --enable-static --with-ogg=/usr/alvastro/extras
make ;make install

libvorbis
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.0.tar.gz
./configure --prefix=/usr/alvastro/extras --enable-shared --enable-static --with-ogg=/usr/alvastro/extras
make;make install

yasm for libx264
wget http://www.tortall.net/projects/yasm/releases/yasm-0.7.2.tar.gz
컴파일해도 안된다. ㅡㅡ;; asm은 패스 ;;
asm이 없으면 h.264로 엔코딩할때 시간이 많이 걸린다고 한다..

gpac for libx264
wget http://downloads.sourceforge.net/gpac/gpac-0.4.5.tar.gz
./configure --prefix=/usr/alvastro/extras --enable-shared --enable-static --disable-opengl
make clean;make
일단 opengl이 필요없으므로 컴파일하지 않는다..
cp -a bin/gcc/libgpac_static.a /usr/alvastro/extras/lib/
cp include -apR /usr/alvastro/extras/include

libx264
git clone git://git.videolan.org/x264.git
./configure --prefix=/usr/alvastro/extras --disable-asm --enable-shared --enable-mp4-output --extra-ldflags=-L/usr/alvastro/extras/lib --extra-cflags=-I/usr/alvastro/extras/include
make;make install

xvidcore
wget http://downloads.xvid.org/downloads/xvidcore-1.2.1.tar.gz
cd build/generic
./configure --prefix=/usr/alvastro/extras
make;make install

libmp3lame
wget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz
./configure --prefix=/usr/alvastro/extras --enable-shared --enable-static
make;make install

libtheora
wget http://downloads.xiph.org/releases/theora/libtheora-1.0.tar.bz2
http://downloads.xiph.org/releases/theora/libtheora-1.0.tar.bz2
./configure --prefix=/usr/alvastro/extras --enable-shared --enable-static
make;make install

ffmpeg 컴파일
ffmpeg는 이 글을 쓰는 날 git로 받은 파일이다.. ffmpeg의 소스 버전에 따라서 컴파일 방법이 다를수 있다.
Source down Date : 2009 03 05
version : SVN-r17822
configure 실행 스크립터 만들기..
vi alvastro-ffmpeg.sh
#내용
./configure --prefix=/usr/alvastro/ffmpeg \
        --enable-static \
        --enable-shared \
        --enable-gpl \
        --enable-postproc \
        --enable-avfilter \
        --enable-libmp3lame \
        --enable-libx264 \
        --enable-libxvid \
        --enable-libfaac \
        --enable-libfaad \
        --enable-libspeex \
        --enable-libvorbis \
        --enable-libtheora \
        --extra-cflags=-I/usr/alvastro/extras/include \
        --extra-ldflags=-L/usr/alvastro/extras/lib \
chmod 777 alvastro-ffmpeg.sh
sh alvastro-ffmpeg.sh
make ; make install

실행 시 라이브러리 패스.
cd /usr/alvastro/ffmpeg/bin
export LD_LIBRARY_PATH=/usr/alvastro/extras/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/alvastro/ffmpeg/lib:$LD_LIBRARY_PATH
./ffplay -stats media.avi
실행 확인

참고사이트
http://ubuntuforums.org/showthread.php?t=786095
ffmpeg를 이용하여 x264 엔코딩
cd /usr/alvastro/ffmpeg/bin
vi 264encode.sh

#!/bin/bash
# Two-Pass x264 Encoding Script
# Usage: ./264encode.sh input output.mp4
# Pass 1
./ffmpeg -y -i $1 -pass 1 -b 512k -bt 512k -vcodec libx264 -an -threads 0 -coder 1 -flags +loop -cmp +chroma -partitions -parti8x8-parti4x4-partp8x8-partp4x4-partb8x8 -me_method dia -subq 1 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -bf 4 -refs 1 -directpred 3 -bidir_refine 0 -trellis 0 -flags2 -bpyramid-wpred-mixed_refs-dct8x8+fastpskip -f mp4 /dev/null
# Pass 2
./ffmpeg -y -i $1 -pass 2 -b 512k -bt 512k -vcodec libx264 -acodec libfaac -ab 128k -ac 2 -threads 0 -coder 1 -flags +loop -cmp +chroma -partitions +parti8x8+parti4x4+partp8x8+partb8x8 -me_method umh -subq 8 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 2 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -bf 4 -refs 4 -directpred 3 -trellis 1 -flags2 +bpyramid+wpred+mixed_refs+dct8x8+fastpskip -f mp4 $2

chmod 777 264encode.sh
./264encode.sh input output.mp4

'Computing' 카테고리의 다른 글

https in java, android  (0) 2010.12.08
x.inf contains DirIDs, which are not supported  (0) 2010.06.10
ffmpeg build  (0) 2010.06.04
VP8 And FFmpeg  (0) 2010.06.03
DDS 자료  (0) 2010.05.14
Apple iPod - iPhone dock Connector Pinout  (0) 2010.04.02
트랙백 0 댓글 0
prev 1 ··· 4 5 6 7 8 9 10 11 12 ··· 57 next