- http://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide
- http://imedia.disi.unitn.it/QoE/
1. x264
Download:
git clone --depth 1 git://git.videolan.org/x264
(Hoac lay truc tiep tren trang videolan.org)
Cai dat:
cd x264
./configure --enable-shared
(chu y mac dinh file configure cua x264 la disable-shared, do do khi ffmpeg goi mot so ham theo kieu lien ket dong se ko goi duoc)
make
sudo make install (thuong duong dan mac dinh se o /usr/local/include/x264.h va /usr/local/lib/libx264*)
2. fdk-aac
Download:
git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git
(Hoac lay truc tiep o day: ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2)
Cai dat:
autoreconf -fiv (chay lenh nay truoc vi fdk-aac chua sinh file configuration)
./configuration
make
sudo make install
3. libvpx
Download: git clone --depth 1 http://git.chromium.org/webm/libvpx.git
(Hoac lay truc tiep o day: http://code.google.com/p/webm/downloads/list)
Cai dat:
./configure
make
sudo make install
4. ffmpeg
Download: Chu y can download dung goi ffmpeg for psnr-tools
(neu lech phien ban se thieu nhieu ham ma psnr-tools goi)
wget http://imedia.disi.unitn.it/QoE/ffmpeg-for-psnrtools.tgz
tar xvfzffmpeg-for-psnrtools.tgz
Cai dat:
./configure --enable-gpl --enable-libfaac --enable-libfdk-aac --enable-libmp3lame \
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora \
--enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree \
--enable-version3
--> se xuat hien ra nhieu loi trong do co loi libx264 not found;
(Nguyen nhan la do version cua ffmpeg va x264 khong tuong ung voi nhau
Rat nhieu ham ffmpeg goi tu x264, nhung ban x264 lastest khong co hoac da sua ten ham)
Khac phuc:
b1. Mo file configure cua ffmpeg, xem ffmpeg dang require nhung thu vien nao va ham nao trong thu vien do
vd: require libx264 x264.h x264_encoder_open -lx264 -lm
b2. Kiem tra lai ten ham dung trong x264 dang dinh nghia
lenh: nm /usr/local/lib/libx264.a | grep x264_encoder_open
ket qua: 0000000000007b10 T x264_encoder_open_128
(Co nghia la ham nay da duoc implement trong x264 nhung ten la x264_encoder_open_128)
b3. Mo lai file configure cua ffmpeg va sua lai ham x264_encoder_open --> x264_encoder_open_128
Luc nay bien dich lai se khong con loi x264 not found nua nhung xuat hien them vo so loi khac
(Nguyen nhan mot so ham trong x264 da thay doi interface, co 2 cach khac phuc: hoac la sua code x264
hoac sua code ffmpeg; o day toi chon sua code ffmpeg vi se de sua hon)
File can sua code:
- libavcodec/libx264.c:
Doan code cu:
if(x264_nal_encode(x4->sei, &x4->sei_size, 1, nals + i) < 0)
return -1;
==> sua lai nhu sau: (do x264 define ham x264_nal_encode chi co 3 tham so)
x264_nal_encode(x4->sei, &x4->sei_size, nals + i);
if(nals + i < 0) return -1;
Bay gio bien dich se het loi (khong nho la minh con sua loi nao o ffmpeg nua ko :)
5. psnr-tools
download:
git clone http://brenta.disi.unitn.it/~kiraly/PublicGits/psnr-tools.git
Cai dat: (psnr-tools khong tao bo cai theo autoconfig tool nen khong co file configure
chi can chay thang lenh make; chu y trong Makefile cuar psnr-tools co su dung bien FFDIR;
can chinh cho FFDIR tro dung den thu muc ffmpeg va x264 tren may cua minh)
make FFDIR=$PWD/../ffmpeg/ X264DIR=$PWD/../x264/
--> se sinh ra vo so loi
(Nguyen nhan khong hieu tai sao Makefile cua psnr-tools link thieu rat nhieu thu vien???;
luu y Makefile ngoai thu muc psnr-tools chi goi den Makefile trong cac thu muc con
--> can phai sua Makefile cua cac thu muc con; cu the: Analyser/Makefile)
Chi thi bien dich ban dau:
LDLIBS = -lavformat -lavcodec -lavutil
sua them nhu sau:(de ra them duoc cac lib cho dung thi can bien dich,
co loi lai tim xem ham nao khong reference duoc nam trong thu vien nao)
LDLIBS = -lavformat -lavcodec -lavutil -lfaac -lfdk-aac -lmp3lame -lopencore-amrnb
-lopencore-amrwb -ltheora -ltheoradec -ltheoraenc -lvorbis -lvorbisenc -lvpx -lx264 -lrtmp
Chu y: vd voi chi thi bien dich -lavformat --> ban chat trinh dich se tim thu vien
libavformat.a (hoac khi chay chuong trinh se goi ham trong libavformat.so)
trong mot trong cac thu muc mac dinh sau: /usr/local/lib; /usr/lib/; /lib/
--> mot so thu vien mac du da cai roi nhung nam trong /usr/lib/x86_64-linux-gnu/
(so di nam o day la vi cai bang apt-get install)
can duoc copy den cac thu muc mac dinh (hoac chuan nhat la tao symbolic link)
lenh: ln ...
Luc nay make se OK
psnr-tools Makefile khong ho tro make install --> co the viet them vao make file hoac copy
bang tay nhung file chay can thiet den /usr/local/bin hoac /usr/sbin de co the chay tu bat
ky dau
(con cap nhat...)
Không có nhận xét nào:
Đăng nhận xét