Created
February 5, 2015 23:14
-
-
Save yellowcrescent/126a5e7444c5ecf334b4 to your computer and use it in GitHub Desktop.
ffmpeg_builder_onodera.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# FFmpeg build script - jacob@ycnrg.org | |
# | |
# Updates code from git repo, runs configure, then fires off make | |
# | |
# Revision: 1 | |
# | |
PREFIX="/usr" | |
SRCBASE="/opt/src" | |
FFBASE="/opt/src/FFmpeg" | |
ASSBASE="/opt/src/libass" | |
X2BASE="/opt/src/x264" | |
FF_BUILD_ID=`hostname`_`date +%Y%m%d` | |
MJAY="-j`nproc`" | |
if [ "$1" == "nodeps" ]; then | |
BUILD_DEPS=0 | |
elif [ "$1" == "sysdeps" ]; then | |
echo "Installing system package dependencies with apt-get. Provide sudo pass if necessary" | |
sudo apt-get install libharfbuzz-dev libenca-dev libfribidi-dev libfreetype6-dev libpng12-dev libjpeg8-dev libcaca-dev libfaac-dev libfaad-dev libquvi-dev quvi libmp3lame-dev libvpx-dev libwebp-dev libspeex-dev libpulse-dev libxvidcore-dev | |
echo -en "\n\n** Done. Now re-run this script again, without the 'sysdeps' option.\n\n" | |
exit | |
else | |
BUILD_DEPS=1 | |
fi | |
if [ $BUILD_DEPS == 1 ]; then | |
echo -en "\e[36m\n\n" | |
echo "**************************************************************************************" | |
echo "***<onodera-auto-build>****** Preparing to build ffmpeg *******< jacob@ycnrg.org >****" | |
echo -en ">> \e[41m\e[37mIf build fails due to missing dependencies, try re-running with 'sysdeps' option\e[0m\e[36m <<\n" | |
echo "**************************************************************************************" | |
echo -en "\e[0m\n\n" | |
sleep 3 | |
echo "** Building fresh versions of key dependencies (use 'nodeps' arg to disable) **" | |
# Update ffmpeg & module friends (or clone their repo if they don't exist) | |
cd $SRCBASE | |
echo "Updating libass..." | |
if [ -d $ASSBASE ]; then | |
git -C $ASSBASE pull origin | |
else | |
git clone https://github.com/libass/libass.git | |
fi | |
echo "Updating libx264..." | |
if [ -d $X2BASE ]; then | |
git -C $X2BASE pull origin | |
else | |
git clone git://git.videolan.org/x264.git | |
fi | |
echo "Updating ffmpeg..." | |
if [ -d $FFBASE ]; then | |
git -C $FFBASE pull origin | |
else | |
git clone https://github.com/FFmpeg/FFmpeg.git | |
fi | |
# change to dir and do a `make clean` to get rid of the stale objs | |
# then run configure with our build args | |
### libass ### | |
cd $ASSBASE | |
if [ ! -f configure ]; then | |
./autogen.sh | |
fi | |
./configure \ | |
--prefix=$PREFIX | |
make $MJAY | |
echo -en "\n\n** Enter sudo password (if necessary) to install libass libraries on the system\n" | |
sudo make install | |
### libx264 ### | |
cd $X2BASE | |
./configure \ | |
--prefix=$PREFIX \ | |
--enable-shared \ | |
--enable-static | |
make $MJAY | |
echo -en "\n\n** Enter sudo password (if necessary) to install libx264 and x264 on the system\n" | |
sudo make install | |
fi | |
### ffmpeg ### | |
cd $FFBASE | |
./configure \ | |
--prefix=$PREFIX \ | |
--enable-libx264 \ | |
--enable-libass \ | |
--enable-fontconfig \ | |
--enable-libfreetype \ | |
--enable-gpl \ | |
--enable-nonfree \ | |
--enable-version3 \ | |
--enable-libquvi \ | |
--enable-libmp3lame \ | |
--enable-libvpx \ | |
--enable-libspeex \ | |
--enable-libwebp \ | |
--enable-libfaac \ | |
--enable-libcaca | |
echo "Detected `nproc` cores, running build with $MJAY" | |
make $MJAY && DOINSTALL=1 || echo "Build failed. Try re-running this script with the 'sysdeps' option to install necessary library packages if the build failed due to unmet dependencies. Also ensure libx264 and libass were compiled and installed properly in the preliminary steps." | |
if [ $DOINSTALL == 1 ]; then | |
sudo make install && echo -en "\n\n** GREAT SUCCESS! ffmpeg has been installed! Checking it now...\n\n`ffmpeg -version`\n\n" || echo "** Regretfully, the installation failed." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment