Skip to main content

Open GoPro API and Examples

Project description

Open GoPro Python SDK

GoPro Logo

Build and Test Code style: black PyPI MIT License Coverage

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.

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.8 and < 3.12

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.resolution.set(Params.Resolution.RES_4K)
        await gopro.ble_setting.fps.set(Params.FPS.FPS_30)
        await gopro.ble_command.set_shutter(shutter=Params.Toggle.ENABLE)
        await asyncio.sleep(2) # Record for 2 seconds
        await gopro.ble_command.set_shutter(shutter=Params.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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

open_gopro-0.17.1.tar.gz (124.6 kB view details)

Uploaded Source

Built Distribution

open_gopro-0.17.1-py3-none-any.whl (157.7 kB view details)

Uploaded Python 3

File details

Details for the file open_gopro-0.17.1.tar.gz.

File metadata

  • Download URL: open_gopro-0.17.1.tar.gz
  • Upload date:
  • Size: 124.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.4 Linux/6.5.0-1025-azure

File hashes

Hashes for open_gopro-0.17.1.tar.gz
Algorithm Hash digest
SHA256 ea835a901c95a0b9822f7750f8a6b0a027ee9a358a650bc3a2726449ace10374
MD5 7641137ab352333f1fcc46e555e235ff
BLAKE2b-256 8c746996f5166d9fe9ee23a6a12942344604745e75a4f88cc6436de31444daca

See more details on using hashes here.

File details

Details for the file open_gopro-0.17.1-py3-none-any.whl.

File metadata

  • Download URL: open_gopro-0.17.1-py3-none-any.whl
  • Upload date:
  • Size: 157.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.4 Linux/6.5.0-1025-azure

File hashes

Hashes for open_gopro-0.17.1-py3-none-any.whl
Algorithm Hash digest
SHA256 36bc3633c60aec9768872b76d511f66d53e307ebacd6d0069548db82fff71ff5
MD5 c594aa9acabbdfc3d13166717a675d21
BLAKE2b-256 fda5e68609eb6e7fc5a111955f161a8378d240e23ab1d2b5e244636a22a9acc0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page