Akamai Streaming
From fakedWiki
OS
- Install Ubuntu 12.04.1/Server amd64
- Add required packages
sudo apt-get -y install joe postfix screen dvb-apps build-essential mailutils build-essential git yasm checkinstall autoconf libtool libmp3lame-dev libmp3lame0 libfaac-dev libfaac0 libdvbpsi-dev libdvbpsi7 pkg-config libssl-dev
x264
cd ~ git clone --depth 1 git://git.videolan.org/x264 cd x264 ./configure --enable-static --enable-pic make -j 4 sudo checkinstall --pkgname=x264 --pkgversion="3:$(./version.sh | awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes --fstrans=no --default
AAC
cd ~ git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git cd fdk-aac autoreconf -fiv ./configure make -j 4 sudo checkinstall --pkgname=fdk-aac --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default
LibRTMP
cd ~ git clone https://github.com/mstorsjo/rtmpdump.git cd rtmpdump git checkout 883c33489403ed360a01d1a47ec76d476525b49e make -j4 sudo make install sudo ln -s /usr/local/lib/librtmp.so.0 /usr/lib/
LibAV (FFmpeg)
cd ~ git clone git://git.libav.org/libav.git cd libav ./configure --enable-gpl --enable-libfdk-aac --enable-libmp3lame --enable-libx264 --enable-nonfree --enable-version3 --enable-librtmp make -j 4 sudo checkinstall --pkgname=libav --pkgversion="5:$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default hash x264 avconv avprobe avserver apt-get remove librtmp
Publish to Akamai
RTMP / Flash
#!/bin/bash CROP_V=3 CROP_H=4 WIDTH=640 HEIGHT=352 INPUT="/dev/dvb/adapter0/dvr0" ########################## sudo /usr/local/bin/avconv \ -i ${INPUT} \ -c:a libfdk_aac \ -ab 128000 \ -ar 44100 \ -ac 2 \ -c:v libx264 \ -pre:v libx264-lossless_veryslow\ -pre:v libx264-main \ -filter:v "yadif,crop=in_w-2*${CROP_H}:in_h-2*${CROP_V},scale=${WIDTH}:${HEIGHT}" \ -f flv \ -aspect 16:9 \ "rtmp://b.ep12345.i.akamaientrypoint.net/EntryPoint conn=S:encoder:123.123.123.123:54321 live=true pubUser=***** pubPasswd=***** playpath=MyStream@12345flashver=FMLE/3.0\20(compatible;\20FMSc/1.0)"
Universal Streaming
#!/bin/bash HIGH_WIDTH=1280 HIGH_HEIGHT=720 MEDIUM_WIDTH=640 MEDIUM_HEIGHT=352 LOW_WIDTH=320 LOW_HEIGHT=176 CROP_V=8 CROP_H=12 ########################## INPUT="/dev/dvb/adapter0/dvr0" /usr/local/bin/avconv \ -i ${INPUT} \ -c:v libx264 -pre:v medium -profile:v high -level 32 -crf 28 -b:v 3584k -minrate 3584k -maxrate 3584k -bufsize 2048k \ -tune fastdecode -g 50 -refs 0 -r 25 -aspect 16:9 -threads auto \ -c:a libfdk_aac -ac 2 -ar 44100 -b:a 128k \ -filter:v "yadif,crop=in_w-2*${CROP_H}:in_h-2*${CROP_V},scale=${HIGH_WIDTH}:${HIGH_HEIGHT}" \ -f flv "rtmp://p.ep54321.i.akamaientrypoint.net/EntryPoint live=true pubUser=***** pubPasswd=***** playpath=MyStream_1_high@54321 flashver=FMLE/3.0\20(compatible;\20FMSc/1.0)" \ -c:v libx264 -pre:v medium -profile:v main -level 30 -crf 28 -b:v 1536k -minrate 1536k -maxrate 1536k -bufsize 1024k \ -tune fastdecode -g 50 -refs 0 -r 25 -aspect 16:9 -threads auto \ -c:a libfdk_aac -ac 2 -ar 44100 -b:a 96k \ -filter:v "yadif,crop=in_w-2*${CROP_H}:in_h-2*${CROP_V},scale=${MEDIUM_WIDTH}:${MEDIUM_HEIGHT}" \ -f flv "rtmp://p.ep54321.i.akamaientrypoint.net/EntryPoint live=true pubUser=***** pubPasswd=***** playpath=MyStream_1_medium@54321 flashver=FMLE/3.0\20(compatible;\20FMSc/1.0)" \ -c:v libx264 -pre:v medium -profile:v baseline -level 21 -crf 28 -b:v 256k -minrate 256k -maxrate 256k -bufsize 192k \ -tune fastdecode -g 50 -refs 0 -r 25 -aspect 16:9 -threads auto \ -c:a libfdk_aac -ac 1 -ar 44100 -b:a 64k \ -filter:v "yadif,crop=in_w-2*${CROP_H}:in_h-2*${CROP_V},scale=${LOW_WIDTH}:${LOW_HEIGHT}" \ -f flv "rtmp://p.ep54321.i.akamaientrypoint.net/EntryPoint live=true pubUser=***** pubPasswd=***** playpath=MyStream_1_low@54321 flashver=FMLE/3.0\20(compatible;\20FMSc/1.0)"