Ask a Question
GoPro Support Hub Ask a question. Share an answer. Find a solution. Stay stoked.
Announcements
Is your GoPro gear up to date? Check to see If it is on our Update page.
Reply
This is an open group. Sign in and click the "Join Group" button to become a group member and start posting.
Nomad
Posts: 1,118
Merge files and keep telemetry

Hi there,

 

I've had multiple users ask for this feature and failed to provide a solution, so I summon the power of the community.

 

The goal is to merge multiple video files (4GB chapters of the same video) while keeping telemetry readable for apps such as ReelSteady Go, Rouvy or even Quik.

 

This is the closest I got using ffmpeg concat:


merge.txt

 

file 'GX010203.MP4'
file 'GX020203.MP4'

 

 

Then run

ffmpeg -f concat -i merge.txt -c copy -map 0:v -map 0:a -map 0:3 -copy_unknown -tag:2 gpmd out.mp4

 

 

This produces a valid output that does contain all the telemetry, as can be checked with https://goprotelemetryextractor.com/free/ (I have not tested the timing accuracy)

But ReelSteady Go refuses to read the data. I have made other tests and RSGO basically refuses to read any file that has gone through ffmpeg, probably because it's missing the original 0:2 and 0:4 streams (GoPro TCD and GoPro SOS. Order is different in some cameras). I have been unable to copy those with ffmpeg.

Here is some additional discussion on the topic: https://www.reddit.com/r/ffmpeg/comments/8qosoj/merging_raw_gpmd_as_metadata_stream/

Help is appreciated.

Juan

Tourist
Posts: 7
Re: Merge files and keep telemetry

You could try adding the flag

 

-strict unofficial

 

https://gist.github.com/nickkraakman/e351f3c917ab1991b7c9339e10578049

Nomad
Posts: 1,118
Re: Merge files and keep telemetry

Thanks, good idea. Still no luck

Tourist
Posts: 7
Re: Merge files and keep telemetry

Shame, maybe ask the developer?

Sightseer
Posts: 1
Re: Merge files and keep telemetry

Thanks Juan, I would love a solution to this!

Nomad
Posts: 1,118
Re: Merge files and keep telemetry
@sharpwave517 If you mean the ReelSteady developer, I believe the users that contacted me had already tried contacting them. Now that GoPro acquired ReelSteady it might be more difficult to get something like this implemented (larger company = less flexibility, as we have seen on other fronts, like updates to Quik)
Tourist
Posts: 7
Re: Merge files and keep telemetry

Sorry I meant the ffmpeg developer

Tourist
Posts: 6
Re: Merge files and keep telemetry
[ Edited ]

Perhaps GoPro should stop chaptering the files. 4GB file size limit is not relevant since the camera formats the micro SD cards as exFAT anyway.

 

Meanwhile, if anyone is frustrated with the non-sequential naming of chaptered files, you can use Bulk Rename Utility to make them "alphabetical". In the RegEx (1) part of the the program window, use:

Match:

(G.)(..)(\d\d\d\d)

Replace:

\3 \2 \1

Once you hit Rename, the files will be sorted in the order they were captured in. For e.g.,

GX010203.MP4
GX010204.MP4
GX010205.MP4
GX020203.MP4

becomes

0203 01 GX.MP4
0203 02 GX.MP4
0204 01 GX.MP4
0205 01 GX.MP4

 

 

 

 

Tourist
Posts: 7
Re: Merge files and keep telemetry

@kajuna 

 

I tried your command but get this error

 

Stream map '0:3' matches no streams.

 

Any ideas?

Hiker
Posts: 10
Re: Merge files and keep telemetry

agree on dropping the chaptering

 

especially since it introduces a bizarre bug which none of the GoPro folk here seem to care about:

 

https://community.gopro.com/t5/GoPro-Apps-for-Desktop/orientation-discontinuity-after-export-Bug-in-...

 

- Michael

Tourist
Posts: 5
Re: Merge files and keep telemetry

Juan,

 

 

Have you had any success merging files preserving telemetry data? I am having the same trouble. 

My end goal is to create routes I can ride on Rouvy.

Also what operating system and version are you using?

I am runing Linux (Fedora 31)

 

 

Eric

 

 

Tourist
Posts: 5
Re: Merge files and keep telemetry

Try running the following command to see what streams are in your clip:

ffprobe -i YourFile.mp4

 

For me I get the following relevant line:

Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 49 kb/s (default)

 

My clip was generated from a GoPro Hero 8 Black

Nomad
Posts: 1,118
Re: Merge files and keep telemetry

@sharpwave517 Sorry, I missed your message when you posted it. In some cases the telemetry stream is not in the 0:3 position. You can do as @fleetsurf1573 says (or the same command with ffmpeg) to find out where your gpmd stream is.

@fleetsurf1573 The approach in my initial post seems to succeed, but some programs that support GoPro Telemetry refuse the output. ReelSteady does and according to a user I was discussing this with, so does Rouvy.

