This little blink program for the Arduino blinks an LED to give two short flashes and then a longer pause. The milliseconds are kept in an array ledDelays. It iterates through the array, setting the class=’bash’>interval according where the delayCount pointer is set. The LED state is toggled when the interval is complete.
The char pout[50] is used as a tidy way of outputting to the serial port as some older Arduino board don’t support Serial.printf.
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <Arduino.h>
#define MONITOR_LED LED_BUILTIN
constintdelayCount=4;
// led blink times in millis, LED state: off, on, off, on
There have been a lot of posts written about how to connect from Visual Studio Code (VS Code) on a Windows PC to a Raspberry PI over SSH using public/private keys avoiding the need to use a password. This is another one, and I aim to be fairly terse.
The PC is running Windows 11, the Raspberry Pi is running the latest version of Raspberry Pi OS – Debian Bullseye. Note that <username> is a placeholder for your own username, the greater than symbol: > represents a Windows PowerShell prompt and the dollar sign: $ is a Linux Bash prompt.
Setup The PI
SSH needs enabling on the PI and an ~/.ssh directory needs creating in your users home directory.
On the Pi, in the terminal enable SSH with: sudo raspi-config then select 3 Interface Options > I2 SSH and choose Yes – Enable. Now create the directory where your keys will be kept: mkdir ~/.ssh
It is also useful to find the IP address of your PI with: hostname -I Mine is 192.168.2.45 and I shall being using this in the examples.
You should now be able to login to the Pi from the Windows PC, open Windows Terminal or PowerShell and use ssh <username>@192.168.2.45 answer yes to add it to the known hosts file and it will ask for your PI’s password. If your Windows username is the same as that on the PI you can login with ssh 192.168.2.45.
Setup Windows for SSH
This stage installs the SSH client on the PC, creates a keypair and copied the public key to the PI.
The OpenSSH client can be installed using Windows Settings on Windows Server 2019 and Windows 10 and above devices.
Open Settings, select Apps > Apps & Features, then select Optional Features.
Scan the list to see if the OpenSSH is already installed. If not, at the top of the page, select Add a feature, then:
On the Windows PC, in your PowerShell create the directory for your keys if it doesn’t exist already mkdir ~/.ssh and then change into it cd ~/.ssh generate a keypair and add it to the ssh-agent:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
>ssh-keygen-ted25519
Generating public/privateed25519 key pair.
Enter file inwhich tosave the key(C:\Users\<username>/.ssh/id_ed25519):
Enter passphrase(empty forno passphrase):
Enter same passphrase again:
Your identification has been saved inC:\Users\<username>/.ssh/id_ed25519.
Your publickey has been saved inC:\Users\<username>/.ssh/id_ed25519.pub.
And on the PI we need to add that public key to the authorized keys, connect into the PI ssh <username>@192.168.2.45 and:
1
2
3
4
5
$cd~/.ssh
$touch authorized_keys
$cat id_ed25519.pub>>authorized_keys
$chmod600authorized_keys
$rm id_ed25519.pub
the commands, touch creates a blank file if it doesn’t exist, cat appends the pub file to authorized_keys, making sure that any existing keys are preserved permissions are set with chmod and finally the pub file is deleted.
Setup VS Code
Load up VS Code and add the Remote – SSH and Remote SSH: Editing Configuration Files extensions, once restarted you will see a >< icon in the bottom left-hand corner with a green background, click that and select Edit SSH Configuration file…, choose the one in your home directory C:\Users\<username>\.ssh\config and add the following:
1
2
3
4
5
Host piComputer_192.168.2.45
HostName192.168.2.45
User<username>
ForwardAgent yes
IdentityFileC:/Users/<username>/.ssh/id_ed25519
The Host “piComputer_192.168.2.45” is the friendly name displayed within VS Code for when you are choosing it from lists, the User id your user on the PI. Save the config file when complete.
You should now be able to connect to the PI. Click the >< icon in the bottom left-hand corner, and choose Connect To Host… A popup saying Setting Up… should appear, it may ask if the host is Linux or Windows, choose Linux, and within a few seconds it’ll be connected and ready. From within VS Code you can open a Bash Terminal – Ctrl+Shift+’
If it asks for a password, you may have missed a stage, or copied the private key to the PI instead of the public one.
I have just installed a new Debian Linux server, this will be running mainly as a web server without a GUI and console access will be via an SSH login, some knowledge of using Linux is assumed as these notes are intended as a prompt or overview of things to do to as part of a Linux server installation.
I am using Debian version 11.2 – Bullseye, the current version at time of writing, but these notes should work with any distribution that uses the apt package manager like Ubuntu. The ISO image used for installation came from https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/ and I have used the Xfce install: debian-live-11.2.0-amd64-xfce.iso (2.4G download). A guide for installing the Debian image can be found on this TecAdmin page.
At the Console
Your computer is now inviting you to login, do so with your local user and once the default desktop has been created open a terminal window to complete the following; switch to the root user and add your local user to the sudoers group:
1
2
3
$su
<root password>
# /sbin/usermod -aG sudo <username>
Now logout and back in, this updates your user account settings, and go back to the terminal to update the system, install ssh access and a couple of useful tools, and finally set the computer to boot to console rather than the GUI:
1
2
3
4
$sudo apt update
$sudo apt upgrade
$sudo apt install openssh-server wget curl
$sudo systemctl set-defaultmulti-user.target
If you have installed into a virtual machine now is a good time to install the guest client, links to popular VM’s:
inet6 fe80::11:32ff:fe23:836c/64scope link noprefixroute
valid_lft forever preferred_lft forever
In this instance it is 192.168.1.20. For a server I would normally fix the IP address in my router as a Reserved Address using the MAC (in this case: 02:11:32:23:83:6c).
Removing libreoffice clears a useful amount of diskspace:
1
2
$sudo apt remove libreoffice*
$sudo apt autoremove
Restart with $ sudo reboot You can now login via SSH from your other computer or continue at the console.
Installing the LAMP service – MySql, Apache and PHP
Start with MySql (MariaDB being the open source version), installing, configuring and starting:
1
2
3
4
$sudo apt install mariadb-server
$sudo mysql_secure_installation
$sudo systemctl enable mariadb.service
$sudo systemctl start mariadb.service
For the secure installation, use the defaults and set the password when prompted. Next is Apache and PHP:
Point your web browser to the server address, in my case: http://192.168.1.20, and you should see the default Apache page. The web pages are in /var/www I normally add a symbolic link and change permissions on the html directory so I can add files easily:
1
2
3
4
$cd~
$ln-s/var/www www
$cd www
$sudo chown-R<username>:www-data html/
Accessing a Network Drive
I want to be able to access some network drives from this server, these are setup as Windows (SMB) file shares.
1
2
$sudo apt install cifs-utils
$sudo mkdir/mnt/nwData
create a file with your file share username and password, this should go into /etc, I normally call the file the name of the server I want to connect to, and set permissions so it is only readable by root:
1
2
3
4
$sudo nano/etc/<servername>
USERNAME=<username>
PASSWORD=<password>
$sudo chmod500/etc/<servername>
And add the connection to the end of your /etc/fstab file, and mount the drives:
This is more of a nostalgia trip / messing about thing rather than a serious use of Voice over IP (VoIP). The Cisco SPA122 ATA with Router (Analog Telephone Adapter) is a small box that allows old analog phones to be connected to a VoIP network. At the time of writing Cisco no longer manufactures these and they are currently in an end of life plan. Cisco SPA122 ATA with Router
I am setting this up to use two handsets that can be used to call each other through the SPA122. I don’t have a VoIP service here and don’t have need for one. Later, I will be setting up a couple of modems and using them for a dialup connection, in this part I will be going through the setup and configuration of the SPA122. SPA122 And Two Telephones
You will need:
An SPA122 – I got mine from eBay, check that you are purchasing a vanilla model, rather than one that has been configured by a carrier, be wary if it has any other logos printed on it as it may be locked to that carrier.
A 5V power supply, this must be capable of providing at least 2A.
Two telephones – I got these from the Charity Shop, get ones with tone dialing (DTMF), pulse dialing will not work – I’ve also found using better quality phones made in the early 2000’s work better than cheap new ones, I ended up with BT Decor 1100 and BT Decor 1200 phones.
Two adapters to convert the UK phone plug to RJ11 sockets on the SPA122. Search for “RJ11 to BT Socket” on eBay or Amazon, these are cheap.
A wired LAN connection to your network.
A computer, preferably with WiFi as well as a Wired Connection, I used a Raspberry Pi 4.
RJ11 to BT Socket Connector
Default Settings
IP Address: 192.168.15.1 – with a computer plugged into the yellow ethernet port
Username: admin
Password: admin
Resetting the SPA122 and Gaining Access
With a network lead from your computer to the yellow ethernet port on the SPA122 open your web browser and try the address 192.168.1.15. You should now see the login screen, try the login details above.
That probably didn’t work. To reset to factory default settings use a paperclip on the rear panel reset button. With the unit powered on, use the end of a paperclip to press into the red hole marked RESET located on the bottom-left side of the back panel of the SPA122. Press and hold for at least a full 20 seconds and the Power LED will start to blink when the restore process begins, this will take around two minutes to complete. Now try logging in as admin again.
Once logged in, change the admin password to something else, if left at the default it will refuse to work.
If you are really unlucky the reset button may have been disabled in the firmware. At this stage I don’t know what to do if this has happened.
You can also configure the device by pressing the star button on your handset four times (****) but that way madness lies.
Upgrade the Firmware
At time of writing, the firmware version available from Cisco is Release 1.4.1 SR5. The update appears to be fixing a variety of security problems. You can find the current Firmware Version in Status > System Information.
Updating is straight forward. Download the file, and unzip it to extract the Payton_1.4.1_SR5_101419_1250_pfmwr.bin file, then in the SPA122 pages in your web browser go to Administration > Firmware Upgrade and follow the instructions. Everything here has been written for this version of the firmware.
Network Configuration
Even though in this case we won’t be using this as VoIP over the network, it still needs a network connection to operate.
In the Network Setup > Network Service set this to Bridge. This will allow a computer plugged into the yellow ethernet port to access / pass through to the blue Internet port which would be connected to your LAN.
Make a note of the SPA122’s WAN MAC Address, found in Status > System Settings, it may be useful for finding the box on your network when you make it available on your LAN in the next step.
Now to access the SPA122’s web pages from your LAN, go to Administration > Web Access Management and set Admin Access to Enable. Apply the changes and attach a cable from your LAN to the blue Internet port, you should now be able to login from any computer on your network. Your main router will have a list of attached devices, use the MAC address to help quickly find the designated IP address. The computer you were using to configure the ATA may need restarting to pick up an IP address from the LAN.
Although I have not tested this, with a handset attached to one of the phone ports dial * * * * and listen, if you can hear a slightly sinister automated voice saying “System Configuration Menu” then dial 1 1 0 # slowly, the key presses are read back to you, the device will then tell you its IP address 192.168.x.x.
SPA122 Ports
Telephone Configuration
Now we are in the Voice section. At this stage listening on a handset just produces silence, or a quiet buzzing, like from a poor power supply. For setting up the ATA will need to be restarted several times. Go to Quick Setup and set the user and dial plan for each line. The dial plan describes how the call is to be handled, numbers can be blocked, routed to different ones, or in this case be routed to another port.
Line 1:
User ID: 101
Dial Plan: (*xx|[3469]11|0|00|[2-9]xxxxxx|1xxx[2-9]xxxxxxS0|xxxxxxxxxxxx.|<018118055:101>S0<:@127.0.0.1:5061>|)
Line 2:
User ID: 100
Dial Plan: (*xx|[3469]11|0|00|[2-9]xxxxxx|1xxx[2-9]xxxxxxS0|xxxxxxxxxxxx.|<018118055:100>S0<:@127.0.0.1:5060>|)
I have used 018118055 as the number, but you can set this to anything you like. Both phones are on the same number, but they behave separately so you can ring one from the other. If the phone has a caller ID display it will show the user ID, 100 or 101.
Click submit to save the changes, once restarted and logged back in, we now need to add a bit more detail, go to Voice > Line 1, and set the following:
Proxy and Registration:
Make Call Without Reg:
yes
Ans Call Without Reg:
yes
Audio Configuration:
Preferred Codec:
G729a
Second Preferred Codec:
G711u
All lines that start with FAX:
set to no or none as appropriate
Modem Line:
yes
The FAX settings are to do with using modems in the future. All other settings can be left at their defaults. Click submit to save the settings, this takes a few seconds, and once you have logged back in go to Voice > Line 2 and set the same settings as those you just set for Line 1.
You should now be able to make a call from one phone to the other, but the ring and dial tones will sound wrong as they are for those used in the USA.
Setting the Tones
Now we need to set the dial tones and ringer for those used in the UK, in Voice > Regional you can see there are quite a few options to be set, but here I will only be setting the ones most commonly used.
In this post I am setting up a network available RTSP video camera on a Raspberry Pi 4 Model B with the latest Debian Buster installed, you will also want another ‘remote’ computer with VLC installed on the same network. I have used a camera module connected via a ribbon cable to the Pi’s video port. The performance is more like what you would see from a security camera rather than some fancy dedicated device. I will be making the configuration with a bash shell using SSH rather than the GUI.
Installation
If you haven’t already, enable the camera on the Pi with sudo raspi-config and go to Interface Options > Camera. To reduce the load on the computer I also set the Pi to boot to the Console in System Options > Boot / Auto Login and selecting Console, you should also check that at least 256MB of memory is allocated to the GPU in Performance Options > GPU Memory, when complete reboot to set the updated configuration.
Install some prerequisites, you may have some or all of these installed already:
To setup V4L, edit the configuration file $ sudo nano /etc/uv4l/uv4l-raspicam.conf and update the driver options and uncomment the h264 options:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
##################################
# raspicam driver options
##################################
encoding=h264
#720p
width=1280
height=720
framerate=12
### h264 options:
profile=high
level=4.2
bitrate=8000000
intra-refresh-mode=dummy
intra-period=#arg
inline-headers=yes
sps-timing=no
quantisation-parameter#arg
Restart the service once you have saved the file:
1
$sudo service uv4l_raspicam restart
Useful screen Resolutions; designation, ratio: width x height:
1080p, 16:9: 1920 x 1080
720p, 16:9: 1280 x 720
720, 4:3: 1296 x 792
Standard Definition, 4:3: 640 x 480
I’ve chosen 720p 16:9 widescreen, this gives a good image quality without stressing the Pi 4B. The framerate is a compromise between quality and usability, its unlikely you would want to go above 25fps.
Connecting
If you don’t know it already, find the IP address of your Pi with $ ip a. Look for the address in eth0 or wlan0 depending on if you are using ethernet or wireless. In this case I will be using 192.168.2.33 in the examples.
Play thisstream using the URL"rtsp://192.168.2.33:8555/unicast"
Now on your ‘remote’ computer open VLC and choose Media > Open Network Stream and place the given stream address into the network URL, you will then be asked for the username and password. For me it took less than five seconds for an image to appear, there is a fairly high latency on the image shown, the picture lags by about a second from reality.
Using OpenCV
You can access the stream using Python scripts and OpenCV on your ‘remote’ computer for AI/Machine Learning. For me this is a Debian Linux box with FFmpeg as OpenCV uses this to access the stream.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/env python
import os
import cv2
# if the script doesn't work, uncomment the following, OpenCV may be
# defaulting to TCP when we are wanting to use UDP.
There are 149 watermills and dams shown on this interactive map, dating from the 1200’s to the 1930’s all using water power to drive tilt hammers, blowers for forgers, grinding wheels for sharpening knifes and scythes as well for the milling of corn and other grains. Each mill has a brief chapter of the places history taken from the book ‘The Water-Mills of Sheffield’ by W.T. Miller, 2nd Issue, published in 1947.
The map has been designed for use with mobile phones, and the GPS can be used to find your location when you are out and about, on a desktop computer the GPS will not work. Click on a dot to see the mill name, and then click on the name for some interesting facts. On your mobile use the menu (top right) to turn GPS on to show your position.
The Jetson Nano Developer kit – B01 is a small computer comprising of an NVIDA Maxwell GPU, Quad-Core ARM Cortex-A57 Processor and 4GB of Memory along with four USB 3 ports, Gigabit Ethernet, HDMI and Display Port output, main storage is on a MicroSD card and there is a variety of selection of expansion available via GPIO, I2C and UART. On the software side NVIDIA provide their JetPack SDK – a customised version of Ubuntu. This development kit has been produced to provide an entry point into Machine Learning, for which I will be using Python programming language. I got my board from Pimoroni
These notes cover my process of setting one up and links to the documentation, it not intended to repeat those install guides but to provide an install sequence and any additional commentary as needed. I’m going to assume you have a little experience of using the terminal and am familiar with using the bash command line – I’ve no idea how this would be done through the GUI.
Jetson Nano ports [source: NVIDIA]
Initial Startup
I followed the instructions for downloading and installing JetPack 4.4 on https://nvidia.com/jetsonnano-start I used a 64GB Class 10, UHS-I, U3, V30 SanDisk card. I formatted the card in a camera before using balenaEtcher to write the JetPack SDK image, this creates a partition of about 16GB on the card formatted to ext4, during installation the volume is resized to fill the card.
Jetson Nano connections [source: NVIDIA]
Despite using a good quality USB power supply with an output of 3 Amps at 5 Volts into the Micro USB port the computer would only boot long enough for the NVIDIA logo to appear on screen but after a few seconds the green power LED would go out and it would be off, the same happened when I tried a variety of USB power supplies used. I got round the problem buy using a 5 Amp power supply connected to the barrel jack J25 on the left (centre pin positive) and connecting the jumper J48 located just behind this connector.
Customising the Setup
There are a couple of thigs to do, get a network volume mounted and set the default version of python.
For the network share install samba, some network utilities and the nano text editor:
1
$sudo apt install samba cifs-utils nano
create a text file: sudo nano /etc/samaba/videoserver with the following:
1
2
username=<your network username>
password=<your network password>
And set the permissions sudo chmod 600 /etc/samba/videoserver. In this example I have a network share on my server; 192.168.1.30, called video. Create a mount point for the share: sudo mkdir /mnt/video now you need to edit fstab, sudo nano /etc/fstab and add your network connection to the end:
Reload fstab with sudo mount -a and check for any errors. Because of the way that Jetpack boots it does not appear to wait for the network so the share needs to be set to automount and this causes it to only appear in drive listings when accessed. Further reading can be found in this excellent guide to fstab: https://wiki.archlinux.org/index.php/fstab.
Jetpack 4.4 comes with two versions of Python, 2.7 and 3.6, I want it to default to 3.6 and while this is rather out of date I don’t want to go down the hole of upgrading just yet, you will also need to install pip and set pip3 as the default too.
I did get an error later on, a crash was reported on the desktop when an occasional python 2 script ran. I fixed the error in /usr/sbin/l4t_payload_updater_t210 by changing the first line of the file from !#/user/bin/python to !#/user/bin/python2
Post Install Problems
A recent update occured, so I did the usual sudo apt get update && sudo apt get upgrade but one of the files gave a script error, this turned out to be with nvidia-l4t-bootloader, like so:
Setting up nvidia-l4t-bootloader(32.4.3-20200924161615)...
3448-300---1--jetson-nano-qspi-sd-mmcblk0p1
Starting bootloader post-install procedure.
Update bootloader completed.
Reboot the target system forchanges totake effect.
Updating extlinux.conf...
Root device isset inthe extlinux.conf
Afterwards I set the default back to python 3.6 again.
Setup the Machine Learning
There are three Machine Learning packages, OpenCV for Computer Vison, Tensorflow for machine learning models, and TensorRT – accelerated deep learning networks for image recognition.
The Micro SD Card I use in a Raspberry PI ran out of space so here is how I copied the contents of the 15GB drive to a new 64GB card and resized the partition. I used a separate computer running Debian and as the machine does not have a monitor or keyboard attached this will be being completed through the bash command line using SSH.
1. Making a copy of the SD Card.
Insert the old card into your computer, if the computer attempts to mount the drive then unmount it. We need to find which mount point has been used, do this with the lsblk command:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda8:00477G0disk
├─sda18:10512M0part/boot/efi
├─sda28:20468.9G0part/
└─sda38:307.6G0part[SWAP]
sdb8:160477G0disk
└─sdb18:170477G0part/mnt/external_ssd
sdc8:3201.8T0disk
└─sdc18:3301.8T0part/data
sdd8:4803.7T0disk
└─sdd18:4903.7T0part/mnt/external_hdd
sde8:64114.9G0disk
├─sde18:65143.8M0part
└─sde28:66114.8G0part
The device sde matches our SD card. So we will use that. The dd command is used to create the ISO image, I am creating the file in my home directory:
The copied partition is now the same size as the original. If you have space remaining, the new card can be put back in the Pi and use the raspi-config utility, and using the Expand Filesystem option in the Advanced Settings section. However if the drive is completely full you won’t be able to login as there won’t be enough space available for the temporary files created at login, to get round this you can use parted to resize, start with:
1
$sudo parted/dev/sde
if you get the following message:
1
Warning:Unable toopen/dev/sde read-write(Read-only file system)./dev/sde has been opened read-only.
then quit from parted, if you are using a full size SD Card, check the Write Protect tab on the side of the card and try again, otherwise try:
1
2
3
4
5
$sudo hdparm-r0/dev/sde
/dev/sde:
setting readonly to0(off)
readonly=0(off)
If problem persists try formatting the new card in a camera, as these have a simple file system, and write the ISO image again.
We need to resize the larger partition /dev/sde2 with the ext4 file system, the smaller is used to boot the Pi and can be ignored. In parted, list the partitions with the print command:
1
2
3
4
5
6
7
8
9
10
11
$sudo parted/dev/sde
(parted)print
Model:Generic-USB3.0CRW-SD(scsi)
Disk/dev/sde:63.9GB
Sector size(logical/physical):512B/512B
Partition Table:msdos
Disk Flags:
Number Start EndSize Type File system Flags
14194kB50.1MB45.9MBprimary fat32 lba
250.3MB15.9GB15.9GBprimary ext4
Using resizepart set the new size, I set this to larger than the 15GB but smaller than the unallocated space, this to save me having to accurately work out the remaining space manually:
1
2
(parted)resizepart2
End?[15.9GB]?40GB
Now update the boundaries to grow and resize the partition into the freshly allocated space:
1
2
$sudo/sbin/e2fsck-f/dev/sde2
$sudo/sbin/resize2fs/dev/sde2
Now boot the Pi with the new card, login and use the raspi-config utility then in Advanced Options choose Expand Filesystem and follow the onscreen instructions. Once rebooted you should now be set to fill up your new card.
While extracting the telemetry data from the GoPro is reasonably well documented I have found some gaps for getting the extracting utilities installed and when extracting and combining data from multiple files. These notes are for a Debian/Ubuntu installation in a BASH Shell.
Installing the gopro-utils
As I couldn’t find any straightforward instructions for installation, I’ll be going through everything I needed to do to get it working, you may have some of these packages installed already.
1
2
3
sudo apt update
sudo apt upgrade
sudo apt install ffmpeg golang gpsbabel git
Now to get the gopro-utils and install them, I’m placing the source files into my Downloads directory, as well as the GPS data extractor we’ll be adding the other telemetry tools too, this is all a bit long winded.
go get github.com/JuanIrache/gopro-utils/telemetry
go get github.com/mlouielu/gpxgo/gpx
cd bin/gopro2gpx
go build gopro2gpx.go
sudo cp gopro2gpx/usr/local/bin/
cd../bin/gopro2geojson/
go build gopro2geojson.go
sudo cp gopro2geojson/usr/local/bin/
cd../gopro2json/
go build gopro2json.go
sudo cp gopro2json/usr/local/bin/
cd../gpmd2csv/
go build gpmd2csv.go
sudo cp gpmd2csv/usr/local/bin/
cd../gpmd2info/
go build gpmd2info.go
sudo cp gpmd2info/usr/local/bin/
cd../gps2kml/
go build gps2kml.go
sudo cp gps2kml/usr/local/bin/
Extracting the Data
You will need to find which stream in the video recording the data has been saved to, to find this use ffprobe to examine the recording and look for the stream that contains GoPro MET, for example:
You can see that what we are wanting is on stream 3, as far as I can tell this stays the same every time, I don’t know if it is different for other GoPro models.
This bash script extracts the GPS data in GPX format from all the GoPro GX recordings in the directory, other options have been commented out, if you are using Garmin VIRB edit there is also an option for use with that. The script creates two files, one that contains the raw data and another with the desired GPS data, the GPS output file has the same name as the recording, but in lowercase with a .gpx extension.
#gopro2gpx -i "$BINFILE" -a 200 -f 3 -o "$OUTFILE-virb.gpx"
#gopro2json -i "$BINFILE" -o "$OUTFILE.json"
done
Merging GPX files
As the GoPro splits recordings into 4GB blocks, when extracting you will get a single GPX file for each recording. Many pages found by Google say that to create a single track from these all you need to do is append the files into one big file. This is wrong, what you end up with is a single file with many short tracks, when what you are after is one long track covering the entire journey. This bash script uses gpsbabel to create single merged file from the extracted GPX data, it creates a file called “gpsoutput.gpx”.