Tinker Board 2 : FFmpeg 컴파일, 설치

OS/Tinker Board 2021. 3. 6. 01:36 Posted by 파란크리스마스

출처

기존에 설치되어 있는 ffmpeg 삭제, ffmpeg 컴파일 관련 패키지 설치

linaro@linaro-alip:~$ sudo apt-get remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
linaro@linaro-alip:~$ sudo apt-get update
linaro@linaro-alip:~$ sudo apt-get -y install autoconf automake build-essential checkinstall git libass-dev \
   libgpac-dev libopencore-amrnb-dev libopencore-amrwb-dev libspeex-dev \
   libtheora-dev libtool libvorbis-dev pkg-config texi2html zlib1g-dev

yasm 소스 다운로드, 컴파일

linaro@linaro-alip:~$ mkdir ~/workspace.ffmpeg 
linaro@linaro-alip:~$ cd ~/workspace.ffmpeg 
linaro@linaro-alip:~/workspace.ffmpeg$ wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
linaro@linaro-alip:~/workspace.ffmpeg$ tar xvfz yasm-1.3.0.tar.gz
linaro@linaro-alip:~/workspace.ffmpeg$ cd yasm-1.3.0/
linaro@linaro-alip:~/workspace.ffmpeg/yasm-1.3.0$ ./configure
linaro@linaro-alip:~/workspace.ffmpeg/yasm-1.3.0$ grep -c processor /proc/cpuinfo
6
linaro@linaro-alip:~/workspace.ffmpeg/yasm-1.3.0$ make -j6
linaro@linaro-alip:~/workspace.ffmpeg/yasm-1.3.0$ sudo make install

lame 소스 다운로드, 컴파일

linaro@linaro-alip:~/workspace.ffmpeg/yasm-1.3.0$ cd ~/workspace.ffmpeg
linaro@linaro-alip:~/workspace.ffmpeg$ wget http://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz
linaro@linaro-alip:~/workspace.ffmpeg$ tar xzvf lame-3.100.tar.gz && cd lame-3.100
linaro@linaro-alip:~/workspace.ffmpeg/lame-3.100$ ./configure && make -j6
linaro@linaro-alip:~/workspace.ffmpeg/lame-3.100$ sudo make install

faac 소스 다운로드, 컴파일 (ffmpeg가 최신버전의 경우 불필요한 라이브러리)

linaro@linaro-alip:~/workspace.ffmpeg/lame-3.100$ cd ~/workspace.ffmpeg
linaro@linaro-alip:~/workspace.ffmpeg$ wget https://sourceforge.net/projects/faac/files/faac-src/faac-1.29/faac-1.29.9.2.tar.gz 
linaro@linaro-alip:~/workspace.ffmpeg$ tar xzvf faac-1.29.9.2.tar.gz && cd faac-1.29.9.2
linaro@linaro-alip:~/workspace.ffmpeg/faac-1.29.9.2$ ./configure && make -j6
linaro@linaro-alip:~/workspace.ffmpeg/faac-1.29.9.2$ sudo make install

fdk-aac 소스 다운로드, 컴파일

linaro@linaro-alip:~/workspace.ffmpeg/faac-1.29.9.2$ cd ~/workspace.ffmpeg
linaro@linaro-alip:~/workspace.ffmpeg$ git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git
linaro@linaro-alip:~/workspace.ffmpeg$ cd fdk-aac/
linaro@linaro-alip:~/workspace.ffmpeg/fdk-aac$ autoreconf -fiv
linaro@linaro-alip:~/workspace.ffmpeg/fdk-aac$ ./configure --disable-shared
linaro@linaro-alip:~/workspace.ffmpeg/fdk-aac$ make -j6
linaro@linaro-alip:~/workspace.ffmpeg/fdk-aac$ sudo make install

H264 소스 다운로드, 컴파일

linaro@linaro-alip:~/workspace.ffmpeg/fdk-aac$ cd ~/workspace.ffmpeg
linaro@linaro-alip:~/workspace.ffmpeg$ git clone https://code.videolan.org/videolan/x264.git
linaro@linaro-alip:~/workspace.ffmpeg$ cd x264
linaro@linaro-alip:~/workspace.ffmpeg/x264$ ./configure --enable-static
linaro@linaro-alip:~/workspace.ffmpeg/x264$ make -j6
linaro@linaro-alip:~/workspace.ffmpeg/x264$ sudo make install

ffmpeg 소스 다운로드, 컴파일

linaro@linaro-alip:~/workspace.ffmpeg/x264$ cd ~/workspace.ffmpeg 
linaro@linaro-alip:~/workspace.ffmpeg$ git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
linaro@linaro-alip:~/workspace.ffmpeg$ cd ffmpeg
linaro@linaro-alip:~/workspace.ffmpeg/ffmpeg$ git log
commit 77ce903f7ad2619fb3f420fd3e7f7b778dcb7704
Author: James Almer <jamrial@gmail.com>
Date:   Wed Mar 3 18:05:15 2021 -0300
linaro@linaro-alip:~/workspace.ffmpeg/ffmpeg$ ./configure --extra-libs="-ldl" --enable-gpl --enable-libass --enable-libfdk-aac \
  --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libspeex --enable-libtheora \
  --enable-libvorbis --enable-libx264 --enable-nonfree --enable-version3 --extra-ldflags="-latomic" 
linaro@linaro-alip:~/workspace.ffmpeg/ffmpeg$ make -j6
linaro@linaro-alip:~/workspace.ffmpeg/ffmpeg$ sudo make install

ffmpeg 설치 버전 확인

linaro@linaro-alip:~/workspace.ffmpeg/ffmpeg$ ffmpeg -version
ffmpeg version N-101386-g77ce903f7a Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-version3 --extra-ldflags=-latomic
libavutil      56. 66.100 / 56. 66.100
libavcodec     58.128.100 / 58.128.100
libavformat    58. 70.100 / 58. 70.100
libavdevice    58. 12.100 / 58. 12.100
libavfilter     7.107.100 /  7.107.100
libswscale      5.  8.100 /  5.  8.100
libswresample   3.  8.100 /  3.  8.100
libpostproc    55.  8.100 / 55.  8.100

댓글을 달아 주세요