A complete Python GoPro module made easy.
Works with HERO4 cameras and HERO5 cameras, HERO+ cameras may work too. Older cameras are not supported.
NOTE: This library is no longer maintained by @DenisCarriere - @KonradIT will be adding features from firmware updates and merging PRs. There is another python library goprohero which you can use too.
This library only works with Python 2, make sure you eitehr run this on a virtual env or on a python2 installation.
virtualenv -p /usr/bin/python2.7 /path/to/env/
source /path/to/env/bin/activate
Easy install with Github or PyPi
Installing the latest version from GitHub.
$ git clone https://github.com/DenisCarriere/gopro.git
$ cd gopro
$ python setup.py install
Installing the tested version from PyPi.
$ sudo pip install gopro
Once the installation is complete you are ready to start! :)
The default IP
address for the GoPro is using 10.5.5.9
.
You must first be connected to the GoProApp Wifi connection.
Launch your favorite ipython
or standard python
>>> from gopro import GoPro
>>> camera = GoPro.GoPro()
>>> camera.status
{'connection': 'OK',
'datetime': '2014-11-12T23:53:59',
'ip': '10.5.5.9',
'ok': True,
'screen': 'video',
'storage': '31.3 GB',
'time_offset': 'now'}
...
With very simple commands you can tell your GoPro to switch to the appropiate mode and start recording or take a photo.
The screen will automatically change to the approriate mode.
>>> camera.photo()
>>> camera.video()
>>> camera.timelapse()
Note, if you want to trigger the shutter button use camera.capture()
For video or timelapse you can stop the recording.
>>> camera.stop()
Makes it easy to cycle threw each available modes.
>>> camera.mode('video')
>>> camera.mode('photo')
>>> camera.mode('multishot)
...
Can't find your device?? Call the locate function and it will Beep endlessly until there is no more battery.
To turn off the beeps, simply press the mode
button on the device or use the off
as a parameter.
>>> camera.locate('on')
>>> camera.locate('off')
...
The camera will turn itself off, the Wi-Fi will still be active.
At the moment there is no working commands to turn the device back on.
To reactivate the device, press the mode
button.
>>> camera.sleep()
...
##Wake up
Turns the camera on (when WiFi is still active)
>>>camera.poweron()
...
Might be useful to dump all those photos from your GoPro.
Warning once you delete photos/videos you cannot retrieve them back.
The erase
function does the same as the delete all.
The delte_file
will delete a single file you specify
>>> camera.erase()
>>> camera.delete_all()
>>> camera.delete_last()
>>> camera.delete_file("100GOPRO","GOPR0665.JPG")
...
You can explore the different types of settings & status by getting the raw JSON response or selecting a specific pre-parsed attribute
Status - Screen
This will let you know which page your GP is currently active.
There are only 4 available outcomes.
>>> camera.status_screen
'settings'
'video'
'photo'
'timelapse'
...
The original response from the GoPro device.
>>> camera.settings_raw
>>> camera.status_raw
...
It is a good idea to sync your GoPro with the same clock as your computer.
An easy way to do this is use the datetime
& time_offset
attribute.
Try to aim your GoPro to have less than 1 second offset.
The time_offset
is measured in (+/-) seconds.
>>> camera.datetime
'2014-11-12 21:53:09'
>>> camera.datetime_offset
-0.320142
>>> camera.status['offset']
'now'
...
Here is how you can retrieve the total file storage in (KB) or pretty human readeable format.
>>> camera.status_storage
31330144
>>> camera.status['storage']
'31.3 GB'
Want to explore & troubleshoot the device a bit, you can retrieve the following properties from your device.
>>> camera.debug
>>> camera.info
>>> camera.commands
...
A big thanks to all the people who have helped contribute!
To be a contributor, please message me with requests on Twitter/Github issues
The MIT License (MIT)
Copyright (c) 2014-2017 Denis Carriere