Installing ffmpeg 3.3 on aws


#!/bin/sh

if [ "`/usr/bin/whoami`" != "root" ]; then
echo "You need to execute this script as root."
exit 1
fi

cat > /etc/yum.repos.d/centos.repo<<EOF
[centos]
name=CentOS-6 Base
baseurl=http://mirror.centos.org/centos/6/os/x86_64/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
enabled=1
priority=1
protect=1
includepkgs=SDL SDL-devel gsm gsm-devel libtheora theora-tools libdc1394 libdc1394-devel libraw1394-devel
EOF
rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

rpm -Uhv http://repository.it4i.cz/mirrors/repoforge/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
yum -y update

##didnt remove this from 2.2 install, may not be needed
rpm -Uhv ftp://195.220.108.108/linux/centos/6.9/os/x86_64/Packages/libraw1394-2.0.4-1.el6.i686.rpm
rpm -Uhv ftp://195.220.108.108/linux/centos/6.9/os/x86_64/Packages/libraw1394-2.0.4-1.el6.x86_64.rpm

##some of this is left over from 2.2 install remove anything critical if you are concerned
yum -y install glibc gcc gcc-c++ autoconf automake libtool git make nasm pkgconfig
yum -y install SDL-devel a52dec a52dec-devel alsa-lib-devel faac faac-devel faad2 faad2-devel
yum -y install freetype-devel giflib gsm gsm-devel imlib2 imlib2-devel lame lame-devel libICE-devel libSM-devel libX11-devel
yum -y install libXau-devel libXdmcp-devel libXext-devel libXrandr-devel libXrender-devel libXt-devel
yum -y install libogg libvorbis vorbis-tools mesa-libGL-devel mesa-libGLU-devel xorg-x11-proto-devel zlib-devel
yum -y install libtheora theora-tools
yum -y install ncurses-devel
yum -y install libdc1394 libdc1394-devel
yum -y install amrnb-devel amrwb-devel opencore-amr-devel
yum -y install bzip2 cmake make mercurial

rpm -Uhv http://www.nasm.us/pub/nasm/stable/linux/nasm-2.13.01-0.fc24.x86_64.rpm

mkdir ~/ffmpeg_sources

cd ~/ffmpeg_sources
curl -O http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar xzvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
make
make install

cd ~/ffmpeg_sources
git clone --depth 1 http://git.videolan.org/git/x264
cd x264
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static
make
make install
echo

cd ~/ffmpeg_sources
hg clone https://bitbucket.org/multicoreware/x265
cd ~/ffmpeg_sources/x265/build/linux
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source
make
make install
echo

cd ~/ffmpeg_sources
git clone --depth 1 https://github.com/mstorsjo/fdk-aac
cd fdk-aac
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
echo

cd ~/ffmpeg_sources
curl -L -O http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar xzvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasm
make
make install
echo

cd ~/ffmpeg_sources
curl -O https://archive.mozilla.org/pub/opus/opus-1.1.5.tar.gz
tar xzvf opus-1.1.5.tar.gz
cd opus-1.1.5
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install

cd ~/ffmpeg_sources
curl -O http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz
tar xzvf libogg-1.3.2.tar.gz
cd libogg-1.3.2
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
echo

cd ~/ffmpeg_sources
curl -O http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz
tar xzvf libvorbis-1.3.4.tar.gz
cd libvorbis-1.3.4
./configure --prefix="$HOME/ffmpeg_build" --with-ogg="$HOME/ffmpeg_build" --disable-shared
make
make install
echo

cd ~/ffmpeg_sources
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git
cd libvpx
./configure --prefix="$HOME/ffmpeg_build" --disable-examples --as=yasm
PATH="$HOME/bin:$PATH" make
make install
echo

cd ~/ffmpeg_sources
curl -O http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib -ldl" --bindir="$HOME/bin" --pkg-config-flags="--static" --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
make
make install
hash -r

