Skip to content

Cent5 ffmpeg 설치

조회 수 18040 추천 수 0 2009.03.17 04:11:57
. Create a directory to do our work in

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


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


 ** ffmpeg 버전의 문제로 make 오류가 발생하는 경우가 있다.    이런 경우 ffmpeg 버전을 지정하여 다운로드 하는 방법이 있다.

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

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

 

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

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

checking for ffmpeg headers... configure: error: ffmpeg headers not found. Make sure 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/


/usr/local/include/ffmpeg/avcodec.h

/usr/local/include/ffmpeg/avformat.h

/usr/local/include/ffmpeg/avio.h

 

make

make install

 

 

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

 
** /usr/local/Zend/etc/php.ini 파일에서 extension_dir = "./" 로 되 있다..
==> /usr/local/php/lib/php/extensions 디렉토리를 참조하여 extension 모듈을 찾는다..
** /usr/local/php/lib/php/extensions  디렉토리에 ffmpeg.so 파일을 copy 만 해 주니 모든것이 해결이 되었다.
 

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 정상적으로 보임



****************************************************
[root@ns1 ffmpeg-php-0.5.0]# /usr/local/php/bin/php -v
PHP 5.1.6 (cli) (built: Mar 20 2007 18:10:32)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
    with Zend Extension Manager v1.0.9, Copyright (c) 2003-2006, by Zend Technologies
    with Zend Optimizer v2.6.2, Copyright (c) 1998-2006, by Zend Technologies
/usr/local/php/bin/php: symbol lookup error: /usr/local/php/lib/php/extensions/no-debug-zts-20050922/ffmpeg.so: undefined symbol: av_free_static



=>[root@ns1 ffmpeg-php-0.5.0]# pwd
/usr/local/src/ffmpeg/ffmpeg-php-0.5.0
[root@ns1 ffmpeg-php-0.5.0]# pwd
[root@ns1 ffmpeg-php-0.5.0]# vi ffmpeg-php.c



/* {{{ php module shutdown function
 */
PHP_MSHUTDOWN_FUNCTION(ffmpeg)
{
   //av_free_static();

     // TODO: Free any remaining persistent movies here?

    UNREGISTER_INI_ENTRIES();

    return SUCCESS;
}
/* }}} */

This is a common error when we issue a “php -v” over command line or when we browse a phpinfo.php on a site.

To quickly fix this problem you will need to recompile your ffmpeg-php again.

How we fix this?

1)

  1. #cd %ffmpeg-php-DIR%
  2. #vi ffmpeg-php.c

remove/comment the call to av_free_static()

save.

2)

rebuild ffmpeg-php and place the new ffmpeg.so on your extension directory.

profile

일요일은 짜빠게뤼~ 먹는날~^^

엮인글 :
http://adminplay.com/1334/557/trackback
List of Articles
번호 제목 글쓴이 날짜sort 조회 수

[Fedora5]부트로더 설정하기

인증서문제 (modulus 비교)

FreeBSD SSH 접속 안되요

linux swap 용량 늘리기

tar 분할 압축 및 해제 및 특정 디렉토리만 압축

콘솔에 남는 메세지로그파일로 남기기

리눅스 - zip 압축 해제

리눅스 로그파일 관리 [로그파일 삭제하는 방법]

인터넷 속도 단위 (bps, cps)

usb 부팅 리눅스 만들기(knoppix)

FreeBSD 커널패닉 복구하기

rrdtool 컴파일시 에러 configure: error: Please fix the...

커널 컴파일 장애 처리 perl: warning: Please check that...

Cent OS-5.2 설치 문서 GUI

커널 2.6으로 업그레이드!「A to Z」

리눅스서버 장애처리및 삭제파일 복구

CentOS 설치후 기본언어를 한국어로 바꾸기

리눅스에서 베드섹터 검사명령어

리눅스서버 응급복구와 삭제파일 복구

포트 포워딩 도구 ipmasqadm file

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234