Advertisement
Guest User

Untitled

a guest
Jul 11th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.11 KB | None | 0 0
  1. #!/bin/bash
  2. # 01/13/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: $width"
  23. echo "height: $height"
  24.  
  25. if [ "$(echo "scale=0; (1000*$width*9)/($height*16)" | bc)" -ge "1000" ];then
  26. mode="widescreen"
  27. scaleFactor=$(echo "scale=0; $width*9/16" | 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. if [ "$(echo "scale=0; $width*3/4" | bc)" -gt "$height" ]; then
  34. mode="letterbox"
  35. scaleFactor=$(echo "scale=0; $width*3/4" | bc)
  36. padTotal=$(echo "scale=0; $scaleFactor - $height" | bc)
  37. padPixel=$(echo "scale=0; $padTotal/2" | bc)
  38. #padString=" -padtop "$padPixel" -padbottom "$padPixel
  39. padString=" -vf pad="$width":"$scaleFactor":0:"$padPixel":black"
  40. else
  41. mode="tallscreen"
  42. scaleFactor=$(echo "scale=0; $height*4/3" | bc)
  43. padTotal=$(echo "scale=0; $scaleFactor - $width" | bc)
  44. padPixel=$(echo "scale=0; $padTotal/2" | bc)
  45. #padString="-padleft "$padPixel" -padright "$padPixel
  46. padString=" -vf pad="$scaleFactor":"$height":"$padPixel":0:black"
  47. fi
  48. fi
  49.  
  50. echo "Widescreen test number: $(echo "scale=0; (1000*$width*9)/($height*16)" | bc)"
  51. echo "scaleFactor: $scaleFactor"
  52. echo "mode: $mode"
  53. echo "padTotal: $padTotal"
  54. echo "padPixel: $padPixel"
  55. echo "x264Preset: $x264Preset"
  56.  
  57. #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"
  58. 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