cp $HOME/bin/* /usr/bin/
ffmpeg -version

Statsd(bucky) / graphite / grafana

graphite install
yum install -y gcc gcc-c++ libffi libffi-devel httpd24 httpd24-tools mysql-server mysql MySQL-python27 mod24_wsgi-python27 cairo-devel freetype* urw-fonts
pip install cairocffi pytz scandir

export PYTHONPATH=”/opt/graphite/lib/:/opt/graphite/webapp/”
pip install –no-binary=:all: https://github.com/graphite-project/whisper/tarball/master
pip install –no-binary=:all: https://github.com/graphite-project/carbon/tarball/master
pip install –no-binary=:all: https://github.com/graphite-project/graphite-web/tarball/master

export GRAPHITE_ROOT=/opt/graphite

vim $GRAPHITE_ROOT/webapp/graphite/local_settings.py
add —
DATABASES = {
‘default’: {
‘NAME’: ‘graphiteDB’,
‘ENGINE’: ‘django.db.backends.mysql’,
‘USER’: ‘graphite’,
‘PASSWORD’: ‘${PASSWORD}’,
‘HOST’: ‘localhost’,
‘PORT’: ‘3306’
}
}

sudo /etc/init.d/mysqld start
sudo /usr/bin/mysqladmin -u root password ‘${PASSWORD}!’
mysql -u root -p${PASSWORD}
CREATE USER ‘graphite’@’localhost’ IDENTIFIED BY ‘${PASSWORD}’;
GRANT ALL PRIVILEGES ON *.* TO graphite@’%’ IDENTIFIED BY ‘${PASSWORD}’;
GRANT ALL PRIVILEGES ON *.* TO graphite@’localhost’ IDENTIFIED BY ‘${PASSWORD}’;
FLUSH PRIVILEGES;
exit;
mysql -u graphite -p${PASSWORD}
create database graphiteDB;
exit;

PYTHONPATH=$GRAPHITE_ROOT/webapp django-admin.py migrate –settings=graphite.settings –run-syncdb
PYTHONPATH=$GRAPHITE_ROOT/webapp django-admin.py collectstatic –noinput –settings=graphite.settings

cp /opt/graphite/examples/example-graphite-vhost.conf /etc/httpd/conf.d/graphite-vhost.conf
vim /etc/httpd/conf.d/graphite-vhost.conf
add —
<Directory /opt/graphite/static/>
<IfVersion < 2.4>
Order deny,allow
Allow from all
</IfVersion>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
</Directory>

cp /opt/graphite/conf/graphite.wsgi.example /opt/graphite/conf/graphite.wsgi

cd /opt/graphite/conf
from .example
carbon.conf
storage-aggregation.conf
storage-schemas.conf

yum install collectd
sudo pip install bucky
sudo mkdir /etc/bucky
vim /etc/bucky/bucky.conf
add contents from https://github.com/trbs/bucky
add “/usr/share/collectd/types.db” to types.db list in /etc/bucky/bucky.conf

create init scripts for bucky and carbon

#!/bin/bash
# bucky Init script for running the bucky daemon
#
#
# chkconfig: – 98 02
#
# description: some description
# processname: bucky

PATH=/usr/bin:/sbin:/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
export PATH

lockfile=’/var/lock/subsys/bucky’
pidfile=’/var/run/bucky.pid’
bucky=’/usr/local/bin/bucky’
config=’/etc/bucky/bucky.conf’
logfile=’/var/log/bucky/bucky.log’

RETVAL=0

# Source function library.
. /etc/rc.d/init.d/functions

# Determine if we can use the -p option to daemon, killproc, and status.
# RHEL < 5 can’t.
if status | grep -q — ‘-p’ 2>/dev/null; then
pidopts=”-p $pidfile”
fi

start() {
echo -n $”Starting bucky daemon: ”
$bucky $config >> $logfile 2>&1 &
RETVAL=$?

local PID=`pgrep -f “${bucky} ${config}”`
echo $PID > ${pidfile}

[ $RETVAL -eq 0 ] && (touch ${lockfile}; echo_success) || echo_failure
echo

return $RETVAL
}

stop() {
echo -n $”Stopping bucky daemon: ”
killproc $pidopts $bucky
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f ${lockfile} ${pidfile}
}

restart() {
stop
start
}

rh_status() {
status $pidopts $bucky
RETVAL=$?
return $RETVAL
}

rh_status_q() {
rh_status >/dev/null 2>&1
}

case “$1″ in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
status)
rh_status
;;
*)
echo $”Usage: $0 {start|stop|restart|condrestart|try-restart|status}”
exit 1
esac

exit $RETVAL

yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.2.0-1.x86_64.rpm