-
Notifications
You must be signed in to change notification settings - Fork 7
/
buildffmpeg.sh
executable file
·78 lines (58 loc) · 1.79 KB
/
buildffmpeg.sh
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
#!/bin/bash
set -e
CWD=$(pwd)
PACKAGES="$CWD/packages"
WORKSPACE="$CWD/workspace"
ADDITIONAL_CONFIGURE_OPTIONS=""
mkdir -p "$PACKAGES"
mkdir -p "$WORKSPACE"
FFMPEG_TAG="$1"
FFMPEG_URL="https://git.ffmpeg.org/gitweb/ffmpeg.git/snapshot/74c4c539538e36d8df02de2484b045010d292f2c.tar.gz"
FFMPEG_ARCHIVE="$PACKAGES/ffmpeg.tar.gz"
if [ ! -f "$FFMPEG_ARCHIVE" ]; then
echo "Downloading tag ${FFMPEG_TAG}..."
curl -L -k -o "$FFMPEG_ARCHIVE" "$FFMPEG_URL"
fi
EXTRACTED_DIR="$PACKAGES/extracted"
mkdir -p "$EXTRACTED_DIR"
echo "Extracting..."
tar -xf "$FFMPEG_ARCHIVE" --strip-components=1 -C "$EXTRACTED_DIR"
cd "$EXTRACTED_DIR"
echo "Building..."
# Min electron supported version
MACOS_MIN="10.10"
./configure $ADDITIONAL_CONFIGURE_OPTIONS \
--pkgconfigdir="$WORKSPACE/lib/pkgconfig" \
--prefix=${WORKSPACE} \
--pkg-config-flags="--static" \
--extra-cflags="-I$WORKSPACE/include -mmacosx-version-min=${MACOS_MIN}" \
--extra-ldflags="-L$WORKSPACE/lib -mmacosx-version-min=${MACOS_MIN}" \
--extra-libs="-lpthread -lm" \
--enable-static \
--disable-securetransport \
--disable-debug \
--disable-shared \
--disable-ffplay \
--disable-lzma \
--disable-doc \
--enable-version3 \
--enable-pthreads \
--enable-runtime-cpudetect \
--enable-avfilter \
--enable-filters \
--disable-libxcb \
--enable-gpl \
--disable-libass \
--enable-libx264 \
--extra-ldflags="-L/usr/local/opt/x264/lib" \
--extra-cflags="-I/usr/local/opt/x264/include"
make -j 4
make install
otool -L "$WORKSPACE/bin/ffmpeg"
otool -L "$WORKSPACE/bin/ffprobe"
echo "Building done. The binaries can be found here: $WORKSPACE/bin/ffmpeg $WORKSPACE/bin/ffprobe"
mkdir ffmpeg-mac/
cp -r "$WORKSPACE/bin/" "$CWD/ffmpeg-mac/"
rm -rf "$PACKAGES"
rm -rf "$WORKSPACE"
exit 0