Unofficial Ruby GoPro API wrapper
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

GoPro Ruby API Wrapper

A unofficial Ruby API wrapper for controlling GoPro HERO cameras over WiFi.

Gem Version


From source

git clone
cd gopro-rb-api
gem build goprocam.gemspec
gem install goprocam.gemspec

From RubyGems

gem install goprocam

Supported cameras:

  • HERO4 Black, Silver
  • HERO4 Session
  • HERO5 Black, Session


  • HERO3/3+


First of all:

require '../lib/goprocam'
require '../lib/constants'


require 'goprocam'


gpCamera =
Code Explanation
gpControlCommand(X,Y) Sends a command to the camera, using GoPro constants
shutter(param) Starts a video or takes a picture
param=Shutter::ON or Shutter::OFF
camera_mode(X,Y) Changes the mode, X=Mode, Y=Submode (default is 0). Example: camera_mode(Mode::PhotoMode, Mode::SubMode::Photo::Single)
status_raw() Returns the status dump of the camera in json
status(X,Y) Returns the status.
  • X = Status::Status or Status::Settings
  • Y = status id (Status/Setup/Video/Photo/MultiShot).
  • NOTE: This returns the status of the camera as an integer. To get the value in a human form use parse_value()
parse_value(option, param) Parse the raw value of status and print a human value.
  • option="mode","sub_mode","recording","battery","video_res","video_fr","rem_space"
  • param = Status ID
overview() Prints a human-readable overview
info_camera(option) Returns camera information
option = Name/Number/Firmware/SSID/MacAddress/SerialNumber
delete() Can be: delete(last) or delete(all)
delete_file(folder,file) Deletes a specific file
hilight() HiLights a moment in the video recording
power_on() Powers the camera on. NOTE: run this to put your H4 Session into app mode first!
power_off() Powers the camera off
sync_time() Syncs the camera time to the computer's time
ap_setting(ssid,pass) Change SSID and Password of the camera. HERO5 not supported.
locate(param) Makes the camera beep. locate(Locate::Start) for start and locate(Locate::Stop) for stop.
reset() Reset camera (protune or flash factory setting)
get_media() returns the last media taken URL
dl_media() Downloads latest media taken
list_media() Outputs a prettified JSON media list
get_media_info(option) Gets the media info
livestream(param) Starts, restarts or stops the livefeed via UDP.


  • Get Status: You can get the current status for all aspects of the camera. Status messages are divided into sections:

    • Status
    • Settings

    See constants.rb file for the status and settings available. For settings, you can use any Setup/Video/Photo/MultiShot variable.

     gpCamera =
     puts gpCamera.status(Status::Status, Status::STATUS::Mode) #returns current mode
     puts gpCamera.status(Status::Status, Status::STATUS::IsRecording) #returns recording status
     puts gpCamera.status(Status::Settings, Video::FRAME_RATE) #returns frame rate
     puts gpCamera.status(Status::Settings, Photo::RESOLUTION)
     puts status(Status::Status, Status::STATUS::RemPhotos).to_s #some values do not need to be processed
     puts status(Status::Status, Status::STATUS::CamName) #This returns the camera SSID

    NOTE: This status returns an integer which can be later matched with a human description. That is:

     puts gpCamera.parse_value("mode",status(Status::Status, Status::STATUS::Mode))
     puts gpCamera.parse_value("sub_mode",status(Status::Status, Status::STATUS::SubMode))
     puts gpCamera.parse_value("video_res",status(Status::Settings, Video::RESOLUTION))
     puts gpCamera.parse_value("video_fr",status(Status::Settings, Video::FRAME_RATE))
     puts gpCamera.parse_value("video_left",status(Status::Status, Status::STATUS::RemVideoTime))
     puts gpCamera.parse_value("battery",status(Status::Status, Status::STATUS::BatteryLevel))
     puts gpCamera.parse_value("recording",status(Status::Status, Status::STATUS::IsRecording))

    If you want to get the raw status dump: gpCamera.status_raw()

  • Send a command: You can send a command to your camera wuth gpControlCommand, this way you can change settings.

     gpCamera =
     gpCamera.gpControlCommand(Multishot::BURST_RATE, Multishot::BurstRate::B5_1)
  • Shutter:

    You can start/stop a video or timelapse and take pictures.

     gpCamera =
     gpCamera.shutter(Shutter::ON) #takes a picture or starts a video
     gpCamera.shutter(Shutter::OFF) #stops a video or timelapse
  • Change Modes:

    Modes available are: video,photo,multishot

    Submodes available:

    • VideoMode: Video, Looping, TimeLapseVideo, VideoPhoto
    • PhotoMode: Single, Continuous, Night
    • MultiShotMode: Burst, TimeLapse, NightLapse

    NOTE: You can leave the submode empty and it will default to 0 (first submode in the mode).

     gpCamera =
     gpCamera.camera_mode(Mode::VideoMode, Mode::SubModes::Video::TimeLapseVideo) #includes submode
  • Get Last Media

    You can get the last media's URL and also download it to the working directory. Also you can get a list of all the files in the SD card.

     gpCamera =
     puts gpCamera.get_media() #outputs last media url
     gpCamera.dl_media() #downloads last media
     puts gpCamera.list_media() #lists camera media

For more examples see the examples folder

This API is based on goprowifihack - GoPro API docs.