S15v4l2rtspserver 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #!/bin/sh
  2. source /opt/wz_mini/wz_mini.conf
  3. if [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then
  4. if [ -f /opt/wz_mini/tmp/.T20 ]; then
  5. HI_VIDEO_DEV="/dev/video6"
  6. else
  7. HI_VIDEO_DEV="/dev/video1"
  8. fi
  9. if [[ "$RTSP_PASSWORD" = "" ]]; then
  10. RTSP_PASSWORD=$(cat /opt/wz_mini/tmp/wlan0_mac)
  11. fi
  12. echo "Enable video ch 0"
  13. /opt/wz_mini/bin/cmd video 0 on
  14. if [[ "$RTSP_HI_RES_ENABLE_AUDIO" == "true" ]]; then
  15. echo "Enable audio ch 0"
  16. /opt/wz_mini/bin/cmd audio 0 on
  17. AUDIO_CH="-C 1"
  18. AUDIO_FMT="-a S16_LE"
  19. DEVICE1="$HI_VIDEO_DEV,hw:0,0"
  20. else
  21. DEVICE1="$HI_VIDEO_DEV"
  22. echo "rtsp audio disabled"
  23. fi
  24. else
  25. echo "rtsp disabled"
  26. fi
  27. if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]; then
  28. if [ -f /opt/wz_mini/tmp/.T20 ]; then
  29. LOW_VIDEO_DEV="/dev/video7"
  30. else
  31. LOW_VIDEO_DEV="/dev/video2"
  32. fi
  33. echo "Enable video ch 1"
  34. /opt/wz_mini/bin/cmd video 1 on
  35. if [[ "$RTSP_PASSWORD" = "" ]]; then
  36. RTSP_PASSWORD=$(cat /opt/wz_mini/tmp/wlan0_mac)
  37. fi
  38. if [[ "$RTSP_LOW_RES_ENABLE_AUDIO" == "true" ]]; then
  39. echo "Enable video ch 1"
  40. /opt/wz_mini/bin/cmd audio 1 on
  41. AUDIO_CH="-C 1"
  42. AUDIO_FMT="-a S16_LE"
  43. DEVICE2="$LOW_VIDEO_DEV,hw:2,0"
  44. else
  45. DEVICE2="$LOW_VIDEO_DEV"
  46. echo "rtsp audio disabled"
  47. fi
  48. else
  49. echo "rtsp disabled"
  50. fi
  51. if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]] || [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then
  52. echo "delay RTSP for iCamera"
  53. #This delay is required. Sometimes, if you start the rtsp server too soon, live view will break on the app.
  54. sleep 5
  55. if [[ "$RTSP_AUTH_DISABLE" == "true" ]]; then
  56. LD_LIBRARY_PATH=/opt/wz_mini/lib /opt/wz_mini/bin/v4l2rtspserver $AUDIO_CH $AUDIO_FMT -F0 -P "$RTSP_PORT" $DEVICE1 $DEVICE2 &
  57. else
  58. LD_LIBRARY_PATH=/opt/wz_mini/lib /opt/wz_mini/bin/v4l2rtspserver $AUDIO_CH $AUDIO_FMT -F0 -U "$RTSP_LOGIN":"$RTSP_PASSWORD" -P "$RTSP_PORT" $DEVICE1 $DEVICE2 &
  59. fi
  60. sleep 1
  61. echo "Set imp variables via helper"
  62. /opt/wz_mini/usr/bin/imp_helper.sh > /dev/null 2>&1 &
  63. fi
  64. sync;echo 3 > /proc/sys/vm/drop_caches