ubuntuでffmpegをコンパイルする
Ubuntuでffmpegをコンパイルする
公式サイトの指導:https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
ソースコードのダウンロード
ブランチの切り替え
リモートブランチを表示し、releaseバージョンの最新ブランチをローカルに切り替え、安定性のためにバグを少なくコンパイルするには、releaseバージョンの
現在のディレクトリにbinフォルダを作成し、インストールフォルダを最もコンパイルします.
インストール環境
libx 264のインストール
H.264 video encoder有効化configured構成が必要--enable-gpl--enable-libx 264
インストールlibx 265
H.265/HEVC video encoder.
libvpxのインストール
VP 8/VP 9 video encoder/decoder有効化にはconfigured構成が必要--enable-libvpx
libfdk-aac
AAC audio encoder. Requires ffmpeg to be configured with --enable-libfdk-aac (and --enable-nonfree if you also included --enable-gpl)
libmp3lame
MP3 audio encoder. Requires ffmpeg to be configured with --enable-libmp3lame.
libopus
Opus audio decoder and encoder. Requires ffmpeg to be configured with --enable-libopus.
libaom AV 1 video encoder/decoder:手動でffmpeg_にインストールbuildフォルダの下には、releaseバージョンのコンパイルインストールをダウンロードすることもできます.
コンフィギュレーション
静的ライブラリ、動的ライブラリ、相対ディレクトリ./binファイルにインストール
コンパイルとインストール
binフォルダにlibが生成された静的ライブラリと動的ライブラリ
公式サイトの指導:https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
ソースコードのダウンロード
git clone https://git.ffmpeg.org/gitweb/ffmpeg.git
ブランチの切り替え
リモートブランチを表示し、releaseバージョンの最新ブランチをローカルに切り替え、安定性のためにバグを少なくコンパイルするには、releaseバージョンの
git branch -a
git checkout -b remotes/origin/release/4.1
現在のディレクトリにbinフォルダを作成し、インストールフォルダを最もコンパイルします.
mkdir bin
インストール環境
sudo apt-get update -qq && sudo apt-get -y install \
autoconf \
automake \
build-essential \
cmake \
git-core \
libass-dev \
libfreetype6-dev \
libsdl2-dev \
libtool \
libva-dev \
libvdpau-dev \
libvorbis-dev \
libxcb1-dev \
libxcb-shm0-dev \
libxcb-xfixes0-dev \
pkg-config \
texinfo \
wget \
zlib1g-dev
sudo apt-get install nasm
sudo apt-get install yasm
libx 264のインストール
H.264 video encoder有効化configured構成が必要--enable-gpl--enable-libx 264
sudo apt-get install libx264-dev -y
インストールlibx 265
H.265/HEVC video encoder.
sudo apt-get install libx265-dev libnuma-dev -y
libvpxのインストール
VP 8/VP 9 video encoder/decoder有効化にはconfigured構成が必要--enable-libvpx
sudo apt-get install libvpx-dev -y
libfdk-aac
AAC audio encoder. Requires ffmpeg to be configured with --enable-libfdk-aac (and --enable-nonfree if you also included --enable-gpl)
sudo apt-get install libfdk-aac-dev -y
libmp3lame
MP3 audio encoder. Requires ffmpeg to be configured with --enable-libmp3lame.
sudo apt-get install libmp3lame-dev -y
libopus
Opus audio decoder and encoder. Requires ffmpeg to be configured with --enable-libopus.
sudo apt-get install libopus-dev -y
libaom AV 1 video encoder/decoder:手動でffmpeg_にインストールbuildフォルダの下には、releaseバージョンのコンパイルインストールをダウンロードすることもできます.
git -C aom pull 2> /dev/null || git clone --depth 1 https://aomedia.googlesource.com/aom && \
mkdir aom_build && \
cd aom_build && \
PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED=off -DENABLE_NASM=on ../aom && \
PATH="$HOME/bin:$PATH" make && \
make install
コンフィギュレーション
静的ライブラリ、動的ライブラリ、相対ディレクトリ./binファイルにインストール
./configure --prefix=./bin--enable-static --enable-shared
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="$HOME/ffmpeg_build" \
--pkg-config-flags="--static" \
--extra-cflags="-I$HOME/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--extra-libs="-lpthread -lm" \
--bindir="$HOME/bin" \
--enable-gpl \
--disable-libaom \
--enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-shared \
--enable-nonfree && \
PATH="$HOME/bin:$PATH" make -j 8 && \
make install && \
hash -r
コンパイルとインストール
#-j 8 , 。 ? ?
make -j 8
#
make install
binフォルダにlibが生成された静的ライブラリと動的ライブラリ
root@ubuntu:/home/hx/Downloads/ffmpeg/bin/lib# ls
libavcodec.a libavfilter.so.7 libswresample.a
libavcodec.so libavfilter.so.7.40.101 libswresample.so
libavcodec.so.58 libavformat.a libswresample.so.3
libavcodec.so.58.35.100 libavformat.so libswresample.so.3.3.100
libavdevice.a libavformat.so.58 libswscale.a
libavdevice.so libavformat.so.58.20.100 libswscale.so
libavdevice.so.58 libavutil.a libswscale.so.5
libavdevice.so.58.5.100 libavutil.so libswscale.so.5.3.100
libavfilter.a libavutil.so.56 pkgconfig
libavfilter.so libavutil.so.56.22.100