-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
Added webcam features #148
Conversation
Issues on MacOS 10.15.6 with Hero 8:
output:
but no stream is received. GP8 display shows "webcam" but not with red background, so I assume the UDP trigger was not sent. |
Update: GP8 works with manual IP and the following change: diff --git i/goprocam/GoProCamera.py w/goprocam/GoProCamera.py
index fc22130..453ca0b 100644
--- i/goprocam/GoProCamera.py
+++ w/goprocam/GoProCamera.py
@@ -76,7 +77,7 @@ class GoPro:
"""Sends keep alive packet"""
while True:
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
- sock.sendto("_GPHD_:0:0:2:0.000000\n".encode(),
+ sock.sendto("_GPHD_:1:0:2:0.000000\n".encode(),
(self.ip_addr, 8554))
time.sleep(2500/1000) diff --git i/examples/launch_webcam_preview.py w/examples/launch_webcam_preview.py
index 669a42b..4e0df8c 100644
--- i/examples/launch_webcam_preview.py
+++ w/examples/launch_webcam_preview.py
@@ -1,5 +1,7 @@
from goprocam import GoProCamera, constants
-gopro = GoProCamera.GoPro(ip_address=GoProCamera.GoPro.getWebcamIP())
+gopro = GoProCamera.GoPro(ip_address="172.28.128.51")
gopro.startWebcam(constants.Webcam.Resolution.R720p)
gopro.webcamFOV(constants.Webcam.FOV.Linear)
gopro.getWebcamPreview()
+gopro.KeepAlive() Update 2: poor man's python to reset the camera on ctrl+c/exit: diff --git i/examples/launch_webcam_preview.py w/examples/launch_webcam_preview.py
index 669a42b..a908dcf 100644
--- i/examples/launch_webcam_preview.py
+++ w/examples/launch_webcam_preview.py
@@ -1,5 +1,14 @@
+from signal import signal, SIGINT
from goprocam import GoProCamera, constants
-gopro = GoProCamera.GoPro(ip_address=GoProCamera.GoPro.getWebcamIP())
+
+def handler(s, f):
+ gopro.stopWebcam()
+ quit()
+
+signal(SIGINT, handler)
+
+gopro = GoProCamera.GoPro(ip_address="172.28.128.51")
gopro.startWebcam(constants.Webcam.Resolution.R720p)
gopro.webcamFOV(constants.Webcam.FOV.Linear)
gopro.getWebcamPreview()
+gopro.KeepAlive() |
Hi, I want to debug the issue where your I'll also fix the UDP keep alive issue. |
If you want, do a PR with the changes you made, and I'll review it and merge it. |
@KonradIT on macos the usb ethernet appears just as regular ethernet interface:
Replugging the camera does not provide the same IP nor the same mac address. Looks like dhcp is provided by the GoPro.
returns To me it looks like it's not possible to detect the right device just by IP address. To detect the model and the right trigger string, probably just a request to the status endpoint and parsing its JSON would be enough. |
* handle ctrl+c in example to stop webcam mode on the device on exit * Hero8 has a different keep alive payload.
…-api into master__webcam
Merging as it's pretty stable in my tests. I've been using this branch as my main branch for a week now to offload videos and photos using GoProDashboard and cannot go back to use an SD card reader or MTP connection. Webcam stream does have about 500ms-1000ms of lag in my testing. |
Thanks to @gurgelx for his webcam project.
Added: