|
@@ -57,19 +57,7 @@ def set_zoom(target):
|
|
|
videosrc.set_property("roi-h", zoom)
|
|
videosrc.set_property("roi-h", zoom)
|
|
|
time.sleep(0.03)
|
|
time.sleep(0.03)
|
|
|
|
|
|
|
|
-def add_client(c):
|
|
|
|
|
- if "192.168" not in c or ":" not in c:
|
|
|
|
|
- print("Invalid client! format is 192.168.Y.Z:XXXX")
|
|
|
|
|
- return
|
|
|
|
|
- cur_clients=sink.get_property("clients").split(",")
|
|
|
|
|
- print(cur_clients)
|
|
|
|
|
- if c in cur_clients:
|
|
|
|
|
- print("Client exists!")
|
|
|
|
|
- return
|
|
|
|
|
- cur_clients.append(c)
|
|
|
|
|
- strclients = ",".join(cur_clients)
|
|
|
|
|
- sink.set_property("clients", strclients)
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
def control():
|
|
def control():
|
|
|
FIFO="/tmp/picamfifo"
|
|
FIFO="/tmp/picamfifo"
|
|
|
if os.path.exists(FIFO):
|
|
if os.path.exists(FIFO):
|
|
@@ -97,9 +85,6 @@ def control():
|
|
|
if key == "zoom":
|
|
if key == "zoom":
|
|
|
set_zoom(float(val))
|
|
set_zoom(float(val))
|
|
|
|
|
|
|
|
- if key == "client" :
|
|
|
|
|
- add_client(val)
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if __name__ == "__main__":
|
|
|
if 'LD_LIBRARY_PATH' not in os.environ:
|
|
if 'LD_LIBRARY_PATH' not in os.environ:
|
|
@@ -108,8 +93,9 @@ if __name__ == "__main__":
|
|
|
# initialization
|
|
# initialization
|
|
|
Gst.init(None)
|
|
Gst.init(None)
|
|
|
|
|
|
|
|
- videocodec = "queue ! video/x-h264, width=%d, height=%d, framerate=25/1, profile=high ! h264parse ! rtph264pay mtu=1360 config-interval=1" % (WIDTH, HEIGHT)
|
|
|
|
|
- p = "rpicamsrc sensor-mode=4 do-timestamp=true name=src ! "+videocodec+" ! multiudpsink name=out"
|
|
|
|
|
|
|
+ videocodec = "video/x-h264, width=%d, height=%d, framerate=25/1, profile=high ! h264parse" % (WIDTH, HEIGHT)
|
|
|
|
|
+ p = "rpicamsrc sensor-mode=4 do-timestamp=true name=src ! "+videocodec+" ! matroskamux ! tcpserversink host=0.0.0.0 port=5000 sync-method=burst-keyframe"
|
|
|
|
|
+ print(p)
|
|
|
pipeline = Gst.parse_launch (p)
|
|
pipeline = Gst.parse_launch (p)
|
|
|
if pipeline == None:
|
|
if pipeline == None:
|
|
|
print ("Failed to create pipeline")
|
|
print ("Failed to create pipeline")
|
|
@@ -120,14 +106,11 @@ if __name__ == "__main__":
|
|
|
videosrc.set_property("preview-w", WIDTH)
|
|
videosrc.set_property("preview-w", WIDTH)
|
|
|
videosrc.set_property("preview-h", HEIGHT)
|
|
videosrc.set_property("preview-h", HEIGHT)
|
|
|
videosrc.set_property("fullscreen", False)
|
|
videosrc.set_property("fullscreen", False)
|
|
|
- videosrc.set_property("bitrate", 16000000)
|
|
|
|
|
|
|
+ # videosrc.set_property("bitrate", 16000000)
|
|
|
|
|
+ videosrc.set_property("bitrate", 25000000)
|
|
|
videosrc.set_property("rotation", 180)
|
|
videosrc.set_property("rotation", 180)
|
|
|
set_preview(0)
|
|
set_preview(0)
|
|
|
|
|
|
|
|
- sink = pipeline.get_by_name ("out")
|
|
|
|
|
- # sink.set_property("clients", ",".join(["192.168.2.120:5000", "192.168.2.21:5000", "192.168.2.84:5000"]))
|
|
|
|
|
- sink.set_property("clients", ",".join(["192.168.2.21:5000"]))
|
|
|
|
|
- print(sink.get_property("clients"))
|
|
|
|
|
|
|
|
|
|
# run
|
|
# run
|
|
|
pipeline.set_state(Gst.State.PLAYING)
|
|
pipeline.set_state(Gst.State.PLAYING)
|