Advertisement
Guest User

Untitled

a guest
Jul 11th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  1. #!/bin/bash
  2. #changes kipz 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. ln -s "$moviePath" lolspaces_P
  12.  
  13. x264Preset=$2
  14. if [ "$x264Preset" = "" ]; then
  15. x264Preset="faster"
  16. fi
  17.  
  18. ffprobe -show_streams lolspaces_P > /tmp/probetmp.txt
  19.  
  20. width=$(cat /tmp/probetmp.txt | grep width | sed 's/width=//')
  21. height=$(cat /tmp/probetmp.txt | grep height | sed 's/height=//')
  22.  
  23. echo $width
  24. echo $height
  25.  
  26. if [ "$width*3/4" -gt "$height" ]; then
  27. #mode="widescreen"
  28. scaleFactor=$(echo "scale=0; $width*3/4" | bc)
  29. padTotal=$(echo "scale=4; $scaleFactor - $height" | bc)
  30. padPixel=$(echo "scale=0; $padTotal/2" | bc)
  31. #padString=" -padtop "$padPixel" -padbottom "$padPixel
  32. padString=" -vf pad="$width":"$scaleFactor":0:"$padPixel":black"
  33. else
  34. #mode="tallscreen"
  35. scaleFactor=$(echo "scale=0; $height*4/3" | bc)
  36. padTotal=$(echo "scale=4; $scaleFactor - $width" | bc)
  37. padPixel=$(echo "scale=0; $padTotal/2" | bc)
  38. #padString="-padleft "$padPixel" -padright "$padPixel
  39. padString=" -vf pad="$scaleFactor":"$height":"$padPixel":0:black"
  40. fi
  41.  
  42. echo $padTotal
  43. echo $scaleFactor
  44. echo $padPixel
  45. echo $x264Preset
  46.  
  47. #ffmpeg -i lolspaces_P -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"
  48. ffmpeg -i lolspaces_P -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"
  49.  
  50. rm -rf lolspaces_P
  51.  
  52.  
  53. #notes
  54. # -padtop size
  55. # -padbottom size
  56. # -padleft size
  57. # -padright size
  58. # -padcolor hex_color
  59. # All the pad options have been removed. Use -vf pad=width:height:x:y:color instead.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement