Ubuntu 2x.04 编译FFmpeg 脚本

1. 将脚本放在 FFmpeg 元文件根目录

2. 编译结束后结果放该目录下的install文件夹中

#!/bin/bash

THIS_PATH=$(cd $(dirname $0); pwd)
BUILD_DIR=${1:-${THIS_PATH}/build}

INSTALL_DIR=${THIS_PATH}/install

#-----------------------------------------------------------------
# refer to https://packages.ubuntu.com/search?keywords=libdav1d-dev
# libdav1d-dev is supported since Ubuntu 22.04
#-----------------------------------------------------------------
# sudo apt install libunistring-dev libaom-dev libdav1d-dev
sudo apt install libgnutls28-dev libass-dev libmp3lame-dev libunistring-dev libaom-dev 
sudo apt install libfreetype-dev libopus-dev  libx264-dev libx265-dev
sudo apt-get install libfdk-aac-dev libsvtav* libvorbis-dev libvpx-dev

#-----------------------------------------------------------------
#-----------------------------------------------------------------

#wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \
#tar xjvf ffmpeg-snapshot.tar.bz2 && \
# cd ffmpeg && \
##  NUM_CORES=$(nproc) PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="${INSTALL_DIR}/lib/pkgconfig" ./
PKG_CONFIG_PATH="${INSTALL_DIR}/lib/pkgconfig" \
./configure \
  --prefix="${INSTALL_DIR}" \
  --pkg-config-flags="--static" \
  --extra-libs="-lpthread -lm" \
  --ld="g++" \
  --enable-shared \
  --enable-gpl \
  --enable-gnutls \
  --enable-libaom \
  --enable-libass \
  --enable-libfreetype \
  --enable-libmp3lame \
  --enable-libopus \
  --enable-libsvtav1 \
  --enable-libvorbis \
  --enable-libvpx \
  --enable-libdav1d \
  --enable-libx264 \
  --enable-libx265 \
  --enable-nonfree \
  && make -j$(nproc)

make install
  
  #   --enable-libfdkaac

你可能感兴趣的:(ubuntu,ffmpeg,linux)