Advertisement
Guest User

Untitled

a guest
Jul 11th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1. #!/bin/bash
  2. #changes kipz-2 01/12/11
  3. # ./autopad_spaces.sh /full/path/to/media
  4. # make sure you are "priveleged" enough to write symlinks in the directory from which you are # running this script
  5.  
  6. channel="kingdomheartsforever"
  7. username=""
  8. password=""
  9.  
  10. moviePath=$1
  11.  
  12. x264Preset=$2
  13. if [ "$x264Preset" = "" ]; then
  14. x264Preset="faster"
  15. fi
  16.  
  17. ffprobe -show_streams "$moviePath" > /tmp/probetmp.txt
  18.  
  19. width=$(cat /tmp/probetmp.txt | grep width | sed 's/width=//')
  20. height=$(cat /tmp/probetmp.txt | grep height | sed 's/height=//')
  21.  
  22. echo $width
  23. echo $height
  24.  
  25. if [ "$(echo "scale=0; $width*3/4" | bc)" -gt "$height" ]; then
  26. #mode="widescreen"
  27. scaleFactor=$(echo "scale=0; $width*3/4" | bc)
  28. padTotal=$(echo "scale=0; $scaleFactor - $height" | bc)
  29. padPixel=$(echo "scale=0; $padTotal/2" | bc)
  30. #padString=" -padtop "$padPixel" -padbottom "$padPixel
  31. padString=" -vf pad="$width":"$scaleFactor":0:"$padPixel":black"
  32. else
  33. #mode="tallscreen"
  34. scaleFactor=$(echo "scale=0; $height*4/3" | bc)
  35. padTotal=$(echo "scale=0; $scaleFactor - $width" | bc)
  36. padPixel=$(echo "scale=0; $padTotal/2" | bc)
  37. #padString="-padleft "$padPixel" -padright "$padPixel
  38. padString=" -vf pad="$scaleFactor":"$height":"$padPixel":0:black"
  39. fi
  40.  
  41. echo $padTotal
  42. echo $scaleFactor
  43. echo $padPixel
  44. echo $x264Preset
  45.  
  46. #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"
  47. 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