如何使用libass / l-smash / x264 / fdk-aac

时间:2017-06-05 23:14:14

标签: docker ffmpeg alpine

我正在尝试使用依赖项构建静态二进制文件。它意味着:

  

错误:使用pkg-config

找不到libass

我正在关注https://github.com/zimbatm/ffmpeg-static/blob/master/build.sh作为示例

这是码头工人

git clone --depth 1 https://github.com/l-smash/l-smash \
    && git clone --depth 1 git://source.ffmpeg.org/ffmpeg \
    && git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git \
    && git clone --depth 1 https://github.com/mulx/aacgain.git \
    && git clone --depth 1 git://git.videolan.org/x264.git \
    && hg clone https://bitbucket.org/multicoreware/x265 \
    && git clone --depth 1 https://chromium.googlesource.com/webm/libvpx \
    && git clone --depth 1 git://git.opus-codec.org/opus.git \
    && git clone --depth 1 https://github.com/libass/libass.git

mkdir /usr/local/src/nasm
cd /usr/local/src/nasm
curl  http://www.nasm.us/pub/nasm/releasebuilds/2.13.01/nasm-2.13.01.tar.bz2 | tar -xj -C .
cd nasm-2.13.01
./configure --prefix=$TARGET_DIR --bindir=$BIN_DIR \
    && make  --quiet -j ${NUM_CORES} \
    && make  --quiet install

mkdir /usr/local/src/harfbuzz/
cd /usr/local/src/harfbuzz/
curl https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-1.4.6.tar.bz2 | tar -xj -C .
cd harfbuzz-1.4.6

./configure  --prefix=$TARGET_DIR  \
    && make  --quiet -j ${NUM_CORES} \
    && make  --quiet install

cd /usr/local/src/libass
./configure  --prefix=$TARGET_DIR --bindir=$BIN_DIR --enable-static --disable-shared \
    && make  --quiet -j ${NUM_CORES} \
    && make  --quiet install

# Build L-SMASH
# =================================
cd /usr/local/src/l-smash
./configure --prefix=$TARGET_DIR --bindir=$BIN_DIR \
    && make  --quiet -j ${NUM_CORES} \
    && make  --quiet install
# =================================

# Build libx264
# =================================
cd /usr/local/src/x264
./configure  --prefix=$TARGET_DIR --enable-static --disable-shared --disable-opencl --enable-pic \
    && make  --quiet -j ${NUM_CORES} \
    && make  --quiet install
# =================================


# Build libx265
# =================================
cd /usr/local/src/x265/build/linux
 cmake -G "Unix Makefiles"  -DCMAKE_INSTALL_PREFIX="$TARGET_DIR" -DENABLE_SHARED:bool=off ../../source
    make  --quiet -j ${NUM_CORES} \
    && make  --quiet install
# =================================

# Build libfdk-aac
# =================================
cd /usr/local/src/fdk-aac
autoreconf -fiv \
    && ./configure --prefix=$TARGET_DIR --disable-shared \
    && make  --quiet -j ${NUM_CORES} \
    && make  --quiet install
# # =================================

# # Build libvpx
# # =================================
# cd /usr/local/src/libvpx
# ./configure  --disable-examples --disable-unit-tests --enable-pic \
#     && make  --quiet -j ${NUM_CORES} \
#     && make  --quiet install
# # =================================

# # Build libopus
# # =================================
# cd /usr/local/src/opus
# ./autogen.sh \
#     && ./configure --disable-shared \
#     && make  --quiet -j ${NUM_CORES} \
#     && make  --quiet install
# =================================


# Build ffmpeg.
# =================================

#            --enable-libx265 - Remove until we can figure out compile error
cd /usr/local/src/ffmpeg
[ ! -f config.status ] && PATH="$BIN_DIR:$PATH" \
PKG_CONFIG_PATH="$TARGET_DIR/lib/pkgconfig" ./configure \
            --extra-libs="-ldl" \
            --prefix="$TARGET_DIR" \
            --pkg-config-flags="--static" \
            --extra-cflags="-I$TARGET_DIR/include" \
            --extra-ldflags="-L$TARGET_DIR/lib" \
            --extra-ldexeflags="-static" \
            --bindir="$BIN_DIR" \
            --enable-gpl \
            --enable-libass \
            --enable-libfdk-aac \
            --enable-libfontconfig \
            --enable-libfreetype \
            --enable-libfribidi \
            --enable-libmp3lame \
            --enable-libopus \
            --enable-libtheora \
            --enable-libvorbis \
            --enable-libvpx \
            --enable-libx264 \
            --enable-nonfree \
            --enable-postproc \
            --enable-pic \
            --enable-pthreads \
            --enable-shared \
            --disable-stripping \
            --disable-static \
    && make --quiet -j ${NUM_CORES} \
    && make --quiet install
# Remove all tmpfile

1 个答案:

答案 0 :(得分:0)

为什么要git克隆然后再下载源包?

libass默认构建静态库

libass要求您运行autogen.sh以生成配置脚本

尝试这样

git clone  https://github.com/libass/libass.git 
&& cd libass 
&& ./autogen.sh
&& ./configure 
&& make 
&& make install
&& pkg-config libass
&& cd ../

L-smash默认也会构建静态库

&& git clone https://github.com/l-smash/l-smash
&& cd l-smash
&& ./configure
&& make install
&& cd ../