DIGIPOWER Tutorials

Trang chủ | | Danh mục bài viết yêu thích | Liên hệ | Đăng nhập Trang chủ | | Danh mục bài viết yêu thích | Liên hệ | Đăng nhập
Tìm kiếm các bài viết theo từ khoá Liệt kê theo danh mục
How to Install ffmpeg
Chi tiết bài viết

Lần cập nhật cuối
5th of June, 2012

Ý kiến người dùng (9 Bình chọn)
100% thumbs up 0% thumbs down

Làm thế nào bạn sẽ đánh giá câu trả lời này?
có ích
không hữu ích

This post will provide you with the instructions to download and install ffmpeg, ffmpeg-php, flvtool, lame, mplayer, libogg, libvorbis, mencoder, and other codecs used with ffmpeg.

1# cd /usr/local/src
1tar xvzf flvtool2-1.0.6.tgz
2tar xvzf lame-3.98.4.tar.gz
3tar jxvf ffmpeg-php-0.6.0.tbz2
4tar xvzf libogg-1.2.0.tar.gz
5tar xvzf libvorbis-1.3.1.tar.gz
6tar jxvf essential-20071007.tar.bz2
7tar jxvf mplayer-export-snapshot.tar.bz2
8tar xvzf ffmpeg-0.6.tar.gz

Make a directory to store all the codecs:

1# mkdir /usr/local/lib/codecs/

Install any necessary packages:

1yum install gcc gmake make libcpp libgcc libstdc++ gcc4 gcc4-c++  ncurses-devel

Copy codecs for mplayer:

1mv /usr/local/src/essential-20071007/* /usr/local/lib/codecs/
2chmod -R 755 /usr/local/lib/codecs/

Installing Lame:

1cd /usr/local/src/lame-3.98.4
2./configure
3make && make install

Installing Libogg:

1cd /usr/local/src/libogg*
2./configure && make && make install
3Installing libvorbis:
1cd /usr/local/src/libvorbis*
2./configure && make && make install

Installing flvtool2:

1cd /usr/local/src/flvtool*
2ruby setup.rb config
3ruby setup.rb setup
4ruby setup.rb install
1# cd /usr/local/src/mplayer*
2./configure && make && make install

Installing ffmpeg PHP module

1cd /usr/local/src/ffmpeg-*
2./configure --enable-libmp3lame --enable-libvorbis --disable-mmx --enable-shared

(If you need to customize your install, run “./configure –help” to see a complete list of the available flags)

1make && make install
1ln -s /usr/local/lib/libavformat.so.50 /usr/lib/libavformat.so.50
2ln -s /usr/local/lib/libavcodec.so.51 /usr/lib/libavcodec.so.51
3ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49
4ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0
5ln -s /usr/local/lib/libavformat.so.51 /usr/lib/libavformat.so.51

Installing ffmpeg-php:

1# cd /usr/local/src/ffmpeg-php*
2phpize
3./configure

There’s a small issue in this version of ffmpeg-php which, when “make” is run, will cause the following error:

1gcc -I. -I/usr/local/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/local/src/ffmpeg-php-0.6.0/include -I/usr/local/src/ffmpeg-php-0.6.0/main -I/usr/local/src/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include/libavcodec/ -I/usr/local/include/libavformat/ -I/usr/local/include/libavutil/ -I/usr/local/include/libswscale/ -I/usr/local/include/libavfilter/ -I/usr/local/include/libavdevice/ -I/usr/include/php -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c  -fPIC -DPIC -o .libs/ffmpeg_frame.o
2/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function 'zim_ffmpeg_frame_toGDImage':
3/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: 'PIX_FMT_RGBA32' undeclared (first use in this function)
4/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: (Each undeclared identifier is reported only once
5/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: for each function it appears in.)
6/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function 'zim_ffmpeg_frame_ffmpeg_frame':
7/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:421: error: 'PIX_FMT_RGBA32' undeclared (first use in this function)
8make: *** [ffmpeg_frame.lo] Error 1

To correct this issue, we’ll update ffmpeg_frame.c and replace every instance of PIX_FMT_RGBA32 with PIX_FMT_RGB32

1vi ffmpeg_frame.c
1:%s/PIX_FMT_RGBA32/PIX_FMT_RGB32
2 
3:w :q!

Now we can proceed with compiling:

1make
2make install

Now that we’ve compiled, let’s make sure that ffmpeg.so is in the proper extensions directory:

1php -i | grep extensions
2/usr/local/lib/php/extensions/no-debug-non-zts-20060613

Now we’ll tell PHP that it needs to load our module:

1echo 'extension=ffmpeg.so' >> /usr/local/lib/php.ini

Restart apache:

1service httpd restart

Now we’ll do a quick list of the modules to ensure that ffmpeg-php is loaded:

1php -m | grep ffmpeg
2ffmpeg

All done!

Các bài liên quan
Không có bài viết liên quan đã được tìm thấy.
File đính kèm
Không có File đính kèm nào được tìm thấy.

Tiếp tục

Knowledge Management