Skip to content

Instantly share code, notes, and snippets.

@imhuwq
Last active November 9, 2019 06:40
Show Gist options
  • Save imhuwq/6978916f153be50bfb1c2dbb093c66a6 to your computer and use it in GitHub Desktop.
Save imhuwq/6978916f153be50bfb1c2dbb093c66a6 to your computer and use it in GitHub Desktop.
ubuntu 从源码编译 ffmpeg
apt-get update
# 一些常用工具包
apt-get install -y --no-install-recommends lsb-core net-tools dnsutils iputils-ping iftop htop telnet sudo openssh-server curl wget git vim locate
# 安装 ffmpeg 依赖
apt-get install -y --no-install-recommends autoconf automake build-essential cmake git-core libass-dev libfreetype6-dev
apt-get install -y --no-install-recommends libsdl2-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev
apt-get install -y --no-install-recommends libxcb-xfixes0-dev pkg-config texinfo wget zlib1g-dev
apt-get install -y --no-install-recommends nasm yasm libx264-dev libx265-dev libnuma-dev libvpx-dev libfdk-aac-dev libmp3lame-dev libopus-dev
# 编译 ffmpeg 4.2.1
wget https://download-public-imhuwq.oss-cn-shenzhen.aliyuncs.com/ffmpeg/ffmpeg.4.2.1.tar.gz
tar -xzvf ffmpeg.4.2.1.tar.gz
cd /root/ffmpeg && \
PATH="/usr/local/bin:$PATH" PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" ./configure \
--prefix="/usr/local" \
--pkg-config-flags="--static" \
--extra-libs="-lpthread -lm" \
--bindir="/usr/local/bin" \
--enable-gpl \
--enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-nonfree && \
PATH="/usr/local/bin:$PATH" make -j8 && \
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment