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: 183
Re: Extracting the metadata in a useful format

@jm-lemmi Keep in mind that your phone takes its position from land antennas too. So it will keep a lock when it can't read GPS satellites. The GoPro cannot do that.

Nomad
Posts: 183
Re: Extracting the metadata in a useful format

Thanks to a contribution by Alex Denning the GPMD2CSV tool has been improved:

http://tailorandwayne.com/gpmd2csv/

Sightseer
Posts: 6
Re: Extracting the metadata in a useful format

I appreciate the work being done here.  I didn't know this message board existed, I'll have to spend some time reading and catching up.

 

A summary of the changes I made to GPMD2CSV:

There are now two batch files:

GPMD2CSV.bat (Processes a single .mp4 file, just drag and drop on the script)

GPMD2CSV Folder Process.bat (processes all .mp4 files in the source directory, just drag and drop a single file on the script)

 

GPMD2CSV.bat:

Drag a file on from any directory and it outputs to a sub directory under that file path (no need to move the files to the same directory as the batch file).

It runs the processes minimized so FFMPEG windows don't pop up during processing.
Displays a "Processing file" message in the main window during file processing along with info on what is being processed.
Can now nest the output directory under another directory (Edit line: Set BatchOutputFolder=).  Default is "GoPro Metadata Extract\"
It doesn't process files if the export directory exists (assumes it's already been processed).  Delete the older directory if you'd like to reprocess.
 
