Open GoPro Python SDK
This is a Python package that provides an interface for the user to exercise the Open GoPro Bluetooth Low Energy (BLE) and Wi-Fi / USB HTTP API's as well as install command line interfaces to take photos, videos, and view video streams.
- Free software: MIT license
- Documentation: View on Open GoPro
- View on Github
Documentation
Note! This README is only an overview of the package.
Complete documentation can be found on Open GoPro
Features
- Top-level GoPro class interface to use BLE, WiFi, and / or USB
- Cross-platform (tested on MacOS Big Sur, Windows 10, and Ubuntu 20.04)
- BLE implemented using bleak
- Wi-Fi controller provided in the Open GoPro package (loosely based on the Wireless Library
- Supports all commands, settings, and statuses from the Open GoPro API
- Asyncio based
- Automatically handles connection maintenance:
- manage camera ready / encoding
- periodically sends keep alive signals
- Includes detailed logging for each module
- Includes demo scripts installed as command-line applications to show BLE, WiFi, and USB functionality such as:
- Take a photo
- Take a video
- Configure and view a GoPro webcam stream
- GUI to send all commands and view the live / preview stream
- Log the battery
Installation
Note! This package requires Python >= 3.11 and < 3.14 and only supports GoPros that implement the OGP API
The minimal install to use the Open GoPro library and the CLI demos is:
$ pip install open-gopro
To also install the extra dependencies to run the GUI demos, do:
$ pip install open-gopro[gui]
Usage
To automatically connect to GoPro device via BLE and WiFI, set the preset, set video parameters, take a video, and download all files:
import asyncio
from open_gopro import WirelessGoPro, Params
async def main():
async with WirelessGoPro() as gopro:
await gopro.ble_setting.video_resolution.set(constants.settings.VideoResolution.NUM_4K)
await gopro.ble_setting.video_lens.set(constants.settings.VideoLens.LINEAR)
await gopro.ble_command.set_shutter(shutter=constants.Toggle.ENABLE)
await asyncio.sleep(2) # Record for 2 seconds
await gopro.ble_command.set_shutter(shutter=constants.Toggle.DISABLE)
# Download all of the files from the camera
media_list = (await gopro.http_command.get_media_list()).data.files
for item in media_list:
await gopro.http_command.download_file(camera_file=item.filename)
asyncio.run(main())
And much more!
Demos
Note! These demos can be found on Github
Demos can be found in the installed package in the "demos" folder. They are installed as a CLI entrypoint and can be run as shown below.
Command Line Interface (CLI) Demos
All of these demos are CLI only and can thus be run with the minimal (non-GUI) install.
Capture a photo and download it to your computer:
$ gopro-photo
Capture a video and download it to your computer:
$ gopro-video
Connect to the GoPro and log battery consumption in to a .csv:
$ gopro-log-battery
Connect to the GoPro's Wi-Fi AP and maintain the connection:
$ gopro-wifi
For more information on each, try running with help as such:
$ gopro-photo --help
usage: gopro-photo [-h] [-i IDENTIFIER] [-l LOG] [-o OUTPUT] [-w WIFI_INTERFACE]
Connect to a GoPro camera, take a photo, then download it.
optional arguments:
-h, --help show this help message and exit
-i IDENTIFIER, --identifier IDENTIFIER
Last 4 digits of GoPro serial number, which is the last 4 digits of the default camera SSID. If not used, first
discovered GoPro will be connected to
-l LOG, --log LOG Location to store detailed log
-o OUTPUT, --output OUTPUT
Where to write the photo to. If not set, write to 'photo.jpg'
-w WIFI_INTERFACE, --wifi_interface WIFI_INTERFACE
System Wifi Interface. If not set, first discovered interface will be used.
GUI Demos
These demos require the additional GUI installation.
Start the preview stream and view it:
$ gopro-preview-stream
Start the live stream and view it:
$ gopro-live-stream
Release files for open_gopro 0.22.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| open_gopro-0.22.0.tar.gz | 157.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| open_gopro-0.22.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 369.1 kB
Release files / open_gopro-0.22.0.tar.gz
| Download URL | open_gopro-0.22.0.tar.gz |
|---|---|
| Size | 157.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ecf8b4baed8ef0ab8c83d5673afee4dcea8ced942a82d1feec9a500967df703a
|
|
BLAKE2b-256 checksum How to use checksums |
b2d3c235aeeca6386d7a918df933feb05743a197309ecd410ed6a32d5ce4f1ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.12.3 Linux/6.11.0-1018-azure
|
Release files / open_gopro-0.22.0-py3-none-any.whl
| Download URL | open_gopro-0.22.0-py3-none-any.whl |
|---|---|
| Size | 212.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b55f4ecb549f3b71593a901e2b8d10eda84cfd1e7d9c8dd2719082d2000e0bc
|
|
BLAKE2b-256 checksum How to use checksums |
a3bf61eaaeea6b4227056492ab512b5254947bf1797b7275c758807e88bdd8ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.12.3 Linux/6.11.0-1018-azure
|