Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import threading
  4. import sys
  5. import time
  6. import pymysql
  7. import subprocess
  8. from random import randrange
  9.  
  10.  
  11. IP='192.168.1.250'
  12. HOST_IP='192.168.1.70'
  13. BITRATE='1000000'
  14. WIDTH='480'
  15. HEIGHT='320'
  16. port='20'
  17. def cam(port):
  18. port2=8000+port
  19. bashCommand = """gst-launch-1.0 rpicamsrc bitrate="""+BITRATE+""" hflip=true vflip=true sensor-mode=1 ! video/x-h264, width="""+WIDTH+""", height="""+HEIGHT+""", framerate=30/1 ! h264parse ! rtph264pay config-interval=5 pt=96 ! udpsink host="""+HOST_IP+""" port="""+str(port2)
  20.  
  21. output = subprocess.check_output(['bash','-c', bashCommand])
  22.  
  23.  
  24.  
  25. t2 = threading.Thread(target=cam, args=(port))
  26. t2.start()
  27. time.sleep(5)
  28. t2.stop()
  29. time.sleep(5)
  30. t2.start()
  31. #t.daemon = True
  32. #t2 = threading.Thread(target=cam)
  33. #t2.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement