로그인

  • 목록
  • 아래로
  • 위로
  • 쓰기
  • 검색

정보&강의 Centos 5 에 ffmpeg 설치 하기

첨부 1


[리눅스] Centos 5 에 ffmpeg 설치 하기

글쓴이 : 유아원
http://blog.naver.com/humor1004/120048954163



1. Create a directory to do our work in <?xml:namespace prefix = o />

mkdir ~/ffmpeg

cd ~/ffmpeg


2. Get all the source files

wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20061022.tar.bz2

wget http://rubyforge.org/frs/download.php/9225/flvtool2_1.0.5_rc6.tgz

wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz

wget http://superb-west.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.5.0.tbz2

wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz

wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.1.2.tar.gz

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg


3. Extract all the source files

bunzip2 essential-20061022.tar.bz2

tar xvf essential-20061022.tar

tar zxvf flvtool2_1.0.5_rc6.tgz

tar zxvf lame-3.97.tar.gz

bunzip2 ffmpeg-php-0.5.0.tbz2

tar xvf ffmpeg-php-0.5.0.tar

tar zxvf libogg-1.1.3.tar.gz

tar zxvf libvorbis-1.1.2.tar.gz

4. Create the codecs directory & import them

mkdir /usr/local/lib/codecs/

mv essential-20061022/* /usr/local/lib/codecs/

chmod -R 755 /usr/local/lib/codecs/

5. Install SVN/Ruby (Depends on OS, this is for RHEL/CentOS)

yum install subversion* <-- 수정

yum install ruby

yum install ncurses-devel* <-- 안나와서 수정

6. Get the latest FFMPEG/MPlayer from the subversion

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer

7. Compile LAME

cd ~/ffmpeg/lame-3.97

./configure

make

make install

rpm -q libogg

#rpm 설치 파일이 존재 아래 설치하지 않음

8. Compile libOGG <-- 2차대 진행했음.

cd ~/ffmpeg/libogg-1.1.3

./configure

make

make install

rpm - q libvorbis

#rpm 설치 파일이 존재 아래 설치하지 않음

9. Compile libVorbis <-- 2차때 했음.

cd ~/ffmpeg/libvorbis-1.1.2

./configure

make

make install

10. Compile flvtool2

cd ~/ffmpeg/flvtool2_1.0.5_rc6

ruby setup.rb config

ruby setup.rb setup

ruby setup.rb install

11. Compile MPlayer

cd ~/ffmpeg/mplayer

./configure

make

make install

vi /etc/ld.so.conf

/usr/local/lib # 없으면 추가

ldconfig # 추가 했다면 실행

12. Compile FFMPEG

cd ~/ffmpeg/ffmpeg

./configure --enable-libmp3lame --enable-libogg --enable-libvorbis --disable-mmx --enable-shared
<--
--enable-libogg 는 빼고 할것. 넣고 하면 에러

뺴고 하면 이렇게 되겠지.
./configure --enable-libmp3lame --enable-libvorbis --disable-mmx --enable-shared

참고 : 107번 서버에서는 에러 발생
/tmp
파일에 퍼미션 어쩌고 그러면 configure 파일 열고 /tmp 의 경로를 /tmp2 로 바꾸고 퍼미션 777로 하고 삭제 할것
cd / (
서버 루트로 이동후 )
mkdir tmp2 (tmp2
라는 폴더를 새로 만들고)

hmod 777 tmp2 (퍼미션을 777 로 주고 모든 작업 끝난후 본 폴더는 지워주자)

echo '#define HAVE_LRINTF 1' >> config.h

make

make install

13. Finalize the codec setups

ln -s /usr/local/lib/libavformat.so.50 /usr/lib/libavformat.so.50 #파일이 없어서 실행 안함 ㅡㅡ? 해열은 잘됨. 107 성공

ln -s /usr/local/lib/libavcodec.so.51 /usr/lib/libavcodec.so.51

ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49

ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0

ln -s /usr/local/lib/libavformat.so.51 /usr/lib/libavformat.so.51

ln -s /usr/local/lib/libavdevice.so.52 /usr/lib/libavdevice.so.52

ln -s /usr/local/lib/libavformat.so.52 /usr/lib/libavformat.so.52


위 심볼릭 링크 작업 중 안되는거 있음 걍 무시하고 지나 가 보고 최종 적으로 설치 안되면 다시 검토 해 보자.

14. Compile FFMPEG-PHP

cd ~/ffmpeg/ ffmpeg-php-0.5.0

phpize # phpize 가 없다면 옆에 실행 => yum install php-devel.i386

This allowed ffmpeg-php to configure

./configure --enable-shared

위 실행시 아래와 같은 문제 발생할 경우

checkingfor ffmpeg headers... configure: error: ffmpeg headers not found. Makesure you've built ffmpeg as shared libs using the --enable-shared option

(107서버에서 )
위와 같은 에러발생해결책
:
참조문서:
http://groups.google.com/group/ffmpeg-php/browse_thread/thread/7902bd06430ad75c

ffmpeg폴더의 ffmpeg 폴더 아래에서 아래 파일을 찾아서 아래 경로로 복사해준다.
cd /ffmpeg/ffmpeg/


cp ./libavcodec/avcodec.h /usr/local/include/ffmpeg/avcodec.h
cp ./libavformat/avformat.h /usr/local/include/ffmpeg/avformat.h
cp ./libavformat/avio.h /usr/local/include/ffmpeg/avio.h



make

make install

extension=/usr/local/lib/php/extensions/no-debug-non-zts-20020429/ffmpeg.so

extension_dir = /usr/lib/php/modules

15. Install FFMPEG-PHP (make sure the php.ini path is correct.)

echo 'extension=/usr/local/lib/php/extensions/no-debug-non-zts-20020429/ffmpeg.so' >> /usr/local/Zend/etc/php.ini

-- 주의 무작정 위에 껄 따라 하면 낭패 봄.
/etc/php.ini
파일에서 extension_dir 을 찾아서 예를 들면 107번 같은 경우는

extension_dir = /usr/lib/php/modules

이렇게 되어 있음. 그러면 /usr/lib/php/modules ffmpeg.so 파일이 있을것임.

확인하고 아래 실행.

echo 'extension=ffmpeg.so' >> /usr/local/Zend/etc/php.ini

16. Restart Apache to load FFMPEG-PHP (Depends on OS, this is for RHEL/CentOS)

service httpd restart

17. Verify if it works

php -r 'phpinfo();' | grep ffmpeg

If you get a few lines such as

ffmpeg

ffmpeg support (ffmpeg-php) => enabled

ffmpeg-php version => 0.5.0

ffmpeg.allow_persistent => 0 => 0

# 위와 같이 보이면 성공

Then everything is installed and working. FFMPEG, FFMPEG-PHP, MPlayer, MEncoder, flv2tool, LAME MP3 encoder & libOGG.

# 17번에서 Error:cannot restore segment prot after reloc: Permission denied 이런 메세지가 있으면..

vi /etc/sysconfig/selinux

SELINUX=enforcing

위와 같은 설정이 있다면 위부분을

SELINUX=disabled 로 변경

시스템 부팅 selinux가 커널쪽에 무슨 설정이 있다고 합니다 그래서 리붓

차후 확인 php -r 'phpinfo();' | grep ffmpeg 정상적으로 보임

[테스트]

ffmpeg -i video.wmv -ar 22050 -ab 32 -f flv -s 320x240 video.flv | flvtool2 -U stdin video.flv

1. AVI to FLV

C:\> ffmpeg -i test.avi -ar 44100 -ab 32 -f flv -s 640x480 test.flv

-i : input file name
-ar : audio sampling rate in HZ
-ab : audio bit rate in kbit/s
-f : output format
-s : output dimension
--------------------------------------------------------------------------------------------------
2. FLV to JPG

C:\> ffmpeg -i test.flv -an -r 1 -y -s 640x480 test%d.jpg

-i : input file name
-an : disable audio
-r : fps
-y : overwrite file
-s : output dimension

3. Particular frame to JPG

C:\> ffmpeg -i test.flv -an -ss 00:00:10 -t 00:00:01 -r 1 -y -s 640x480 test%d.jpg

-ss : recored start time
-t : record end time last for


이런 글도 찾아보세요!

공유

facebooktwitterpinterestbandkakao story
퍼머링크

댓글 1

권한이 없습니다. 로그인

신고

"님의 댓글"

이 댓글을 신고 하시겠습니까?

삭제

"님의 댓글"

이 댓글을 삭제하시겠습니까?