-
Notifications
You must be signed in to change notification settings - Fork 1
/
nix-install-ffmpeg
executable file
·155 lines (135 loc) · 5.05 KB
/
nix-install-ffmpeg
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/bin/sh
### Package: nix-install-ffmpeg
### Version: v20240504.2300
### Author: Michael Gan "xmixahlx" [email protected]
### License: GPLv3
### Script Dependencies: svt-hevc, x265, x264, vmaf, lensfun
## OVERRIDES
# NIXTOOLSDIR
if [ -z $NIXTOOLSDIR ]; then
NIXTOOLSDIR="`pwd`"
PATH=$NIXTOOLSDIR:$PATH
fi
# INSTALLDEPS
if [ -z $INSTALLDEPS ]; then
INSTALLDEPS=debian
fi
echo "*** INSTALLDEPS selected is $INSTALLDEPS."
# GITBRANCH
# Upstream branch is master
if [ -z $GITBRANCH ]; then
GITBRANCH=master
fi
echo "*** GITBRANCH selected is $GITBRANCH."
# CC
if [ -z $CC ]; then
CC="ccache gcc-14"
fi
echo "*** CC selected is $CC."
# CXX
if [ -z $CXX ]; then
CXX="ccache g++-14"
fi
echo "*** CXX selected is $CXX."
# CFLAGS
if [ -z $CFLAGS ]; then
CFLAGS="-O3 -march=native -B/usr/local/libexec/mold"
fi
echo "*** CFLAGS selected is $CFLAGS."
# CXXFLAGS
if [ -z $CXXFLAGS ]; then
CXXFLAGS="$CFLAGS"
fi
echo "*** CXXFLAGS selected is $CXXFLAGS."
# DESTDIR
if [ -z $DESTDIR ]; then
DESTDIR=/usr/local
fi
echo "*** DESTDIR selected is $DESTDIR."
# BUILDCONFIG
# Options are basic, standard, or full
if [ -z $BUILDCONFIG ]; then
BUILDCONFIG=full
fi
echo "*** BUILDCONFIG selected is $BUILDCONFIG."
## VARS
DATE=`date +%Y%m%d%H%M%S`
RESDIR=$NIXTOOLSDIR/resources
DEVDIR=$NIXTOOLSDIR/upstream
GITURL=https://github.com
GITREPO=ffmpeg
GITTREE=ffmpeg
PKGDIR=$GITTREE\_$GITBRANCH
## DEPS
# Provide INSTALLDEPS=debian to install dependencies.
if [ $INSTALLDEPS = debian ]; then
sudo apt-get -y build-dep ffmpeg
sudo apt-get -y install build-essential coreutils libc-bin wget tar bzip2 patch make \
libudev-dev libdrm-dev libvpl-dev
fi
## PREP
set -e
mkdir -p $DEVDIR
cd $DEVDIR
## GIT
[ -d $PKGDIR ] || git clone --recursive --depth=1 $GITURL/$GITREPO/$GITTREE.git --branch=$GITBRANCH $PKGDIR
cd $PKGDIR
git clean -dfx
git reset --hard HEAD
git pull
git submodule update --init --depth=1
## CONFIGURE
if [ $BUILDCONFIG = basic ]; then
echo "\n*** Using basic BUILDCONFIG.\n"
./configure --enable-pic --enable-shared --enable-vaapi --enable-libvpl \
--enable-avfilter --enable-postproc --enable-pthreads --enable-gpl \
--enable-nonfree --enable-version3 --prefix=/usr/local \
--libdir=/usr/local/lib/x86_64-linux-gnu --shlibdir=/usr/local/lib/x86_64-linux-gnu \
--cc="$CC" --cxx="$CXX" --extra-cflags="$CFLAGS" --extra-cxxflags="$CXXFLAGS" --enable-lto
fi
if [ $BUILDCONFIG = standard ]; then
echo "\n*** Using standard BUILDCONFIG.\n"
./configure --enable-pic --enable-shared --enable-vaapi --enable-libvpl --enable-libvmaf \
--enable-avfilter --enable-postproc --enable-pthreads --enable-gpl \
--enable-nonfree --enable-version3 --prefix=/usr/local \
--libdir=/usr/local/lib/x86_64-linux-gnu --shlibdir=/usr/local/lib/x86_64-linux-gnu \
--enable-avfilter --enable-gcrypt --enable-libass --enable-libbluray --enable-libdav1d \
--enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libmp3lame \
--enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse \
--enable-librsvg --enable-libspeex --enable-libsrt --enable-libtheora --enable-libtwolame \
--enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 \
--enable-libxml2 --enable-libxvid --enable-opengl --enable-openssl --enable-libx264 \
--cc="$CC" --cxx="$CXX" --extra-cflags="$CFLAGS" --extra-cxxflags="$CXXFLAGS" --enable-lto
fi
if [ $BUILDCONFIG = full ]; then
echo "\n*** Using full BUILDCONFIG.\n"
./configure --enable-pic --enable-shared --enable-vaapi --enable-libvpl --enable-libvmaf \
--enable-avfilter --enable-postproc --enable-pthreads --enable-gpl \
--enable-nonfree --enable-version3 --prefix=/usr/local \
--libdir=/usr/local/lib/x86_64-linux-gnu --shlibdir=/usr/local/lib/x86_64-linux-gnu \
--enable-avfilter --enable-gcrypt --enable-libass --enable-libbluray --enable-libdav1d \
--enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libmp3lame \
--enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse \
--enable-librsvg --enable-libspeex --enable-libsrt --enable-libtheora --enable-libtwolame \
--enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 \
--enable-libxml2 --enable-libxvid --enable-opengl --enable-openssl --enable-libx264 \
--enable-ladspa --enable-libaom --enable-libaribb24 --enable-libbs2b --enable-libcaca \
--enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfribidi \
--enable-libgme --enable-libgsm --enable-libilbc --enable-libjack --enable-libkvazaar \
--enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librubberband \
--enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtesseract --enable-libvidstab \
--enable-libvo-amrwbenc --enable-libwebp --enable-libzimg --enable-libzmq --enable-libzvbi \
--enable-lv2 --enable-openal --enable-opencl --enable-frei0r \
--enable-libiec61883 --enable-libdc1394 \
--cc="$CC" --cxx="$CXX" --extra-cflags="$CFLAGS" --extra-cxxflags="$CXXFLAGS" --enable-lto
fi
## CLEAN
make clean
## BUILD
make -j `nproc`
## INSTALL
sudo make install
sudo ldconfig
## EXIT
exit
## ENJOY