GPMD2CSV Folder Process.bat:
Drag an MP4 file from any directory onto that file.
It will process ALL MP4 files in that folder and output to the nested directory ("GoPro Metadata Extract\<Source File Name>\")
This batch file calls "GPMD2CSV.bat".  So, edit the line: "Set BatchOutputFolder=GoPro Metadata Extract" to change the default export directory.
 
Alex
Hiker
Posts: 28
Re: Extracting the metadata in a useful format
[ Edited ]

Good stuff, except the filename subdfolders seem redundant since the files are all labeled with the name and it makes it a lot more cumbersome to process the output files - there's no easy way to import all the .gpx into Goole Earth or any other external program, you need to fish all of them out of their subdirectories..

 

Any chance to either revert this or make it an option?

 

M.

Sightseer
Posts: 6
Re: Extracting the metadata in a useful format

Ok, added the option to create the nested subdirectories or not.  Save the new code as "GPMD2CSV.bat".  I've done limited testing, should work though.

 

Switches:

This is the name of the overall subdirectory.  If you don't need a subdirectory, just set "BatchOutputFolder=" to nothing.

 

:: Name of the folder that is created to output to (Optional)
Set BatchOutputFolder=GoPro Metadata Extract

 

 

This is the optional nested subdirectory by filename.  Set "Set IndividualSubDirs=No" and it won't make the inddividual subdirectories.

 

:: Make Individual Subdirectories for each file?  Type in Yes or No
Set IndividualSubDirs=Yes

 

 

Examples:

To Output to "<Source File Directory>\GoPro Metadata Extract\<Source File Name>\<FILES>" Set:

Set BatchOutputFolder=GoPro Metadata Extract
Set IndividualSubDirs=Yes

 

To Output to "<Source File Directory>\GoPro Metadata Extract\<FILES>" Set:

Set BatchOutputFolder=GoPro Metadata Extract
Set IndividualSubDirs=No

 

To Output to "<Source File Directory>\<Source File Name>\<FILES>" Set:

Set BatchOutputFolder=
Set IndividualSubDirs=Yes

 

To Output to "<Source File Directory>\<FILES>" Set:

Set BatchOutputFolder=
Set IndividualSubDirs=No

 

 

Copy the code below and save as "GPMD2CSV.bat":

 

@ECHO OFF

:: Name of the folder that is created to output to (Optional)
Set BatchOutputFolder=GoPro Metadata Extract

:: Make Individual Subdirectories for each file?  Type in Yes or No
Set IndividualSubDirs=Yes

:: ==========================================
:: You shouldn't need to edit below this line
::===========================================

:IndividualSubDirCheck
if '%IndividualSubDirs%'=='Yes' goto IndSubDirY
if '%IndividualSubDirs%'=='yes' goto IndSubDirY
if '%IndividualSubDirs%'=='Y' goto IndSubDirY
if '%IndividualSubDirs%'=='y' goto IndSubDirY
if '%IndividualSubDirs%'=='No' goto IndSubDirN
if '%IndividualSubDirs%'=='no' goto IndSubDirN
if '%IndividualSubDirs%'=='N' goto IndSubDirN
if '%IndividualSubDirs%'=='n' goto IndSubDirN
Goto IndividualSubDirCheckError

:IndSubDirY
Set IndividualSubDirs=1
GoTo RunIt

:IndSubDirN
Set IndividualSubDirs=0
GoTo RunIt

:RunIt

Set SourceScriptDirectory=%~dp0
Set SourceFile=%1

cd "%~dp1"

If '%IndividualSubDirs%'=='1' (
	If exist ".\%BatchOutputFolder%\%~n1\%~n1".gpx goto :eof
) Else (
	If exist ".\%BatchOutputFolder%\%~n1".gpx goto :eof )

mkdir "%~n1"
if [%1]==[] goto :eof
:loop
"%SourceScriptDirectory%\bin\ffmpeg" -i "%~1" > output.txt 2>&1
for /F "delims=" %%a in ('FINDSTR "gpmd" output.txt') do set line=%%a
echo "%line%"
set stream= %line:~12,3%
echo "%stream%"
CLS
ECHO.
ECHO **************************************************
ECHO **************** Processing file: ****************
ECHO "%~nx1"
ECHO ***************** In Directory: ******************
ECHO "%~dp1"
ECHO **************************************************
@ECHO ON
START "" /WAIT /MIN "%SourceScriptDirectory%bin\ffmpeg" -y -i "%~1" -codec copy -map "%stream%" -f rawvideo "%~n1".bin
START "" /WAIT /MIN "%SourceScriptDirectory%bin\gpmd2csv" -i "%~n1".bin -o "%~n1"/"%~n1".csv
START "" /WAIT /MIN "%SourceScriptDirectory%bin\gopro2json" -i "%~n1".bin -o "%~n1"/"%~n1".json
START "" /WAIT /MIN "%SourceScriptDirectory%bin\gps2kml" -i "%~n1".bin -a 1000 -f 3 -o "%~n1"/"%~n1".kml
START "" /WAIT /MIN "%SourceScriptDirectory%bin\gopro2gpx" -i "%~n1".bin -a 1000 -f 3 -o "%~n1"/"%~n1".gpx
DEL "%~n1".bin
DEL output.txt
Mkdir "%BatchOutputFolder%"

If '%IndividualSubDirs%'=='1' (
	Move /Y "%~n1" ".\%BatchOutputFolder%\"
) Else (
	Move /Y "%~n1\*" ".\%BatchOutputFolder%\"
	RMDIR /S /Q "%~n1\" )

shift
if not [%1]==[] goto loop
GoTo eof

:IndividualSubDirCheckError
cls
ECHO **********************************************************
ECHO ************************* ERROR **************************
ECHO ***** "IndividualSubDirs" is not formatted correctly *****
ECHO *** Check "GPMD2CSV.bat" and verify it is = Yes or No ****
ECHO **********************************************************
pause
exit

 

 

Sightseer
Posts: 7
Re: Extracting the metadata in a useful format

This thread is a godsend. Thank you all so much.

i look forward to trying this - I've been so frustrated with my GoPro 7 black and the entire GoPro software stack.

I'm shooting wingsuit videos in 4k/60 and the entire workflow of adding visualization / gauges is just horrid. I don't want to make a 30 sec highlight reel and quik desktop would just freeze on large videos.

 

i was ready to return my 7 after 2 months of frustration but you guys have given me hope of extracting gps data for use with virb Edit.

 

thank you

Sightseer
Posts: 6
Re: Extracting the metadata in a useful format
[ Edited ]

vg071, good to hear!

 

I use Garmin Virb edit for all of my overlays as well.

 

I wrote a guide for applying video overlays using Virb Edit, any action cam (GoPro Hero 3) and data files from a bike computer.  The bike computer outputs data files similar to what is extracted using kajuna's tool.  You might find it useful, but, you'd of course use the files from the extract tool instead of from a bike computer/fitness device.

 

https://docs.google.com/document/d/1eUmBCdN6dIZXLHaLAdoTw7wRYn_1dBV60JxWPscwONU/edit?usp=sharing

Highlighted
Sightseer
Posts: 7
Re: Extracting the metadata in a useful format

thank you, everyone.

with your brilliant data extraction and importing into virb edit, it all works!

 

no more of gopro's software rubbish.

 

you guys made my gopro useful again! thank you