SHARE
TWEET

External Encoder Bash Script

a guest Mar 18th, 2018 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. i="0"
  4.  
  5. while [ $i -lt 1 ]
  6. do
  7. read varSTDIN
  8.  
  9. case $varSTDIN in
  10. Version?)
  11.     echo "OK:1.0" >&2
  12. ;;
  13.  
  14. IsOpen?)
  15.     echo "OK:Open" >&2
  16. ;;
  17.  
  18. CloseRecorder)
  19.     echo "OK:Terminating" >&2
  20.     i="1"
  21. ;;
  22.  
  23. HasTuner?)
  24.     echo "OK:Yes" >&2
  25. ;;
  26.  
  27. XON)
  28.     echo "OK" >&2
  29. ;;
  30.  
  31. XOFF)
  32.     echo "OK" >&2
  33. ;;
  34.  
  35. SignalStrengthPercent?)
  36.     echo "OK:100" >&2
  37. ;;
  38.  
  39. HasLock?)
  40.     echo "OK:Yes" >&2
  41. ;;
  42.  
  43. FlowControl?)
  44.     echo "OK:XON/XOFF" >&2
  45. ;;
  46.  
  47. LockTimeout?)
  48.     echo "OK:9000" >&2
  49. ;;
  50.  
  51. StartStreaming)
  52.     echo "OK:Started" >&2
  53.     ffmpeg -hide_banner -loglevel panic -rtsp_transport tcp -i rtsp://192.168.1.168:554/hdmi -codec copy -f mpegts - &
  54.     ffmpeg_pid=$!
  55. ;;
  56.  
  57. StopStreaming)
  58.     kill $ffmpeg_pid
  59.     echo "OK:Stopped" >&2
  60. ;;
  61.  
  62. TuneChannel*)
  63.     ChanID="${varSTDIN:12}"
  64.     echo "OK:Changing Channel to $ChanID" >&2
  65.     echo "changing channel to $ChanID" >> greglog
  66.     if [ ${#ChanID} -eq 4 ]; then
  67.         irsend SEND_ONCE blaster KEY_`expr substr $ChanID 1 1`
  68.         irsend SEND_ONCE blaster KEY_`expr substr $ChanID 2 1`
  69.         irsend SEND_ONCE blaster KEY_`expr substr $ChanID 3 1`
  70.         irsend SEND_ONCE blaster KEY_`expr substr $ChanID 4 1`
  71.     else
  72.         irsend SEND_ONCE blaster KEY_`expr substr $ChanID 1 1`
  73.         irsend SEND_ONCE blaster KEY_`expr substr $ChanID 2 1`
  74.         irsend SEND_ONCE blaster KEY_`expr substr $ChanID 3 1`
  75.     fi
  76.  
  77. ;;
  78.  
  79. HasPictureAttributes?)
  80.     echo "OK:No" >&2
  81. ;;
  82.  
  83. BlockSize*)
  84.     echo "OK" >&2
  85. ;;
  86.  
  87. esac
  88.  
  89.  
  90. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top