Skip to content

Commit

Permalink
Statically link libx264 and libvpx if building them.
Browse files Browse the repository at this point in the history
  • Loading branch information
j0sh committed Jul 11, 2024
1 parent d9c78b6 commit d54b70d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ffmpeg/ffmpeg.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
pb "github.com/livepeer/lpms/ffmpeg/proto"
)

// #cgo pkg-config: libavformat libavfilter libavcodec libavutil libswscale
// #cgo pkg-config: --static libavformat libavfilter libavcodec libavutil libswscale
// #include <stdlib.h>
// #include "transcoder.h"
// #include "extras.h"
Expand Down
10 changes: 5 additions & 5 deletions install_ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ NPROC=${NPROC:-$(nproc)}
EXTRA_CFLAGS=""
EXTRA_LDFLAGS=""
EXTRA_X264_FLAGS=""
EXTRA_FFMPEG_FLAGS=""
EXTRA_FFMPEG_FLAGS="--pkg-config-flags=--static "
BUILD_TAGS="${BUILD_TAGS:-}"

# Build platform flags
Expand Down Expand Up @@ -154,13 +154,13 @@ if [[ ! -e "$ROOT/x264" ]]; then
fi

if [[ "$GOOS" == "linux" && "$BUILD_TAGS" == *"debug-video"* ]]; then
sudo apt-get install -y libnuma-dev cmake
sudo apt-get install -y cmake
if [[ ! -e "$ROOT/x265" ]]; then
git clone https://bitbucket.org/multicoreware/x265_git.git "$ROOT/x265"
cd "$ROOT/x265"
git checkout 17839cc0dc5a389e27810944ae2128a65ac39318
cd build/linux/
cmake -DCMAKE_INSTALL_PREFIX=$ROOT/compiled -G "Unix Makefiles" ../../source
cmake -DCMAKE_INSTALL_PREFIX=$ROOT/compiled -DENABLE_SHARED=off -DENABLE_CLI=off -DENABLE_LIBNUMA=off -G "Unix Makefiles" ../../source
make -j$NPROC
make -j$NPROC install
fi
Expand All @@ -169,7 +169,7 @@ if [[ "$GOOS" == "linux" && "$BUILD_TAGS" == *"debug-video"* ]]; then
git clone https://chromium.googlesource.com/webm/libvpx.git "$ROOT/libvpx"
cd "$ROOT/libvpx"
git checkout ab35ee100a38347433af24df05a5e1578172a2ae
./configure --prefix="$ROOT/compiled" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --enable-shared --as=nasm
./configure --prefix="$ROOT/compiled" --disable-examples --disable-unit-tests --disable-shared --enable-static --disable-install-bins --enable-vp9-highbitdepth --as=nasm
make -j$NPROC
make -j$NPROC install
fi
Expand All @@ -194,7 +194,7 @@ fi
if [[ $BUILD_TAGS == *"debug-video"* ]]; then
echo "video debug mode, building ffmpeg with tools, debug info and additional capabilities for running tests"
DEV_FFMPEG_FLAGS="--enable-muxer=md5,flv --enable-demuxer=hls --enable-filter=ssim,tinterlace --enable-encoder=wrapped_avframe,pcm_s16le "
DEV_FFMPEG_FLAGS+="--enable-shared --enable-debug=3 --disable-stripping --disable-optimizations --enable-encoder=libx265,libvpx_vp8,libvpx_vp9 "
DEV_FFMPEG_FLAGS+="--disable-shared --enable-debug=3 --disable-stripping --disable-optimizations --enable-encoder=libx265,libvpx_vp8,libvpx_vp9 "
DEV_FFMPEG_FLAGS+="--enable-decoder=hevc,libvpx_vp8,libvpx_vp9 --enable-libx265 --enable-libvpx --enable-bsf=noise "
else
# disable all unnecessary features for production build
Expand Down

0 comments on commit d54b70d

Please sign in to comment.