GoPro Hero5 livestream to desktop

Dider Kerckhof picture Dider Kerckhof · Mar 16, 2017 · Viewed 10.7k times · Source

I try to get a live stream from my new GoPro Hero5 to my desktop. This can be done for all the GoPro's until version 4.

But the Hero5 doesn't seem to support the http://10.5.5.9:8080/live/ URL

Any idea's how to do this with a GoPro Hero5?

Answer

Ben Delaney picture Ben Delaney · Mar 30, 2017

On Hero4 and newer you can start a UDP stream by getting this url:

http://10.5.5.9/gp/gpControl/execute?p1=gpStream&a1=proto_v2&c1=restart

This will open a UDP stream at:

udp://10.5.5.9:8554

Reading this stream is a little trickier. This Python script opens the stream using FFMPEG. Note the "keep alive" message this script sends at regular intervals: without these messages the camera will soon stop streaming.

I'm using elements of that script, along with an OpenCV VideoCapture object to programmatically access the stream from a Hero5 Session. The relevant code looks something like this:

cap = cv2.VideoCapture("udp://:8554", cv2.CAP_FFMPEG)
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
last_message = time.time()

while some_condition():

    # Get an image
    ret, img = cap.read()

    # Do something with img
    cv2.imshow("My Window", img)
    cv2.waitKey(1)

    # Keep alive.
    current_time = time.time()
    if current_time - last_message >= keep_alive_period/1000:
        logger.info("Sending keep alive message to %s.", self.host)
        sock.sendto(message, ("10.5.5.9", 8554))
        last_message = current_time

cv2.destroyWindow(window_name)
cap.release()

More info here.