Overview

The GoPro cameras are small, robust, shake-compensating and offer a wide field of view. Thus they are fine devices for recording or sharing your physical adventures.

Sadly the cameras are rather hard to integrate into a streaming environment.

The following description should help fellow users along that path. It is tested with the GoPro Hero7 Silver, but should work for many other models, too.

Camera interfaces

Wireless network

The device can create a wireless network:

HTTP API

The camera supports an HTTP interface for reading and modifying the device's properties:

Streaming format

A video stream can be started by sending a packet to the camera:

echo '_GPHD_:0:0:2:0.000000'; done | nc -u -q 0 10.5.5.9 8554

(other cameras may need a different packet, e.g. _GPHD_:1:0:2:0.000000 for Hero8/9 Black)

The UDP stream points is sent towards port 8554 of the sender (of the above packet).

The stream must be kept awake by sending the above packet repeatedly. A period of 2.5 seconds seems to be a good choice.

The stream is probably only meant to be used for a preview within the mobile app. But it can also be used for other purposes, of course.

At least for the Hero7 Silver the stream was not easy to access properly (e.g. VLC, mplayer of ffplay produced only partial and distorted frames). See below for details.

Technically (according to ffprobe), the stream seems to contain the following channels:

Stream #0:0[0x1011]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuvj420p(pc, smpte170m, progressive), 640x480 [SAR 1:1 DAR 4:3], 30 fps, 30 tbr, 90k tbn, 60 tbc
Stream #0:1[0x1100]: Audio: aac ([15][0][0][0] / 0x000F), 0 channels, fltp
Stream #0:2[0x200]: Unknown: none ([128][0][0][0] / 0x0080)
Stream #0:3[0x201]: Audio: ac3 ([129][0][0][0] / 0x0081), 0 channels, fltp

Remote Streaming

Please note, that you need to start the stream (and keep it awake) by sending the following packet periodically to the camera:

while sleep 2.5; do echo '_GPHD_:0:0:2:0.000000'; done | nc -u -q 0 10.5.5.9 8554

You can easily watch the amount of bandwidth used by the stream via bwm-ng or similar tools.

ffmpeg

For unknown reasons ffmpeg / ffplay produced only distorted and partial frames (at least for my Hero7 Silver):

ffplay -fflags nobuffer -f:v mpegts -probesize 8192 udp://:8554

After quite a good amount of playing around with different ffmpeg's and ffplay's options, I gave up.

gstreamer

gstreamer is a great pipeline-based processor for audio and video data. For unknown reasons it was quite trivial (compared to ffmpeg) to extract a beautiful video stream with its udpsrc module.

Stream server (nginx)

The rtmpsink pipeline above can be used for sending the stream to an rtmp server.

An easily accessible setup can be accomplished with nginx in combination with the rtmp module:

The streams are accessible in a variety of ways:

The stream obviously only contains data while your are sending an input stream (see above: rtmpsink).

Useful ressources

GoPro Hero Streaming (zuletzt geändert am 2021-06-13 18:57:09 durch lars)


Creative Commons Lizenzvertrag
This page is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.