Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GoPro Hero 8 USB live streaming url with opencv #183

Open
BrainGym opened this issue Oct 2, 2021 · 11 comments
Open

GoPro Hero 8 USB live streaming url with opencv #183

BrainGym opened this issue Oct 2, 2021 · 11 comments

Comments

@BrainGym
Copy link

BrainGym commented Oct 2, 2021

Hi, I wanted to broadcast from GoPro Hero 8 firmware 2.50 using USB and display live with opencv (windows 10)

I used ifaddr interface to get the IP address (work fine)

for adapter in ifaddr.get_adapters():
    if "GoPro" in adapter.nice_name:
        for ip in adapter.ips:
            if ip.is_IPv4:
                addr = ip.ip.split(".")
                addr[len(addr) - 1] = "51"
                addr = ".".join(addr)

then I used the IP address to wake up the gopro (goprocam 4.1.0)
gopro = GoProCamera.GoPro(ip_address=addr, camera=constants.gpcontrol)

image

I want to get the live streaming by using livestream("start") function, but I lost here, I get an error when I pass the address in opencv

cam= cv2.VideoCapture(addr)
_, frame = cam.read()
cv2.imshow('Image', frame)

error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'

I even tried with vlc with this url: http://IP_address/gp/gpControl/execute?p1=gpStream&c1=start
but nothing shows up

@KonradIT
Copy link
Owner

KonradIT commented Oct 2, 2021

You have to use a properly constructed UDP URI.

udp://%s:8554 % addr

@BrainGym
Copy link
Author

BrainGym commented Oct 2, 2021

u mean by using gopro.stream("udp adress") function?

@KonradIT
Copy link
Owner

KonradIT commented Oct 2, 2021

Nope. For stream function you have to provide your own addy.

@BrainGym
Copy link
Author

BrainGym commented Oct 4, 2021

Finally I figure it out
After waking up the camera, I must call the startWebcam() function, then use an udp address,
it work fine with opencv

gopro = GoProCamera.GoPro(ip_address=addr, camera=constants.gpcontrol)
gopro.startWebcam()
udp_addr = "udp://@{}:8554".format(addr)

@BrainGym BrainGym closed this as completed Oct 4, 2021
@BrainGym BrainGym reopened this Oct 4, 2021
@BrainGym
Copy link
Author

BrainGym commented Oct 4, 2021

Sorry @KonradIT another question, After calling the stopWebcam() function, the camera mantain on the ready mode is there in a function to put in normal mode or something ?

@KonradIT
Copy link
Owner

KonradIT commented Oct 4, 2021

What do you mean normal mode? You could try putting it in video/photo mode.

@BrainGym
Copy link
Author

BrainGym commented Oct 4, 2021

For you question I mean the mode that display usb connected on the camera screen
putting it in video mode, l will try that

@BrainGym
Copy link
Author

hi again @KonradIT
I wanted to connect two cameras GoPro using usb and stream each one independently unfortunately, I didn't get wat I expect, just look in the link below :
https://streamable.com/pp2ian
I get one stream for the both cameras

@KonradIT
Copy link
Owner

Yep, that happens when a system receives 2 UDP streams on the same port (albeit different IP addresses)

@BrainGym
Copy link
Author

BrainGym commented Oct 23, 2021

Can I use another port than 8554 ? or it's impossible

@KonradIT
Copy link
Owner

You could use an intermediary device, eg: raspberry pi to ingest via port 8554, and then output via a different port.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants