cam-to-udp.sh 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/bash
  2. HOST="224.1.1.1"
  3. HOST="192.168.2.255"
  4. set -e
  5. fps=24
  6. gop=$((fps*2))
  7. qp=12
  8. w=1296
  9. h=972
  10. w=800
  11. h=600
  12. roi="roi-x=0.00 roi-y=0 roi-w=1.00 roi-h=1.00"
  13. bitrate=600000
  14. novideo="-n"
  15. PREVIEW="preview=0"
  16. while [ $# -gt 0 ]; do
  17. if [ "$1" == "proj" ]; then
  18. echo "proj!"
  19. novideo=""
  20. PREVIEW="preview=1 preview-encoded=0"
  21. fi
  22. if [ "$1" == "trat" ]; then
  23. echo "trat!"
  24. roitrat="roi-x=0.12 roi-y=0.12 roi-w=0.75 roi-h=0.75"
  25. roitrat="roi-x=0.25 roi-y=0.25 roi-w=0.50 roi-h=0.50"
  26. roitrat="roi-x=0.19 roi-y=0.19 roi-w=0.62 roi-h=0.62"
  27. roi=$roitrat
  28. fi
  29. shift
  30. done
  31. #raspivid $novideo -roi $roi -vs -ih -rot 125 -pf high -t 0 -awb fluorescent --brightness 55 -w $w -h $h -fps $fps -g $gop -qp $qp -o - |
  32. # gst-launch-1.0 -v -e fdsrc do-timestamp=1 ! h264parse ! rtph264pay config-interval=10 pt=96 ! udpsink host=$1 port=5000
  33. FORMAT="video/x-h264, width=$w, height=$h, framerate=24/1, profile=high"
  34. #annotation-mode=0x8
  35. rotation=180
  36. HOST="192.168.2.120:5000,192.168.2.155:5000,192.168.2.68:5000"
  37. echo gst-launch-1.0 rpicamsrc rotation=$rotation $PREVIEW $roi bitrate=$bitrate do-timestamp=true ! queue ! $FORMAT ! h264parse ! rtph264pay config-interval=1 ! multiudpsink clients=$HOST
  38. gst-launch-1.0 rpicamsrc rotation=$rotation $PREVIEW $roi bitrate=$bitrate do-timestamp=true ! queue ! $FORMAT ! h264parse ! rtph264pay config-interval=1 ! multiudpsink clients=$HOST
  39. #echo gst-launch-1.0 rpicamsrc rotation=$rotation $PREVIEW $roi bitrate=$bitrate do-timestamp=true ! queue ! $FORMAT ! h264parse ! rtph264pay config-interval=1 ! udpsink host=$HOST port=5000
  40. # gst-launch-1.0 rpicamsrc rotation=$rotation $PREVIEW $roi bitrate=$bitrate do-timestamp=true ! queue ! $FORMAT ! h264parse ! rtph264pay config-interval=1 ! udpsink host=$HOST port=5000
  41. #echo gst-launch-1.0 rpicamsrc rotation=$rotation $PREVIEW $roi bitrate=$bitrate do-timestamp=true ! queue ! $FORMAT ! h264parse ! rtph264pay config-interval=1 ! udpsink host=$HOST auto-multicast=true port=5000
  42. # gst-launch-1.0 rpicamsrc rotation=$rotation $PREVIEW $roi bitrate=$bitrate do-timestamp=true ! queue ! $FORMAT ! h264parse ! rtph264pay config-interval=1 ! udpsink host=$HOST auto-multicast=true port=5000