I recently discovered that you can use a GoPro Hero 7 White as a remote webcam using a Python package called GoPro API for Python. This package can be found on GitHub at https://github.com/konradit/gopro-py-api.
To get started, you’ll need to install the package using the command pip3 install goprocam
and enable the WiFi connection on your GoPro.
Enabling the WiFi connection will activate a WiFi network created by the GoPro. Connect your computer to this network.
Now, you can write your Python program to interact with the GoPro webcam.
First, import GoProCamera
and constants
from goprocam
:
from goprocam import GoProCamera, constants
Next, call the GoProCamera.GoPro()
method to get a camera object:
gopro = GoProCamera.GoPro(constants.gpcontrol)
You can then use the gopro.overview()
method to get an overview of the camera status. This will print out information such as the current mode, video resolution, battery life, and more.
For example:
gopro.overview()
Here’s an example output:
camera overview
current mode: Photo
current submode: Burst
current video resolution: out of scope
current video framerate: 240
pictures taken: 0
videos taken: 0
videos left: 02:10:44
pictures left: 11257
battery left: Halfway
space left in sd card: 58.04GB
camera SSID: HERO7 White
Is Recording: Not recording - standby
Clients connected: 2
camera model: HERO7 White
firmware version: H18.02.02.10.00
serial number: C3343323864041
Once you have the camera object, you can use various methods to take actions with the GoPro.
For example, you can take a photo immediately by calling:
gopro.take_photo()
Or you can set a delay of 2 seconds before taking a photo:
gopro.take_photo(2)
To shoot a 10-second video, use:
gopro.shoot_video(10)
If you want to start recording without a preset end time, you can use:
gopro.shoot_video()
To download the last photo or video taken, you can call:
gopro.downloadLastMedia()
You can also provide a filename for the downloaded media:
gopro.downloadLastMedia("pic.JPG")
It’s worth noting that if you encounter a bug preventing you from downloading a picture using downloadLastMedia()
, you can try calling gopro.getStatusRaw()
before downloadLastMedia()
to fix the issue.
There are many other useful methods available, such as KeepAlive()
to prevent the GoPro from turning off, setZoom()
to set the zoom level, downloadAll()
to download all media from the camera, delete("last")
to delete the last media taken, delete("all")
to delete all media, power_off()
to power off the camera, and power_on()
to power on the camera. Additionally, there’s a stream()
method for starting the streaming function, although its usage is yet to be figured out.
For more examples, you can visit the GoPro API for Python GitHub repository, and additional documentation can be found here.
The GoPro camera is available at IP address 10.5.5.9
, with the MAC address AA:BB:CC:DD:EE:FF
.