Created
January 3, 2012 18:08
-
-
Save metasta/1556118 to your computer and use it in GitHub Desktop.
install & upgrade ffmpeg
This file contains hidden or 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/sh - | |
############################################ | |
# | |
# build_ffmpeg.sh | |
# | |
# functions for install & upgrading ffmpeg. | |
# | |
# requires: | |
# sudo, aptitude, git-core, checkinstall | |
# | |
############################################ | |
# working dir (is equivalent to script dir) | |
basedir=$(cd $(dirname "$0");pwd) | |
download_x264() | |
{ | |
cd "$basedir" && git clone git://git.videolan.org/x264.git | |
return $? | |
} | |
update_x264() | |
{ | |
cd "$basedir/x264" && git pull | |
return $? | |
} | |
make_x264() | |
{ | |
# version of x264 in ubuntu package | |
epoch=$(aptitude versions -F '%p' x264 | sort -nr | head -n 1 | sed 's/:.*$//') | |
cd "$basedir/x264" \ | |
&& ./configure --enable-static --prefix=/usr \ | |
&& make \ | |
&& sudo checkinstall --pkgname=x264 \ | |
--pkgversion="$(expr $epoch + 1):$(./version.sh | \ | |
awk -F'[\" ]' '/POINT/{print $4"+git"$5}')" \ | |
--backup=no --default --deldoc=yes | |
return $? | |
} | |
download_ffmpeg() | |
{ | |
cd "$basedir" && git clone git://source.ffmpeg.org/ffmpeg.git | |
return $? | |
} | |
update_ffmpeg() | |
{ | |
cd "$basedir/ffmpeg" && git pull | |
return $? | |
} | |
make_ffmpeg() | |
{ | |
# version of ffmpeg in ubuntu package | |
epoch=$(aptitude versions -F '%p' ffmpeg | sort -nr | head -n 1 | sed 's/:.*$//') | |
cd "$basedir/ffmpeg" \ | |
&& ./configure --enable-gpl --enable-static --disable-shared \ | |
--enable-pthreads --enable-nonfree --enable-postproc \ | |
--enable-libx264 --enable-libfaac --enable-libmp3lame \ | |
--prefix=/usr \ | |
&& make \ | |
&& sudo checkinstall --pkgname=ffmpeg \ | |
--pkgversion="$(expr $epoch + 1):$(cat \ | |
RELEASE)$(./version.sh | sed 's/^.*-g//')" \ | |
--requires=x264,libmp3lame-dev,libfaac-dev \ | |
--backup=no --default --deldoc=yes | |
return $? | |
} | |
purge_conflicts_x264() | |
{ | |
sudo aptitude purge libx264-dev x264 | |
return $? | |
} | |
install_depends_x264() | |
{ | |
sudo aptitude install yasm | |
return $? | |
} | |
purge_conflicts_ffmpeg() | |
{ | |
sudo aptitude purge libavcodec-dev libavdevice-dev libavfilter-dev \ | |
libavformat-dev libavutil-dev libpostproc-dev libswscale-dev | |
return $? | |
} | |
install_depends_ffmpeg() | |
{ | |
sudo aptitude install yasm pkg-config libmp3lame-dev libfaac-dev | |
return $? | |
} | |
install_x264() | |
{ | |
if test -d "$basedir/x264/.git" | |
then | |
update_x264 || return $? | |
else | |
download_x264 || return $? | |
fi | |
purge_conflicts_x264 && install_depends_x264 && make_x264 | |
return $? | |
} | |
install_ffmpeg() | |
{ | |
if test -d "$basedir/ffmpeg/.git" | |
then | |
update_ffmpeg || return $? | |
else | |
download_ffmpeg || return $? | |
fi | |
purge_conflicts_ffmpeg && install_depends_ffmpeg && make_ffmpeg | |
return $? | |
} | |
main() | |
{ | |
install_x264 && install_ffmpeg | |
return $? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment