- QGroundControl
- curl
- bash
- ffmpeg
- GoPro Hero 4 Black
Turn on the GoPro and navigate in the settings to the WiFi menu. Select GoPro App.
Connect to the WiFi network of the GoPro, by default the SSID is GP followed by a bunch of numbers and the password is "goprohero".
Verify that you can ping the GoPro. The default IP address for the GoPro should be 10.5.5.9.
ping 10.5.5.9
Note: Steps 2-4 can now be accomplished by running this docker image, https://hub.docker.com/r/utcusl/gpqgc/
Start the livestream on the GoPro with one of the following commands from the terminal, depending on the firmware version.
curl "http://10.5.5.9/gp/gpExec?p1=gpStreamA9&c1=restart"
curl "http://10.5.5.9:8080/gp/gpControl/execute?p1=gpStream&c1=restart"
You can test the video connection with ffplay.
ffplay -fflags nobuffer -f:v mpegts -probesize 8192 udp://10.5.5.9:8554
Run the following command at the terminal to keep the streaming session alive.
while (true) do echo "_GPHD_:0:0:2:" > /dev/udp/10.5.5.9/8554; sleep 2; done
This will run forever until you kill it with Ctrl+C. You can also run it in background mode by adding an '&' to the end after 'done'. If you do this, you will have to kill the sh process created.
Open a new terminal and run the following command that will receive the stream from the GoPro and direct it to the localhost. If forwarding from a different computer (e.g. an embedded computer on a drone) you will need to replace the localhost IP, 127.0.0.1, with the IP Address of the ground station.
ffmpeg -f mpegts -i udp://10.5.5.9:8554 -map 0:0 -c copy -f rtp udp://127.0.0.1:5000
In QGroundControl, click the Q icon in the top left. Under General settings, scroll down to Video. Choose UDP Video Stream as the source. Enter 5000 as the port.
Click on the paper airplane icon to return to the map. You should now see the video stream in the corner of the map.
https://gist.github.com/3v1n0/38bcd4f7f0cb3c279bad#file-hero4-udp-keep-alive-send-py
https://github.com/KonradIT/goprowifihack/blob/master/HERO4/WifiCommands.md
https://docs.qgroundcontrol.com/en/getting_started/download_and_install.html
https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md
https://gist.github.com/moritzmhmk/48e5ed9c4baa5557422f16983900ca95
If QGroundControl gives the error, "Error with gst_element_factory_make('h264parse')", try installing the following package.
sudo apt install gstreamer1.0-plugins-bad gstreamer1.0-libav
If you see the error, "/dev/udp/10.5.5.9/8554: No such file or directory.", ensure you are running in a bash shell (versus e.g. tcsh, etc.)
If QGroundControl does not display anything when you run it and it immediately exits, try rebooting the computer.
If the video works with ffplay but not QGroundControl, try disabling the video in QGroundControl and re-enabling it. Also try running the Keep Awake and ffmpeg commands in separate command windows.