I guess the easy workaround is to convert your files to GPX with the Telemetry Extractor ( https://goprotelemetryextractor.com/free/ ). You can either export all the files as one GPX with the Premium version ( https://goprotelemetryextractor.com/gopro-gps-telemetry-extract ) or find some other tool that can merge multiple GPX files together.

The Hero8 now allows to record longer chapters with their experimental Labs firmware. 12GB instead of 4, so if you just wanted to merge 3 files, that could be a solution (it has limitations, like the camera not being able to play the longer files) https://gopro.com/en/us/news/gopro-labs-launch

Tourist
Posts: 5
Re: Merge files and keep telemetry

So I managed to smash all the original MP4 files from my GoPro Hero 8 into one using the following command:

ffmpeg -f concat -i merge.txt -c copy -map 0:v -map 0:a -map 0:3 -copy_unknown -tag:2 gpmd /mnt/internal-120GB-SSD/combined.mp4

 

And according to the Telemetry Extractor it has GPS / telemetry data (Woot Woot)

 

So I am 1/2 way home. I just asked the Telemetry Extractor to extract the GPX data (Fingers Crossed)

 

FWIW I also ran my Garmin Edge 520 while recording the video.

Could I possibly use it's GPS data?

Nomad
Posts: 1,118
Re: Merge files and keep telemetry

If your Garmin Edge generates .fit files, you might be able to import them in Garmin BaseCamp and then export them GPX.

Note that the approach of merging the files with ffmpeg and then extracting the data to GPX in the Extractor has not been tested for timing accuracy. I would not be surprised if the data was slightly ahead of the video on the second clip, and progressively more on the successive ones (due to the data gap at the end of each clip)

Tourist
Posts: 5
Re: Merge files and keep telemetry

I am just learning the complexity of ffmpeg, but I have a question about the command you posted to combine files, pecifically the -tag:2 option (see below).

 

ffmpeg -f concat -i merge.txt -c copy -map 0:v -map 0:a -map 0:3 -copy_unknown -tag:2 gpmd out.mp4

 

If I understand the -map flag and -tag flags, shouldn't  the gpmd codec been assigned to stream 3 and not 2 using the -tag:3 gpmd option instead of the -tag:2 gpmd?

 

An analysis of my original files generated by my GoPro Hero 8 Black is as follows:

put #0, mov,mp4,m4a,3gp,3g2,mj2, from 'GH010001.MP4':
Metadata:
major_brand : mp41
minor_version : 538120216
compatible_brands: mp41
creation_time : 2020-05-30T14:16:32.000000Z
firmware : HD8.01.01.60.00
Duration: 00:05:19.34, start: 0.000000, bitrate: 100274 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 2704x1520 [SAR 1:1 DAR 169:95], 100013 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
Metadata:
creation_time : 2020-05-30T14:16:32.000000Z
handler_name : GoPro AVC
encoder : GoPro AVC encoder
timecode : 14:30:10:54
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata:
creation_time : 2020-05-30T14:16:32.000000Z
handler_name : GoPro AAC
timecode : 14:30:10:54
Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2020-05-30T14:16:32.000000Z
handler_name : GoPro TCD
timecode : 14:30:10:54
Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 49 kb/s (default)
Metadata:
creation_time : 2020-05-30T14:16:32.000000Z
handler_name : GoPro MET
Stream #0:4(eng): Data: none (fdsc / 0x63736466), 13 kb/s (default)
Metadata:
creation_time : 2020-05-30T14:16:32.000000Z
handler_name : GoPro SOS

 

 

Eric

Nomad
Posts: 1,118
Re: Merge files and keep telemetry

I can't remember why the tag had to be 2 and not 3, to be honest. I know it was like that for a reason. Sorry.

Nomad
Posts: 1,118
Re: Merge files and keep telemetry

In case anyone missed it, there's a partial workaround for this. You can record files 3 times longer (12GB instead of 4GB) with the GoPro labs firmare (Hero8 only) https://community.gopro.com/t5/GoPro-Labs/ct-p/GoProLabs#

Once the firmware is installed, scan this code to enable the 12GB chapters: https://gopro.github.io/labs/control/chapters/

The feature has issues of its own (like the files not being playable in the camera), but it might be useful in some situations.

Hiker
Posts: 36
Re: Merge files and keep telemetry

When using Virb Edit to cut the video, after export, virb edit automatically also exports a new GPX file with the telemetry in it for that movie. So the cut in the telemetry is where the video is cut too.

 

Example: I split two shots (one rec 8:44) and one rec 10:17) and after the export the new gpx file looks like this:

 

<trkpt lat="53.0654585827142" lon="6.546055069193244">
<ele>-1.600000023841858</ele>
<time>2020-08-01T08:44:49Z</time>
<extensions>
<gpxtpx:TrackPointExtension>
<gpxtpx:atemp>20</gpxtpx:atemp>
<gpxtpx:hr>166</gpxtpx:hr>
<gpxtpx:cad>63</gpxtpx:cad>
</gpxtpx:TrackPointExtension>
<gpxx:TrackPointExtension>
<gpxx:Temperature>20</gpxx:Temperature>
</gpxx:TrackPointExtension>
<pwr:PowerInWatts xmlns:pwr="http://www.garmin.com/xmlschemas/PowerExtension/v1">156</pwr:PowerInWatts>
</extensions>
</trkpt>
</trkseg>
<trkseg>
<trkpt lat="53.180289147421718" lon="6.414023330435157">
<ele>-2.200000047683716</ele>
<time>2020-08-01T10:17:44Z</time>
<extensions>
<gpxtpx:TrackPointExtension>
<gpxtpx:atemp>24</gpxtpx:atemp>
<gpxtpx:hr>168</gpxtpx:hr>
<gpxtpx:cad>86</gpxtpx:cad>
</gpxtpx:TrackPointExtension>
<gpxx:TrackPointExtension>
<gpxx:Temperature>24</gpxx:Temperature>
</gpxx:TrackPointExtension>
<pwr:PowerInWatts xmlns:pwr="http://www.garmin.com/xmlschemas/PowerExtension/v1">0</pwr:PowerInWatts>
</extensions>
</trkpt>

Tourist
Posts: 3
Re: Merge files and keep telemetry

Hi.

I´m so sad to hear it is so difficult, I would have loved to use Gopro app for some coluor and speed stikkers and then over to Reelsteady go to make it look steady, I´m doing MTB so it would had been cool.

Ken

Denmark