Skip to content

Instantly share code, notes, and snippets.

@paulmallon
Last active February 17, 2019 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulmallon/0725caa38d5887cc59b4dda389ce831e to your computer and use it in GitHub Desktop.
Save paulmallon/0725caa38d5887cc59b4dda389ce831e to your computer and use it in GitHub Desktop.
Gopro 4 Hero Silver and Black live stream via ffplay in powershell

Origial https://raw.githubusercontent.com/KonradIT/goprowifihack/master/HERO4/WifiCommands.md

Wifi Commands for HERO4

Cameras covered: GoPro HERO4 Black, Silver (Firmware HD4.02.05.00.00 Oct 2016) and Session (Firmware April 2016)

Important notes:

  • The HERO2/3/3+ commands also work with HERO4 but its not recommended to use them!**
  • HERO4 do not need any password in the URL
  • These protune commands ARE FOR HERO4 BLACK/SILVER only!! For HERO4 Session Protune commands, use the HERO4 Session doc

Basic controls:

Shutter
Default Boot Mode:
Primary modes:
Secondary modes:
Tag moment:
Locate:
Power:
  • Power Off: http://10.5.5.9/gp/gpControl/command/system/sleep
  • Power On: To power ON a HERO4 Black/Silver camera, use WoL with these parameters: MAC ADDRESS OF THE CAMERA, 10.5.5.9 as IP ADDRESS, Subnet Mask 255.255.255.0, Port 9. For the Hero4 Session, this magic packet has to be sent when your project wants to operate with the camera.
Code Pairing:

GoPro HERO4 cameras need a code authentication in order to connect to a device for the first time, this is done in the GoPro app when you firt connect your GoPro, a 4 digit PIN is displayed on the camera and that PIN needs to be entered in the GoPro app. Video explaining HERO4 pairing process

First make sure to connect go GOPRO-BP-(numbers) password: "goprohero" and call this URL:

https://10.5.5.9/gpPair?c=start&pin=XXXX&mode=0

XXXX is the 4 digit PIN on the GoPro front screen.

And to finish pairing:

https://10.5.5.9/gpPair?c=finish&pin=XXXX&mode=0

Set GoPro WiFi name/password:

GOPRONAME = GoPro new WiFi name

GOPROPASS = GoPro new WiFi password

Capture Mode settings:

Video:

Resolutions (HERO4 Black):
Resolutions (HERO4 Silver):
Resolutions (HERO4 Session):
Frame Rate (HERO4 Black/Session):
Frame Rate (HERO4 Silver):
FOV
Low Light:
Video Looping Duration:
Video+Photo Interval:
Video Timelapse Interval:
Spot Meter:
ProTune:
White Balance:
Color:
ISO Limit:
ISO Mode/Lock:
Sharpness:
Manual Video Exposure:

EV compensation is enabled ONLY in Auto mode.

EV Steps:
Value URL
+2 http://10.5.5.9/gp/gpControl/setting/15/0
+1.5 http://10.5.5.9/gp/gpControl/setting/15/1
+1 http://10.5.5.9/gp/gpControl/setting/15/2
+0.5 http://10.5.5.9/gp/gpControl/setting/15/3
0 http://10.5.5.9/gp/gpControl/setting/15/4
-0.5 http://10.5.5.9/gp/gpControl/setting/15/5
-1 http://10.5.5.9/gp/gpControl/setting/15/6
-1.5 http://10.5.5.9/gp/gpControl/setting/15/7
-2 http://10.5.5.9/gp/gpControl/setting/15/8

Photo:

Photo resolution for Photo Modes (incl. SubModes):
Exposure time for NightPhoto:
Spot Meter:
Continuous photo rate:
ProTune:
White Balance:
Color:
ISO Limit:
ISO Min:
Sharpness:
EV Steps:
Value URL
+2 http://10.5.5.9/gp/gpControl/setting/26/0
+1.5 http://10.5.5.9/gp/gpControl/setting/26/1
+1 http://10.5.5.9/gp/gpControl/setting/26/2
+0.5 http://10.5.5.9/gp/gpControl/setting/26/3
0 http://10.5.5.9/gp/gpControl/setting/26/4
-0.5 http://10.5.5.9/gp/gpControl/setting/26/5
-1 http://10.5.5.9/gp/gpControl/setting/26/6
-1.5 http://10.5.5.9/gp/gpControl/setting/26/7
-2 http://10.5.5.9/gp/gpControl/setting/26/8

MultiShot:

Exposure time for NightLapse:
Interval for NightLapse
Photo resolution for MultiShot Modes (incl. SubModes):
Timelapse Interval (TIMELAPSE MODE on MultiShot):
Spot Meter:
Burst Rate:
ProTune:
White Balance:
Color:
ISO Limit:
ISO Min:
Sharpness:
EV Steps:
Value URL
+2 http://10.5.5.9/gp/gpControl/setting/39/0
+1.5 http://10.5.5.9/gp/gpControl/setting/39/1
+1 http://10.5.5.9/gp/gpControl/setting/39/2
+0.5 http://10.5.5.9/gp/gpControl/setting/39/3
0 http://10.5.5.9/gp/gpControl/setting/39/4
-0.5 http://10.5.5.9/gp/gpControl/setting/39/5
-1 http://10.5.5.9/gp/gpControl/setting/39/6
-1.5 http://10.5.5.9/gp/gpControl/setting/39/7
-2 http://10.5.5.9/gp/gpControl/setting/39/8

General Camera Settings:

