Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # 01/13/11
- # ./autopad_spaces.sh /full/path/to/media
- # make sure you are "priveleged" enough to write symlinks in the directory from which you are # running this script
- channel="kingdomheartsforever"
- username=""
- password=""
- moviePath=$1
- x264Preset=$2
- if [ "$x264Preset" = "" ]; then
- x264Preset="faster"
- fi
- ffprobe -show_streams "$moviePath" > /tmp/probetmp.txt
- width=$(cat /tmp/probetmp.txt | grep width | sed 's/width=//')
- height=$(cat /tmp/probetmp.txt | grep height | sed 's/height=//')
- echo "width: $width"
- echo "height: $height"
- if [ "$(echo "scale=0; (1000*$width*9)/($height*16)" | bc)" -ge "1000" ];then
- mode="widescreen"
- scaleFactor=$(echo "scale=0; $width*9/16" | bc)
- padTotal=$(echo "scale=0; $scaleFactor - $height" | bc)
- padPixel=$(echo "scale=0; $padTotal/2" | bc)
- #padString=" -padtop "$padPixel" -padbottom "$padPixel
- padString=" -vf pad="$width":"$scaleFactor":0:"$padPixel":black"
- else
- if [ "$(echo "scale=0; $width*3/4" | bc)" -gt "$height" ]; then
- mode="letterbox"
- scaleFactor=$(echo "scale=0; $width*3/4" | bc)
- padTotal=$(echo "scale=0; $scaleFactor - $height" | bc)
- padPixel=$(echo "scale=0; $padTotal/2" | bc)
- #padString=" -padtop "$padPixel" -padbottom "$padPixel
- padString=" -vf pad="$width":"$scaleFactor":0:"$padPixel":black"
- else
- mode="tallscreen"
- scaleFactor=$(echo "scale=0; $height*4/3" | bc)
- padTotal=$(echo "scale=0; $scaleFactor - $width" | bc)
- padPixel=$(echo "scale=0; $padTotal/2" | bc)
- #padString="-padleft "$padPixel" -padright "$padPixel
- padString=" -vf pad="$scaleFactor":"$height":"$padPixel":0:black"
- fi
- fi
- echo "Widescreen test number: $(echo "scale=0; (1000*$width*9)/($height*16)" | bc)"
- echo "scaleFactor: $scaleFactor"
- echo "mode: $mode"
- echo "padTotal: $padTotal"
- echo "padPixel: $padPixel"
- echo "x264Preset: $x264Preset"
- #ffmpeg -i "$moviePath" -re -acodec libmp3lame -ac copy -ar 44100 -vcodec libx264 -vpre $x264Preset -f flv $padString "rtmp://fme.mogulus.com/mogulus/$channel/username=$username/password=$password/isAutoLive=true/autoVOD=true/autoRecord=false app=mogulus/$channel/username=$username/password=$password/isAutoLive=true/autoRecord=false tcurl=rtmp://fme.mogulus.com/mogulus/$channel/username=$username/password=$password/isAutolive=true/autoRecord=false swfUrl=rtmp://publish.livestream.com/mogulus/$channel/username=$username/password=$password/isAutolive=true/autoRecord=false flashver=FME/2.5\20(compatible;\20FMSc/0.9) live=true"
- ffmpeg -i "$moviePath" -re -acodec libmp3lame -ar 44100 -ac 2 -vcodec libx264 -vpre $x264Preset -f flv $padString -threads 0 "rtmp://fme.mogulus.com/mogulus/$channel/username=$username/password=$password/isAutoLive=true/autoVOD=true/autoRecord=false app=mogulus/$channel/username=$username/password=$password/isAutoLive=true/autoRecord=false tcurl=rtmp://fme.mogulus.com/mogulus/$channel/username=$username/password=$password/isAutolive=true/autoRecord=false swfUrl=rtmp://publish.livestream.com/mogulus/$channel/username=$username/password=$password/isAutolive=true/autoRecord=false flashver=FME/2.5\20(compatible;\20FMSc/0.9) live=true"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement