Bite Bits/Raspberry Pi

Raspbian JESSIE 에서 ffmpeg 설치 (컴파일)

상영 2017. 8. 22. 16:22

며칠 전에 ffmpeg 를 대신해서 libav를 설치하여 사용했지만, Windows 용 ffmpeg 와 기능상의 차이가 약간 있고, (ffmpeg 가 조금 더 자세함?) Windows 의 결과와 호환성을 유지하기 위해서 raspbian 에서 ffmpeg 를 설치해보기로 함.


인터넷 검색을 통해서 대략의 설치 방법을 확인

소스 확보와 컴파일을 위해서 'git', 'build-essential' 이 두 패키지를 설치해야 한다고 나와서

우선 설치 여부를 확인해본다.


$ aptitude search git build-essential



이미 설치가 되어 있다. (aptitude search 명령에서 맨 앞의 문자가 'i' 일 경우 이미 설치되어 있는 것.)

The first character of each line indicates the current state of the package:

the most common states are 

p, meaning that no trace of the package exists on the system, 

c, meaning that the package was deleted but its configuration files remain on the system, 

i, meaning that the package is installed, and 

v, meaning that the package is virtual.


그럼.. mp4 파일을 이용하려면, h.264 코덱을 설치해야 한다는데.. 우선 패키지를 검색해보자.


$ aptitude search 264



x264 패키지가 video encoder 라네.. 이거 설치하면 될 것 같음.

(나중 : x264 말고 libx264-dev 패키지를 설치해야 한다.)


$ sudo aptitude install x264



그 담으로 mp3 를 위한 패키지 검색.


$ aptitude search mp3



libmp3lame0 (MP3 encoding library) 가 이미 설치되어 있다.

libmp3lame-dev 는 development 라는 꼬리표가 있는데.. 어떤 차이지??

일단 libmp3lame0 이 설치되어 있으니 libmp3lame-dev 는 설치하지 않고 패스~! 

필요하면 나중에 설치하지뭐.

(나중 : libmp3lame-dev 는 설치해야 한다.)


이제 ffmpeg 설치 ~!

git 을 이용해 clone 을 만들면 소스코드가 다운되어 지는데..


$ git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg


용량이 많네.. 210Mbyte 가 넘는다. 사실 소스코드의 변경내역까지는 필요없으니.

ffmpeg 다운로드 페이지로 가서 snapshot 을 다운받는 것이 더 빠르긴 할거다. (대략 10Mbyte )

어쨋든..  clone 했으니 다운받은 폴더로 가서 설정파일에 대해 확인한다.


$ cd ffmpeg

$ ./configure -h


설정에 신경쓰기 싫다면, 검색에서 찾을 수 있는 기본설정으로 처리한다.


$ ./configure --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree --enable-libmp3lame 

Licensing options:

  --enable-gpl             allow use of GPL code, the resulting libs

                              and binaries will be under GPL [no]

  --enable-version3        upgrade (L)GPL to version 3 [no]

  --enable-nonfree         allow use of nonfree code, the resulting libs

                              and binaries will be unredistributable [no]


음.. 위에서 libmp3lame-dev 설치 안한게 문제가 되나..

오류가 발생. 버전은 높은게 맞는데..



libmp3lame-dev 설치 후 다시 ./configure 진행


$ sudo aptitude install libmp3lame-dev



아까 설치한 x264 가 libx264-dev 와 다른 거였나.. libx264-dev 패키지 검색하고 이것도 설치.



$ sudo aptitude install libx264-dev


다시 설정 파일 실행. 이제야 정상이네. 


$ ./configure --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree --enable-libmp3lame 

$ make

$ sudo make install


컴파일이 꽤나 시간이 걸린다.

설치 완료되어 확인. 잘 되겠지..



/usr/local/bin/

/usr/local/share/ffmpeg/

폴더에 관련 파일 있음. lib 이나 다른데도 있겠지..

설치 로그 참고할것. 

install_ffmpeg.txt



* 참고 : http://blog.acidpop.kr/268

* ffmpeg 다운로드 : https://www.ffmpeg.org/download.html



install_ffmpeg.txt
0.01MB