Forked from drakeguan/bootstrap_for_encoding_server.sh
Created
December 11, 2015 01:09
-
-
Save maulvi/257f6b1773c824cf8647 to your computer and use it in GitHub Desktop.
Bash script to install latest version of ffmpeg, x264 and libvpx on Ubuntu 14.04 server
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/bash | |
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 14.04 | |
# Copyright @ 2014 Shuen-Huei (Drake) Guan <[email protected]> | |
# References: | |
# * https://gist.github.com/xdamman/e4f713c8cd1a389a5917 | |
# * https://blog.dlasley.net/2013/05/install-ffmpeg-from-source/ | |
# * http://fermat-little-theorem-blog.logdown.com/posts/203069-solved-when-building-gpac-suffer-usr-local-lib-libswscalea-error-adding-symbols-bad-value | |
# Variables | |
CPUNUM=$(nproc) # Get number of CPU cores for make -j | |
PREFIX=~/work | |
X264_HEAD=stable | |
FFMPEG_HEAD=n2.4.2 | |
GPAC_HEAD= | |
BENTO4_HEAD=1-4-2-569 | |
mkdir -p ${PREFIX} | |
# Modify source.list | |
# This sources.list file is for AWS usage only, please modify your own by un-commenting for multiverse. | |
wget https://gist.githubusercontent.com/drakeguan/de9701fad2fe862b97cd/raw/d67da91ed3fa91bf5b9284327d0c37955c723c52/sources.list | |
sudo cp sources.list /etc/apt/ | |
rm sources.list | |
# Update source list | |
sudo apt-get update | |
# Remove some existing but conflicting packages. | |
sudo apt-get -y remove ffmpeg x264 libav-tools libx264-dev | |
# Get the dependencies | |
sudo apt-get -y install git subversion unzip scons make pkg-config build-essential zlib1g-dev libfreetype6-dev libjpeg62-dev libpng12-dev libopenjpeg-dev libmad0-dev libfaad-dev libogg-dev libvorbis-dev libtheora-dev liba52-0.7.4-dev libxv-dev x11proto-video-dev libgl1-mesa-dev x11proto-gl-dev linux-sound-base libxvidcore-dev libssl-dev libjack-dev libasound2-dev libpulse-dev libsdl1.2-dev dvb-apps libmozjs185-dev libvpx-dev | |
sudo apt-get -y install autoconf automake build-essential libass-dev libmp3lame-dev libopus-dev libtheora-dev libtool libvorbis-dev texi2html libfaac-dev libfdk-aac-dev yasm checkinstall libopencore-amrnb-dev libopencore-amrwb-dev librtmp-dev | |
sudo apt-get -y install python-dev cython python-virtualenv python-pip libxml2-dev libxslt1-dev zlib1g-dev | |
# Installing x264 | |
cd ${PREFIX} | |
git clone git://git.videolan.org/x264 | |
cd x264/ | |
git checkout -b ${X264_HEAD} origin/${X264_HEAD} | |
./configure --enable-static --enable-shared | |
make -j${CPUNUM} | |
TEMP=$(./version.sh | awk -F'[" ]' '/POINT/{print $4"+git"$5}') | |
sudo checkinstall --pkgname=x264 --pkgversion="3:${TEMP}" --backup=no --deldoc=yes --fstrans=no --default | |
hash x264 | |
# Installing FFmpeg | |
cd ${PREFIX} | |
git clone --depth 1 --branch ${FFMPEG_HEAD} git://source.ffmpeg.org/ffmpeg | |
cd ffmpeg/ | |
./configure --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 | |
make -j${CPUNUM} | |
sudo checkinstall --pkgname=ffmpeg --pkgversion="5:$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default | |
hash ffmpeg ffplay ffprobe ffserver | |
# Optional: install qt-faststart | |
make tools/qt-faststart | |
sudo checkinstall --pkgname=qt-faststart --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default install -Dm755 tools/qt-faststart /usr/local/bin/qt-faststart | |
hash qt-faststart | |
# Installing GPAC | |
cd ${PREFIX} | |
git clone --depth 1 https://github.com/drakeguan/gpac.git | |
cd gpac/ | |
./run_configure.sh | |
make -j${CPUNUM} | |
sudo make install | |
#sudo checkinstall --pkgname=gpac2 --pkgversion="$(date +%Y%m%d%H%M)-svn" --backup=no --deldoc=yes --fstrans=no --default | |
########### checkinstall is not working here :( | |
hash DashCast MP4Box MP4Client | |
# Take care of MP4Client! | |
# Installing Bento4 | |
cd ${PREFIX} | |
wget http://sourceforge.net/projects/bento4/files/Bento4-SRC-1-4-2-569.zip | |
unzip Bento4-SRC-${BENTO4_HEAD}.zip | |
rm Bento4-SRC-${BENTO4_HEAD}.zip | |
cd Bento4-SRC-${BENTO4_HEAD} | |
scons -u build_config=Release | |
#cd Build/Targets/x86_64-unknown-linux | |
#make -j${CPUNUM} | |
cd Build/Targets/x86_64-unknown-linux/Release/ | |
sudo cp mp4* a* b* c* h* p* t* /usr/local/bin/ | |
sudo mv /usr/local/bin/mp4extract /usr/local/bin/mp4extract-bento | |
sudo cp lib* /usr/local/lib/ |
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/bash | |
# Bash script to initiate a working copy of videopass-encoding. | |
# This is a temporary solution. Something needs to be fixed later on: | |
# * Use auto-deployment instead of brutal copy of git repo. | |
# Copyright @ 2014 Shuen-Huei (Drake) Guan <[email protected]> | |
1. grab videopass-encoding repo on our gitlab.kkcorp. | |
2. put/upload the whole repo into ~ubuntu/videopass-encoding/ for each encoding server. | |
3. create a python virtualenv: `virtualenv ~/virenv` | |
4. source the virtualenv: `source ~/virenv/bin/activate` | |
5. `cd ~/videopass-encoding/` | |
6. `pip install -r requirements.txt` | |
7. do a test: `misc/local_test.sh` | |
8. check the result (under /tmp/videopass-encoding/) | |
1. dash 目錄大小 215M | |
2. hls 目錄大小 244M | |
3. mss 目錄大小 208M |
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
## Note, this file is written by cloud-init on first boot of an instance | |
## modifications made here will not survive a re-bundle. | |
## if you wish to make changes you can: | |
## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg | |
## or do the same in user-data | |
## b.) add sources in /etc/apt/sources.list.d | |
## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl | |
# | |
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to | |
# newer versions of the distribution. | |
deb http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty main | |
deb-src http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty main | |
## Major bug fix updates produced after the final release of the | |
## distribution. | |
deb http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates main | |
deb-src http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates main | |
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu | |
## team. Also, please note that software in universe WILL NOT receive any | |
## review or updates from the Ubuntu security team. | |
deb http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty universe | |
deb-src http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty universe | |
deb http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates universe | |
deb-src http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates universe | |
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu | |
## team, and may not be under a free licence. Please satisfy yourself as to | |
## your rights to use the software. Also, please note that software in | |
## multiverse WILL NOT receive any review or updates from the Ubuntu | |
## security team. | |
deb http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty multiverse | |
deb-src http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty multiverse | |
deb http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates multiverse | |
deb-src http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates multiverse | |
## Uncomment the following two lines to add software from the 'backports' | |
## repository. | |
## N.B. software from this repository may not have been tested as | |
## extensively as that contained in the main release, although it includes | |
## newer versions of some applications which may provide useful features. | |
## Also, please note that software in backports WILL NOT receive any review | |
## or updates from the Ubuntu security team. | |
# deb http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse | |
# deb-src http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse | |
## Uncomment the following two lines to add software from Canonical's | |
## 'partner' repository. | |
## This software is not part of Ubuntu, but is offered by Canonical and the | |
## respective vendors as a service to Ubuntu users. | |
# deb http://archive.canonical.com/ubuntu trusty partner | |
# deb-src http://archive.canonical.com/ubuntu trusty partner | |
deb http://security.ubuntu.com/ubuntu trusty-security main | |
deb-src http://security.ubuntu.com/ubuntu trusty-security main | |
deb http://security.ubuntu.com/ubuntu trusty-security universe | |
deb-src http://security.ubuntu.com/ubuntu trusty-security universe | |
deb http://security.ubuntu.com/ubuntu trusty-security multiverse | |
deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment