Guest User

externremux.sh ffmpeg

a guest
Aug 30th, 2016
228
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. #
  3. # externremux.sh
  4.  
  5. ### GENERAL CONFIG START
  6. ###
  7. # Pick one of DSL/WLAN
  8. QUALITY="LOW"
  9. ###
  10. ### GENERAL CONFIG END
  11.  
  12. case "$REMUX_VPID" in
  13. ''|0|1) CONTENTTYPE='audio/mpeg';;
  14. *) CONTENTTYPE='video/mpeg';;
  15. esac
  16.  
  17. QUALITY=${REMUX_PARAM_QUALITY:-$QUALITY}
  18. case "$QUALITY" in
  19. LOW|low) VBR=700K; ABR=64K; VSIZE=ega;;
  20. DSL|dsl) VBR=640K; ABR=64K; VSIZE=hd480;;
  21. WLAN|wlan) VBR=1500K; ABR=128K; VSIZE=hd480;;
  22. *) error "Unknown quality '$QUALITY'";;
  23. esac
  24. ABR=${REMUX_PARAM_ABR:-$ABR}
  25. VBR=${REMUX_PARAM_VBR:-$VBR}
  26. VSIZE=${REMUX_PARAM_VSIZE:-$VSIZE}
  27.  
  28. FPS=${REMUX_PARAM_FPS:-$FPS}
  29.  
  30. if [ "$SERVER_PROTOCOL" = HTTP ]; then
  31. echo -ne "Content-type: ${CONTENTTYPE}\r\n"
  32. echo -ne '\r\n'
  33. # abort after headers
  34. [ "$REQUEST_METHOD" = HEAD ] && exit 0
  35. fi
  36.  
  37. /home/server/bin/ffmpeg -f mpegts -i - \
  38. -filter:vf yadif -filter:v scale=${VSIZE} \
  39. -c:v libx264 -preset fast -crf 21 -maxrate ${VBR} -map 0:v:0? -deinterlace -bufsize 1024K -profile:v high -level 4.0 \
  40. -c:a aac -map 0:m:language:hun? -map -0:m:language:eng? -ignore_unknown -b:a ${ABR} -ar 44100 -ac 2 -async 50 -sn \
  41. ${FPS:+-r $FPS} \
  42. -f mpegts pipe:1
RAW Paste Data