S15v4l2rtspserver 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. /opt/wz_mini/bin/cmd video 0 on
  13. if [[ "$RTSP_HI_RES_ENABLE_AUDIO" == "true" ]]; then
  14. /opt/wz_mini/bin/cmd audio 0 on
  15. AUDIO_CH="-C 1"
  16. AUDIO_FMT="-a S16_LE"
  17. DEVICE1="$HI_VIDEO_DEV,hw:0,0"
  18. else
  19. DEVICE1="$HI_VIDEO_DEV"
  20. echo "rtsp audio disabled"
  21. fi
  22. else
  23. echo "rtsp disabled"
  24. fi
  25. if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]; then
  26. if [ -f /opt/wz_mini/tmp/.T20 ]; then
  27. LOW_VIDEO_DEV="/dev/video7"
  28. else
  29. LOW_VIDEO_DEV="/dev/video2"
  30. fi
  31. /opt/wz_mini/bin/cmd video 1 on
  32. if [[ "$RTSP_PASSWORD" = "" ]]; then
  33. RTSP_PASSWORD=$(cat /opt/wz_mini/tmp/wlan0_mac)
  34. fi
  35. if [[ "$RTSP_LOW_RES_ENABLE_AUDIO" == "true" ]]; then
  36. /opt/wz_mini/bin/cmd audio 1 on
  37. AUDIO_CH="-C 1"
  38. AUDIO_FMT="-a S16_LE"
  39. DEVICE2="$LOW_VIDEO_DEV,hw:2,0"
  40. else
  41. DEVICE2="$LOW_VIDEO_DEV"
  42. echo "rtsp audio disabled"
  43. fi
  44. else
  45. echo "rtsp disabled"
  46. fi
  47. if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]] || [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then
  48. echo "delay RTSP for iCamera"
  49. #This delay is required. Sometimes, if you start the rtsp server too soon, live view will break on the app.
  50. sleep 5
  51. 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 &
  52. sleep 1
  53. echo "Set imp variables via helper"
  54. /opt/wz_mini/usr/bin/imp_helper.sh > /dev/null 2>&1 &
  55. fi
  56. sync;echo 3 > /proc/sys/vm/drop_caches