GoPro C/C++ Demos

2 minute read

GoPro Logo

This folder contains C and C++ examples to perform some Open GoPro functionality. There are two examples, each of which are detailed in a section below.

  1. Media Commands
  2. Stream Commands

Build

Requirements

This demo depends on the following external libraries:

  • libCurl: a client-side URL transfer library used to make command requests to the camera over WiFi and get the JSON response
  • cJSON: an ultra-light JSON parser that can be used to parse the JSON responses from the WiFi commands

To use the build system contained here, the following programs are required to be installed:

  • Conan: a python-based C / C++ package manager
    • If a local python 3 is found, this will be automatically installed
  • CMake: a project configuration and build tool

Steps

  1. Run the build.sh file. This will:
    • verify existence of requirements (and install Conan if applicable)
    • use Conan to download and install libCurl and cJson
    • use CMake to configure build system and build executables
  2. The output binaries will then be available in build/bin

Run

Requirements

Before running the executables built here, you must first be connected to the camera’s WiFi Access Point. This can be done via:

  1. Connect BLE to turn on AP and get WiFi SSID/PASSPHRASE
  2. Use retrieved WiFi SSID/PASSPHRASE to connect system to GoPro WiFi

A programmatic example of this process can be found in the Open GoPro Python SDK’s Connect Wifi Demo. This can be run (assuming a local Python 3.8.x installation exists) via:

pip install open-gopro
gopro-wifi

Steps

Media Commands

This demo shows one way to get the media list and download the first media file. It also supports requests to get the media list, media info and downloading specific media files.

For a list of possible commands, do:

$ ./build/bin/media_commands --help

Media List:

$ ./build/bin/media_commands <-l, --list_files>

Media List(Pretty Print):

$ ./build/bin/media_commands <-f, --list_files_pretty>

Media Info:

$ ./build/bin/media_commands <-i, --info> <camera_file_path>

Media Info(Pretty Print):

$ ./build/bin/media_commands <-p, --info_pretty> <camera_file_path>

Media Download:

$ ./build/bin/media_commands <-g, --download> <camera_file_path> <output_path/output_file_name>

Media Hilight Moment:

$ ./build/bin/media_commands --tag

Media Hilight File:

$ ./build/bin/media_commands --tag-video <video_file_path> <offset_ms>
$ ./build/bin/media_commands --tag-photo <photo_file_path>

Media Hilight Remove:

$ ./build/bin/media_commands --tag-video-remove <video_file_path> <offset_ms>
$ ./build/bin/media_commands --tag-photo-remove <photo_file_path>

Media Demo:

$ ./build/bin/media_commands <-d, --demo> <output_path>

Stream Commands

This demo demonstrates one way to start and stop the preview stream.

Note: To run the Preview Stream demo. A media player (i.e: VLC) that supports UDP is needed to view the preview stream. The UDP address is udp://0.0.0.0:8554

Start Stream:

$ ./build/bin/stream_commands <-s, --start>

Stop Stream:

$ ./build/bin/stream_commands <-e, --end>

Preview Stream Demo:

$ ./build/bin/stream_commands <-d, --demo>

Updated: