Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. netcat -l 5001 | mplayer -fps 30 -cache 1024 - 2>&1 &
  2.  
  3. raspivid -fps 25 -w 640 -h 480 -t 0 -o - | nc 192.168.0.1 5001
  4.  
  5. #/bin/bash
  6.  
  7. PORT=51718
  8.  
  9. if [ "$#" -eq 1 ]
  10. then
  11. PORT=$1
  12. fi
  13.  
  14. while [ true ]
  15. do
  16. echo "Starting Video Server on port $PORT"
  17. IP_AND_PORT=$(nc -l $PORT)
  18. echo "Streaming to $IP_AND_PORT"
  19. raspivid -fps 25 -w 640 -h 480 -t 0 -o - | nc $IP_AND_PORT
  20. echo "Stream terminated"
  21. done
  22.  
  23. #!/bin/bash
  24.  
  25. if [ "$#" -ne 3 ]
  26. then
  27. echo " usage: client.sh pi_ip pi_video_server_port pi_video_stream_port"
  28. echo "example: client.sh 192.168.0.2 51718 5001"
  29. exit 1
  30. fi
  31.  
  32. OWN_IP=$(ip route get 8.8.8.8 | head -1 | cut -d' ' -f8)
  33. PI_IP=$1
  34. PI_VIDEO_SERVER_PORT=$2
  35. PI_VIDEO_STREAM_PORT=$3
  36.  
  37. echo "requesting stream to $OWN_IP:$PI_VIDEO_STREAM_PORT"
  38. # start mplayer which waits for a stream from the pi
  39. nc -l $PI_VIDEO_STREAM_PORT | mplayer -fps 30 -cache 1024 - 2>&1 &
  40. echo "$OWN_IP $PI_VIDEO_STREAM_PORT" | nc $PI_IP $PI_VIDEO_SERVER_PORT
  41.  
  42. while [ true ]
  43. do
  44. sleep 1s;
  45. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement