Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #######################################################################################
- ## By Erik Adler aka Onryo. ##
- ## This bash script will install the newest git of x264, VP8, ffmpeg & qt-faststart ##
- ## This is for Ubuntu Maverick 10.10 and Natty 11.04 ##
- ## License for this script is copyleft. ##
- ## Just change the name of the homepath where you want your gits to sit. ##
- #######################################################################################
- homepath=/home/Onryo/git-svn
- #######################################################################################
- # Where we are getting our sources from
- GITx264=git://git.videolan.org/x264.git
- GITffmp=git://git.videolan.org/ffmpeg.git
- GITvp8=git://review.webmproject.org/libvpx
- vp8presets=https://code.google.com/p/webm/downloads/list
- #######################################################################################
- clear
- depends=0
- cpu_threads=$(grep -c ^processor /proc/cpuinfo 2>/dev/null)
- if [ $# -eq 0 ]
- then
- echo
- echo " Install, Upgrading and Removing x264 and ffmpeg for Maverick & Natty"
- echo " --------------------------------------------------------------------"
- echo
- echo " [1] INSTALL x264 and FFmpeg. Makes A Clean Install"
- echo " [2] UPGRADE x264 and FFmpeg and Dependencies"
- echo " [3] Install FFmpeg's qt-faststart. Needs FFmpeg"
- echo " [4] REMOVE Everything This Program Has Installed"
- echo " [5] Exit"
- echo
- read pick
- fi
- # makes sure a interger from 1 to 5 is used.
- counter=1
- while [ $counter -eq 1 ]; do
- if [ $pick -lt 1 -o $pick -gt 5 2>/dev/null ] || ! [ $pick -eq $pick 2>/dev/null ]; then
- echo "Please enter 1-5 number ONLY"
- read pick
- counter=1
- else
- counter=0
- fi
- done
- clear
- ########################### x264 #################################
- ##################################################################
- # Checks it you have the newest version of x264 on your machine by
- # compairing with the x264 git server.
- cd $homepath/x264
- x264Remote=$(git ls-remote $GITx264 | grep -m 1 HEAD | sed -e s/HEAD//g -e 's/[[:space:]]//g')
- x264Local=$(git log | head | grep -m 1 commit | sed -e s/commit//g -e 's/[[:space:]]//g')
- cd
- ################ This will do a clean x264 install ################
- ###################################################################
- # Installs everthing needed for making x264 and clones the git.
- if [ $pick -eq 1 ]; then
- sudo apt-get update
- sudo apt-get -y remove ffmpeg x264 libx264-dev qt-faststart
- sudo apt-get -y install build-essential git checkinstall yasm texi2html libfaac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev zlib1g-dev
- cd $homepath
- git clone $GITx264
- cd $homepath/x264
- infox264="A clean install of x246 has been cloned to your system. System files installed. Git will be compiled in next step"
- fi
- ################ This will update x264 if needed ##################
- ###################################################################
- if [ $pick -eq 2 ] && [ "$x264Local" != "$x264Remote" ]; then
- sudo apt-get update
- sudo apt-get -y install build-essential git checkinstall yasm texi2html libfaac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev zlib1g-dev
- depends=1
- cd $homepath/x264
- make -j $cpu_threads clean
- git pull
- infox264="A new x264 was found and downloaded for upgrade. Sytems files upgraded. Git will be compiled in the next step"
- elif [ $pick -eq 2 ] && [ "$x264Local" == "$x264Remote" ]; then
- infox264="You already had the newest x264 git so it does not need to be downloaded or compiled"
- fi
- ############# Compiles and installs x264 if needed ################
- if [ $pick -eq 1 -o $pick -eq 2 ] && [ "$x264Local" != "$x264Remote" ]; then
- cd $homepath/x264
- ./configure
- make -j $cpu_threads
- sudo checkinstall --pkgname=x264 --pkgversion="3:$(./version.sh | awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes --fstrans=no --default
- makex264="x264 was compiled and installed on your system. The should only happen if you did not have the newest git already or did an install"
- fi
- ########################### VP8 ##################################
- ##################################################################
- # Checks it you have the newest version of VP8 on your machine by
- # compairing with the VP8 git server.
- cd $homepath/libvpx
- vp8Remote=$(git ls-remote $GITvp8 | grep -m 1 HEAD | sed -e s/HEAD//g -e 's/[[:space:]]//g')
- vp8Local=$(git log | head | grep -m 1 commit | sed -e s/commit//g -e 's/[[:space:]]//g')
- ##############" This will install VP8 encoding ####################
- ###################################################################
- if [ $pick -eq 1 ]; then
- sudo apt-get remove -y libvpx0 libvpx-dev
- cd $homepath
- git clone $GITvp8
- cd $homepath/libvpx
- infovp8="VP8 has be cloned for a fresh install. VP8 wil be compiled in the next step."
- fi
- ################# This will update VP8 if needed ##################
- ###################################################################
- cd $homepath/libvpx
- if [ $pick -eq 2 ] && [ "$vp8Remote" != "$vp8Local" ] && [ "$depends" == 0 ]; then
- sudo apt-get update
- sudo apt-get -y install build-essential git checkinstall yasm texi2html libfaac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev zlib1g-dev
- depends=1
- fi
- # This will clean the old VP8 build and then pull a new git to be
- # merged if VP8 needs to be updated.
- cd $homepath/libvpx
- if [ $pick -eq 2 ] && [ "$vp8Remote" != "$vp8Local" ]; then
- make -j $cpu_threads distclean
- git pull
- infovp8="A newer version of VP8 was found and downloaded. VP8 will be compiled in the next step."
- elif [ $pick -eq 2 ] && [ "$vp8Remote" == "$vp8Local" ]; then
- infovp8="You already have the newest VP8 git so it does not need to be downloaded or compiled"
- fi
- ######### This will compile and install VP8 if needed ###########
- cd $homepath/libvpx
- if [ $pick -eq 1 -o $pick -eq 2 ] && [ "$vp8Remote" != "$vp8Local" ]; then
- ./configure
- make -j $cpu_threads
- sudo checkinstall --pkgname=libvpx --pkgversion="1:$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default
- makevp8="VP8 has been compiled and installed on your system. This only happens if you had an old VP8 or did a fresh install"
- fi
- ############## This will install ffmpeg if needed #################
- ###################################################################
- # Checks it you have the newest version of x264 on your machine by
- # compairing with the x264 git server.
- cd $homepath/ffmpeg
- ffmpegRemote=$(git ls-remote $GITffmp | grep -m 1 HEAD | sed -e s/HEAD//g -e 's/[[:space:]]//g')
- ffmpegLocal=$(git log | head | grep -m 1 commit | sed -e s/commit//g -e 's/[[:space:]]//g')
- if [ $pick -eq 1 ]; then
- cd $homepath
- git clone $GITffmp
- cd $homepath/ffmpeg
- infoffmpeg="FFmpeg has been cloned for a fresh install. FFmpeg wil be compiled in the next step."
- fi
- ############### This will update ffmpeg if needed #################
- ###################################################################
- # This will make sure you don't upgrade the dev files needed if
- # x264 just did it during an upgrade. Looks at flag depends.
- if [ $pick -eq 2 ] && [ "$ffmpegRemote" != "$ffmpegLocal" ] && [ "$depends" == 0 ]; then
- sudo apt-get update
- sudo apt-get -y install build-essential git checkinstall yasm texi2html libfaac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev zlib1g-dev
- fi
- # This will clean the old ffmpeg build and then pull a new git to be
- # merged if ffmpeg needs to be updated.
- if [ $pick -eq 2 ] && [ "$ffmpegRemote" != "$ffmpegLocal" ]; then
- cd $homepath/ffmpeg
- make -j $cpu_threads distclean
- git pull
- infoffmpeg="A newer version of FFmpeg was found and downloaded. FFmpeg will be compiled in the next step."
- elif [ $pick -eq 2 ] && [ "$ffmpegRemote" == "$ffmpegLocal" ]; then
- infoffmpeg="You already have the newest FFmpeg git so it does not need to be downloaded or compiled"
- fi
- ######### This will compile and install ffmpeg if needed ###########
- if [ $pick -eq 1 -o $pick -eq 2 ] && [ "$ffmpegRemote" != "$ffmpegLocal" -o "$vp8Remote" != "$vp8Local" ]; then
- cd $homepath/ffmpeg
- # Configures, makes and installs ffmpeg for your system.
- ./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
- make -j $cpu_threads
- sudo checkinstall --pkgname=ffmpeg --pkgversion="5:$(./version.sh)" --backup=no --deldoc=yes --fstrans=no --default
- hash x264 ffmpeg ffplay ffprobe
- makeffmpeg="FFmpeg has been compiled and installed on your system. This only happens if you had an old ffmpeg or did a fresh install"
- fi
- ####### This will install ffmpegs qt-faststart if wanted ##########
- ###################################################################
- # Installs ffmpegs included tool qt-faststart. Allows web movies to
- # start playing before they are completely downloaded.
- if [ $pick -eq 3 ]; then
- cd $homepath/ffmpeg
- make -j $cpu_threads tools/qt-faststart
- sudo checkinstall --pkgname=qt-faststart --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default install -D -m755 tools/qt-faststart /usr/local/bin/qt-faststart
- qtfaststart="qt-faststart was compiled and installed."
- fi
- ####### Removes everything ffmpeg and x264 have installed #########
- ###################################################################
- if [ $pick -eq 4 ]; then
- echo "[y/n] Warning everything this program has installed will be removed"
- read confirm
- fi
- if [ $pick -eq 4 ] && [ "$confirm" == "y" -o "$confirm" == "Y" ]; then
- sudo apt-get autoremove x264 ffmpeg checkinstall yasm texi2html libfaac-dev libjack-jackd2-dev libmp3lame-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev libvpx libx11-dev libxfixes-dev libxvidcore-dev zlib1g-dev
- sudo rm -r $homepath/x264 $homepath/ffmpeg $homepath/libvpx
- elif [ $pick -eq 4 ] && [ "$confirm" != "y" -o "$confirm" != "Y" ]; then
- echo "Nothing was removed."
- exit 0
- fi
- ############################ Exits ################################
- ###################################################################
- # Exits program if 5 is picked.
- if [ $pick -eq 5 ]; then
- echo "Bye..."
- exit 0
- fi
- ########################## Feed Back ##############################
- ###################################################################
- if [ ! -d "$homepath/x264" ]; then
- x264Local="You don't have the x264 source code on your machine!"
- fi
- if [ ! -d "$homepath/ffmpeg" ]; then
- ffmpegLocal="You don't have the ffmpeg source code on your machine!"
- fi
- if [ ! -d "$homepath/libvpx" ]; then
- vp8Local="You don't have the VP8 source code on your machine!"
- fi
- echo ""
- echo " Report of what this script has done"
- echo " -----------------------------------"
- echo ""
- cd $homepath/x264
- x264Remote=$(git ls-remote $GITx264 | grep -m 1 HEAD | sed -e s/HEAD//g -e 's/[[:space:]]//g')
- x264Local=$(git log | head | grep -m 1 commit | sed -e s/commit//g -e 's/[[:space:]]//g')
- cd $homepath/ffmpeg
- ffmpegRemote=$(git ls-remote $GITffmp | grep -m 1 HEAD | sed -e s/HEAD//g -e 's/[[:space:]]//g')
- ffmpegLocal=$(git log | head | grep -m 1 commit | sed -e s/commit//g -e 's/[[:space:]]//g')
- cd $homepath/libvpx
- vp8Remote=$(git ls-remote $GITvp8 | grep -m 1 HEAD | sed -e s/HEAD//g -e 's/[[:space:]]//g')
- vp8Local=$(git log | head | grep -m 1 commit | sed -e s/commit//g -e 's/[[:space:]]//g')
- echo "Browse the x264 git source: http://git.videolan.org/?p=x264.git;a=summary"
- echo " $x264Remote Remote (git server) x264"
- echo " $x264Local Local (your machine) x264"
- cd $homepath/x264
- git log | head | grep -m 1 Date:
- echo ""
- echo "Browse the ffmpeg git source: http://git.videolan.org/?p=ffmpeg.git"
- echo " $ffmpegRemote Remote (git server) ffmpeg"
- echo " $ffmpegLocal Local (your machine) ffmpeg"
- cd $homepath/ffmpeg
- git log | head | grep -m 1 Date:
- echo ""
- echo "Browse the VP8 git source http://review.webmproject.org/gitweb?p=libvpx.git"
- echo " $vp8Remote Remote (git server) VP8"
- echo " $vp8Local Local (your machine) VP8"
- cd $homepath/libvpx
- git log | head | grep -m 1 Date:
- echo ""
- echo " $infox264"
- echo " $makex264"
- echo " $infoffmpeg"
- echo " $makeffmpeg"
- echo ""
- echo " $infovp8"
- echo " $makevp8"
- echo ""
- echo " $qtfaststart"
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement