-
Notifications
You must be signed in to change notification settings - Fork 434
Expand file tree
/
Copy pathbuild-deps
More file actions
executable file
·85 lines (73 loc) · 2.1 KB
/
build-deps
File metadata and controls
executable file
·85 lines (73 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#! /usr/bin/env bash
if [[ ! "$_PYAV_ACTIVATED" ]]; then
export here="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)"
source "$here/activate.sh"
fi
cd "$PYAV_ROOT"
# Skip the rest of the build if it already exists.
if [[ -e "$PYAV_LIBRARY_PREFIX/bin/ffmpeg" ]]; then
echo "We have a cached build of ffmpeg-$PYAV_LIBRARY; skipping re-build."
exit 0
fi
mkdir -p "$PYAV_LIBRARY_ROOT"
mkdir -p "$PYAV_LIBRARY_PREFIX"
# Add CUDA support if available
CONFFLAGS_NVIDIA=""
if [[ -e /usr/local/cuda ]]; then
# Get Nvidia headers for ffmpeg
cd $PYAV_LIBRARY_ROOT
if [[ ! -e "$PYAV_LIBRARY_ROOT/nv-codec-headers" ]]; then
git clone https://github.com/FFmpeg/nv-codec-headers.git
cd nv-codec-headers
make -j4
make PREFIX="$PYAV_LIBRARY_PREFIX" install
fi
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
CONFFLAGS_NVIDIA="--enable-cuda-nvcc \
--enable-nonfree \
--enable-libnpp \
--extra-cflags=-I/usr/local/cuda/include \
--extra-ldflags=-L/usr/local/cuda/lib64"
else
echo "WARNING: Did not find cuda libraries in /usr/local/cuda..."
echo " Building without NVIDIA NVENC/NVDEC support"
fi
cd "$PYAV_LIBRARY_ROOT"
# Download and expand the source.
if [[ ! -d $PYAV_LIBRARY ]]; then
url="https://ffmpeg.org/releases/$PYAV_LIBRARY.tar.gz"
echo Downloading $url
curl "$url" --output ${PYAV_LIBRARY}.tar.gz || exit 1
tar -xzf $PYAV_LIBRARY.tar.gz
rm $PYAV_LIBRARY.tar.gz
echo
fi
cd $PYAV_LIBRARY
echo ./configure
./configure \
--disable-doc \
--disable-static \
--disable-stripping \
--disable-libxml2 \
--disable-openssl \
--enable-debug=3 \
--enable-gpl \
--enable-version3 \
--enable-libx264 \
--enable-shared \
--enable-sse \
--enable-avx \
--enable-avx2 \
$CONFFLAGS_NVIDIA \
--prefix="$PYAV_LIBRARY_PREFIX" \
|| exit 2
echo
echo make
make -j4 || exit 3
echo
echo make install
make install || exit 4
echo
echo Build products:
cd ~
find "$PYAV_LIBRARY_PREFIX" -name '*libav*'