Orientation:
Quick Capture:
LED Blink:
Beeps:
Video Format:
LCD Display:
On Screen Display:
LCD Brightness:
LCD Lock:
LCD Timeout sleep:
Auto Off:
Set date and time

The hex string at the end is the same as for HERO3, so in the example: 11 = (20)17, 0b = 11 (November), 10 = 16, 11 = 17, 29 = 41, 2c = 44. Example bash code for date string, see ztzhang/GoProWifiCommand#3.

Streaming tweaks:

Stream BitRate :

Supports any number ( like 7000000), but limited by wifi throughput, packet loss and video glitches may appear. Correct parameter ID is 62!

Stream Window Size:

Sizes with 720 height are tested on Hero 5 Black.

WiFi AP Settings:

Media Commands:

Delete file:

http://10.5.5.9/gp/gpControl/command/storage/delete?p=file (eg. /100GOPRO/G0010124.JPG)

Delete Last media taken:

http://10.5.5.9/gp/gpControl/command/storage/delete/last

Reformat SD Card (CAUTION!):

http://10.5.5.9/gp/gpControl/command/storage/delete/all

Tag moment in video file:

http://10.5.5.9/gp/gpControl/command/storage/tag_moment/playback?p=XXXGOPRO/XXXXXX.MP4&tag=Miliseconds

XXXGOPRO is the folder, XXXXXX.MP4 is the video and Miliseconds are the miliseconds offset from the start of the video.

For example:

http://10.5.5.9/gp/gpControl/command/storage/tag_moment/playback?p=103GOPRO/GOPR1359.MP4&tag=2000

will make a HiLight Tag on 2 seconds of the video GOPR1359.MP4

Extracting a clip from a video (GoPro Clips): (Works on HERO4)

To start a video conversion:

http://10.5.5.9/gp/gpControl/command/transcode/request?source=DCIM/[XXXGOPRO]/GOPRXXXX.MP4&res=VIDEO_RESOLUTION&fps_divisor=FPS&in_ms=In_MS&out_ms=Out_MS

Parameters:

  • VIDEO_RESOLUTION:
    • 1080 = 0
    • 960 = 1
    • 720 = 2
    • WVGA = 3
    • 640p = 4
    • 432x240 (live preview resolution) = 5
    • 320x240 = 6
  • FPS: (Divide FPS by)
    • 1/1 = 0 (Leave it as is)
    • 1/2 = 1
    • 1/3 = 2
    • 1/4 = 3
    • 1/8 = 4

Output:

{"status":{"id":STATUS_ID,"source":"DCIM\XXXGOPRO\GOPRXXXX.MP4","status":0,"failure_reason":0,"estimate":1,"completion":0,"output":""}}

If you did it right.

status values:

  • 0 = Started
  • 1 = In Progress
  • 2 = Finished
  • 3 = Cancelled
  • 4 = Conversion failed

failure_reason values:

  • 0 = No fail
  • 1 = Bad file
  • 2 = Bad parameters
  • 3 = No space left on the device
  • 4 = Camera is busy converting something else

To get the status of a conversion:

http://10.5.5.9/gp/gpControl/command/transcode/status?id=STATUS_ID (from the previous command)

Output:

{"status":{"id":STATUS_ID,"source":"DCIM\XXXGOPRO\GOPRXXXX.MP4","status":2,"failure_reason":0,"estimate":1,"completion":0,"output":"DCIM/XXXGOPRO/GOPRXXXX.MP4"}}

You can now download the output url, add http://10.5.5.9/videos/ to it.

To cancel a conversion:

http://10.5.5.9/gp/gpControl/command/transcode/cancel?id=STATUS_ID

Bluetooth Pairing:

Allows the camera to be paired to a GoPro Bluetooth metadata device

Returns (example):

{
  "list_id": 1,
  "total": 1,
  "index": 0,
  "index_count": 1,
  "device_array": [
    {
      "address": "device_address",
      "address_type": 0,
      "rssi": -92,
      "name": "",
      "profile_uuid16": [
        "9ffe"
      ]
    },
    ...
  ]
}

Returns:


{"pairing_status":0}
$ffplay = "c:\Users\PM\Desktop\ffmpeg-4.1-win64-static\bin\ffplay.exe"
function Send-UdpDatagram {
Param ([string] $EndPoint,
[int] $Port,
[string] $Message)
$IP = [System.Net.Dns]::GetHostAddresses($EndPoint)
$Address = [System.Net.IPAddress]::Parse($IP)
$EndPoints = New-Object System.Net.IPEndPoint($Address, $Port)
$Socket = New-Object System.Net.Sockets.UDPClient
$EncodedText = [Text.Encoding]::ASCII.GetBytes($Message)
$Socket.Send($EncodedText, $EncodedText.Length, $EndPoints)
$Socket.Close()
}
# Set stream bitrate
invoke-webrequest "http://10.5.5.9/gp/gpControl/setting/62/1000000"
# Set preview size 240p 4:3
invoke-webrequest "http://10.5.5.9/gp/gpControl/setting/64/2"
# Restart stream
invoke-webrequest "http://10.5.5.9/gp/gpControl/execute?p1=gpStream&a1=proto_v2&c1=restart" -ErrorAction SilentlyContinue;
# Start ffplay
Start-Process $ffplay -ArgumentList "-fflags nobuffer -f:v mpegts -probesize 8192 udp://10.5.5.9:8554";
# Send UDP keep alive package
while ($true) {
Send-UdpDatagram -EndPoint "10.5.5.9" -Port 8554 -Message "_GPHD_:0:0:2:0.000000\n"
start-sleep 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment