cam-to-udp.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. if [ $# -lt 1 ]; then
  3. echo "1/2 arg, target host (120,151?) [options]"
  4. echo "where options is a set of {proj,trat}"
  5. exit 1
  6. fi
  7. #HOST="$1"
  8. HOST="224.1.1.1"
  9. #shift
  10. set -e
  11. fps=24
  12. gop=$((fps*2))
  13. qp=12
  14. w=1296
  15. h=972
  16. w=800
  17. h=600
  18. roi="roi-x=0.00 roi-y=0 roi-w=1.00 roi-h=1.00"
  19. novideo="-n"
  20. PREVIEW="preview=0"
  21. while [ $# -gt 0 ]; do
  22. if [ "$1" == "proj" ]; then
  23. echo "proj!"
  24. novideo=""
  25. PREVIEW="preview=1 preview-encoded=0"
  26. fi
  27. if [ "$1" == "trat" ]; then
  28. echo "trat!"
  29. roitrat="roi-x=0.25 roi-y=0 roi-w=0.75 roi-h=0.75"
  30. roitrat="roi-x=0.35 roi-y=0 roi-w=0.65 roi-h=0.65"
  31. roi=$roitrat
  32. fi
  33. shift
  34. done
  35. #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 - |
  36. # gst-launch-1.0 -v -e fdsrc do-timestamp=1 ! h264parse ! rtph264pay config-interval=10 pt=96 ! udpsink host=$1 port=5000
  37. FORMAT="video/x-h264, width=$w, height=$h, framerate=24/1, profile=high"
  38. #annotation-mode=0x8
  39. rotation=180
  40. echo gst-launch-1.0 rpicamsrc rotation=$rotation $PREVIEW $roi bitrate=2000000 do-timestamp=true ! queue ! $FORMAT ! h264parse ! rtph264pay config-interval=1 ! udpsink host=$HOST auto-multicast=true port=5000
  41. gst-launch-1.0 rpicamsrc rotation=$rotation $PREVIEW $roi bitrate=2000000 do-timestamp=true ! queue ! $FORMAT ! h264parse ! rtph264pay config-interval=1 ! udpsink host=$HOST auto-multicast=true port=5000