GithubHelp home page GithubHelp logo

juanmcasillas / gopro2gpx Goto Github PK

View Code? Open in Web Editor NEW
179.0 179.0 50.0 4.26 MB

Parse the gpmd stream for GOPRO moov track (MP4) and extract the GPS info into a GPX (and kml) file.

License: GNU General Public License v3.0

Python 100.00%
ffmpeg ffprobe gopro gpmf gpx kml mov mp4 python telemetry video

gopro2gpx's Introduction

WIP WIP WIP

Hello, I'm a software engineer, living in Madrid (Spain).

  • Realtime systems
  • Embedded devices
  • Arduino/ESP32
  • Python/C++
  • 3D Design & Fabrication
  • Creator of OnsightBoard

gopro2gpx's People

Contributors

alycda avatar jimmys83 avatar jrwu avatar juanmcasillas avatar realchrisolin avatar simske avatar stakita avatar yonesher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gopro2gpx's Issues

ERROR: For req: gopro2gpx==0.1. Invalid script entry point:

ERROR: For req: gopro2gpx==0.1. Invalid script entry point: <ExportEntry gopro2gpx = gopro2gpx.__main__:None []> - A callable suffix is required. Cf https://packaging.python.org/specifications/entry-points/#use-for-scripts for more information.

Screen Shot 2021-04-22 at 10 43 51 AM

UnboundLocalError: local variable 'stream' referenced before assignment

 $ gopro2gpx -v GS051392.360 ~/test

Traceback (most recent call last):
  File "/usr/local/bin/gopro2gpx", line 5, in <module>
    from gopro2gpx.__main__ import main
  File "/home/colin/.local/lib/python3.9/site-packages/gopro2gpx/__main__.py", line 3, in <module>
    main()
  File "/home/colin/.local/lib/python3.9/site-packages/gopro2gpx/gopro2gpx.py", line 148, in main
    data = parser.readFromMP4()
  File "/home/colin/.local/lib/python3.9/site-packages/gopro2gpx/gpmf.py", line 52, in readFromMP4
    print("Working on file %s track %s (%s)" % (self.file, track_number, stream))
UnboundLocalError: local variable 'stream' referenced before assignment

Runtime warning

Hello,

I've installed gopro2gpx in Linux Mint 19.3 using the command
pip3 install git+https://github.com/juanmcasillas/gopro2gpx

When I run gopro2gpx in a terminal as follows
python3 -m gopro2gpx.gopro2gpx -s -v video.MP4 video

I get the following warning (and then gopro2gpx completes successfully):

/usr/lib/python3.6/runpy.py:125: RuntimeWarning: 'gopro2gpx.gopro2gpx' found in sys.modules after import of package 'gopro2gpx', but prior to execution of 'gopro2gpx.gopro2gpx'; this may result in unpredictable behaviour
  warn(RuntimeWarning(msg))

Is this usual?

Martin

TypeError: 'module' object is not callable

After installation with
pip install git+https://github.com/juanmcasillas/gopro2gpx
On my mac 11.3 I have this error

gopro2gpx -s GH011227_saut.MP4 test
GPSFIX change to 3 [lock 3D (ok)]
-- stats -----------------
- Ok:                202
- GPSFIX=0 (bad):      0 (skipped: 0)
- Empty (No data):     0
Total points:        202
--------------------------
Traceback (most recent call last):
  File "/usr/local/bin/gopro2gpx", line 33, in <module>
    sys.exit(load_entry_point('gopro2gpx==0.1', 'console_scripts', 'gopro2gpx')())
TypeError: 'module' object is not callable

gpx and kml are created but the speed is off of more than 300km/h !
With the same file in https://goprotelemetryextractor.com/free/ I can see that I don't have any gps problems and the speed is correct.
Any ideas ?
Thanks

❔ Does this tool take into account split videos?

Since GoPro cameras tend to split large videos into multiple mp4 files, does gopro2gpx take this into account and stitch together the GPMF data from each particular file before generating GPX and KML files?

kml file not being generated

It appears that the output is only producing a GPX file and not a KML file as well (as described in the ReadME).

"TypeError: cannot unpack non-iterable NoneType object" with GoPro 5 videos

This is happening with all the videos I recorded with my GP5:

Traceback (most recent call last):
  File "C:\Users\chris\AppData\Roaming\Python\Python310\Scripts\gopro2gpx-script.py", line 33, in <module>
    sys.exit(load_entry_point('gopro2gpx==0.1', 'console_scripts', 'gopro2gpx')())
  File "C:\Users\chris\AppData\Roaming\Python\Python310\Scripts\gopro2gpx-script.py", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "C:\Python38\lib\importlib\metadata\__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "C:\Python38\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\gopro2gpx\__main__.py", line 3, in <module>
    main()
  File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\gopro2gpx\gopro2gpx.py", line 148, in main
    data = parser.readFromMP4()
  File "C:\Users\chris\AppData\Roaming\Python\Python310\site-packages\gopro2gpx\gpmf.py", line 43, in readFromMP4
    track_number, lineinfo = self.ffmtools.getMetadataTrack(self.file)
TypeError: cannot unpack non-iterable NoneType object

Using Python 3.10.4 on Windows 10 21H2 (build 19044.1645), installed gopro2gpx via pip and it grabbed commit dc512cc

Wrong vertical speed and 2D speed

Hi,
on my mac, with this Hero8 black footage
https://drive.google.com/file/d/1632G6hBeecq4KH8ukYSYOSU1RvS-v53G/view?usp=sharing
and using gopro2gpx and https://djitelemetryoverlay.com/srt-viewer I can see that the vertical speed is going from -448 to 335 km/h and the 2D speed reach 1576 km/h
Capture d’écran 2021-05-04 à 04-05-21 14 49 05

With https://goprotelemetryextractor.com/free/ and the same footage vertical speed is correct from 0 to 8.34 km/h and the 2D speed reach 29 km/h
Capture d’écran 2021-05-04 à 04-05-21 14 52 57

here is my command line. I used #15 version but it did not change the problem

gopro2gpx -v GH011227_saut.MP4 test
Working on file GH011227_saut.MP4 track 3 (Stream #0:3(eng): Data: bin_data (gpmd)
GPSFIX change to 3 [lock 3D (ok)]
-- stats -----------------
- Ok:                202
- GPSFIX=0 (bad):      0 (skipped: 0)
- Empty (No data):     0
Total points:        202
--------------------------
Working on file GH011227_saut.MP4 track 3 (Stream #0:3(eng): Data: bin_data (gpmd)
GPSFIX change to 3 [lock 3D (ok)]
-- stats -----------------
- Ok:                202
- GPSFIX=0 (bad):      0 (skipped: 0)
- Empty (No data):     0
Total points:        202
--------------------------
```

ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with Apple clang version 12.0.0 (clang-1200.0.32.29)

ffprobe version 4.4 Copyright (c) 2007-2021 the FFmpeg developers
  built with Apple clang version 12.0.0 (clang-1200.0.32.29)

GPS data is not parsed

Hello, thanks for this fantastic repo.

Unfortunately, I have not been able to succesfully use it. I have downloaded the samples from the gopro repo (https://github.com/gopro/gpmf-parser) and I have tried both ways you suggest, and I got the following results:

> gopro2gpx Fusion.mp4-- stats -----------------
- Ok:                  0
- GPSFIX=0 (bad):      0 (skipped: 0)
- Empty (No data):     0
Total points:          0
--------------------------
Can't create file. No GPS info in []. Exitting


> gopro2gpx Fusion.mp4 outputfile
Traceback (most recent call last):
  File "/home/henry/.local/bin/.virtualenvs/gopro/bin/gopro2gpx", line 8, in <module>
    sys.exit(main())
  File "/home/henry/.local/bin/.virtualenvs/gopro/lib/python3.8/site-packages/gopro2gpx/gopro2gpx.py", line 191, in main
    main_core(args)
  File "/home/henry/.local/bin/.virtualenvs/gopro/lib/python3.8/site-packages/gopro2gpx/gopro2gpx.py", line 158, in main_core
    raw_data = reader.readRawTelemetryFromMP4(filename)
  File "/home/henry/.local/bin/.virtualenvs/gopro/lib/python3.8/site-packages/gopro2gpx/gpmf.py", line 36, in readRawTelemetryFromMP4
    track_number, info = self.ffmtools.getMetadataTrack(filename)
  File "/home/henry/.local/bin/.virtualenvs/gopro/lib/python3.8/site-packages/gopro2gpx/ffmpegtools.py", line 93, in getMetadataTrack
    return self._getMetadataTrackFromJSON(fname)
  File "/home/henry/.local/bin/.virtualenvs/gopro/lib/python3.8/site-packages/gopro2gpx/ffmpegtools.py", line 171, in _getMetadataTrackFromJSON
    info_string = 'Stream {}[{}], {} ({})'.format(stream['index'], stream['id'], stream['codec_name'], stream['codec_tag_string'])
KeyError: 'id'

It is true when I apply your code to raw data, I correctly get the coordinates:

gopro2gpx -b Fusion.raw  output
GPSFIX change to 3 [lock 3D (ok)]
-- stats -----------------
- Ok:                 19
- GPSFIX=0 (bad):      0 (skipped: 0)
- Empty (No data):     0
Total points:         19
--------------------------

So, I tried to get the raw that as you suggest with my own video, and it seems it is not working:

> ffmpeg -y -i GH010190.MP4 -codec copy -map 0:3 -f rawvideo data.bin
ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libaribb24 --enable-liblensfun --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'GH010190.MP4':
  Metadata:
    major_brand     : mp41
    minor_version   : 538120216
    compatible_brands: mp41
    creation_time   : 2023-01-31T22:01:25.000000Z
    firmware        : H18.03.02.00.00
  Duration: 00:02:11.37, start: 0.000000, bitrate: 39956 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, smpte170m), 1920x1080 [SAR 1:1 DAR 16:9], 39779 kb/s, 60 fps, 60 tbr, 60k tbn, 120 tbc (default)
    Metadata:
      creation_time   : 2023-01-31T22:01:25.000000Z
      handler_name    : GoPro AVC
      encoder         : GoPro AVC encoder
      timecode        : 22:01:25:26
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2023-01-31T22:01:25.000000Z
      handler_name    : GoPro AAC
      timecode        : 22:01:25:26
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2023-01-31T22:01:25.000000Z
      handler_name    : GoPro TCD
      timecode        : 22:01:25:26
    Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 30 kb/s (default)
    Metadata:
      creation_time   : 2023-01-31T22:01:25.000000Z
      handler_name    : GoPro MET
    Stream #0:4(eng): Data: none (fdsc / 0x63736466), 13 kb/s (default)
    Metadata:
      creation_time   : 2023-01-31T22:01:25.000000Z
      handler_name    : GoPro SOS
Output #0, rawvideo, to 'data.bin':
  Metadata:
    major_brand     : mp41
    minor_version   : 538120216
    compatible_brands: mp41
    firmware        : H18.03.02.00.00
    encoder         : Lavf58.29.100
    Stream #0:0(eng): Data: bin_data (gpmd / 0x646D7067), 30 kb/s (default)
    Metadata:
      creation_time   : 2023-01-31T22:01:25.000000Z
      handler_name    : GoPro MET
Stream mapping:
  Stream #0:3 -> #0:0 (copy)
Press [q] to stop, [?] for help
size=     488kB time=00:02:10.00 bitrate=  30.8kbits/s speed=2.73e+04x    
video:0kB audio:0kB subtitle:0kB other streams:488kB global headers:0kB muxing overhead: 0.000000%

> gopro2gpx -b data.bin  output
-- stats -----------------
- Ok:                  0
- GPSFIX=0 (bad):      0 (skipped: 0)
- Empty (No data):     0
Total points:          0
--------------------------
Can't create file. No GPS info in ['data.bin']. Exitting

is there any suggestion you can provide? am I missing something?

Thanks in advance.

ffmpeg version is not being well parsed

Hi Juan, I hope you are doing well.

I am triying your converter using another computer and it seems the version is not being well parsed.

After running the command ffmpeg --version I get:

ffmpeg version N-109745-g7d49fef8b4 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)

So I run your code to get the gps data and I get:

> gopro2gpx GH010200.MP4 output
Traceback (most recent call last):
  File "/home/henry/.virtualenvs/gopro/bin/gopro2gpx", line 8, in <module>
    sys.exit(main())
  File "/home/henry/.virtualenvs/gopro/lib/python3.8/site-packages/gopro2gpx/gopro2gpx.py", line 191, in main
    main_core(args)
  File "/home/henry/.virtualenvs/gopro/lib/python3.8/site-packages/gopro2gpx/gopro2gpx.py", line 152, in main_core
    ffmpegtools = FFMpegTools(ffprobe=config.ffprobe_cmd, ffmpeg=config.ffmpeg_cmd)
  File "/home/henry/.virtualenvs/gopro/lib/python3.8/site-packages/gopro2gpx/ffmpegtools.py", line 40, in __init__
    if self.version.major >= 4:
TypeError: '>=' not supported between instances of 'str' and 'int'

I put a print(self.version) in your code ffmpegtools.py and I get

Version(major='N', medium=109745, minor='g7d49fef8b4')

So I assume there's something wrong with the parser.

The first time I tried your code the ffmpeg version format was like following:

ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)

So I think the problem is with the other format.

TypeError module object is not callable

Running on MacOS Big Sur 11.4, using Python 3.7.9 and running on a virtual environment. Command issued gopro2gpx -s -vvv filename.mp4 filename, MP4 file size is greater than 23GB, output from command line is:

-- stats -----------------
- Ok:              55966
- GPSFIX=0 (bad):      0 (skipped: 0)
- Empty (No data):     0
Total points:      55966
--------------------------
Traceback (most recent call last):
  File "/Users/alex/Movies/gopro_gpx_env/bin/gopro2gpx", line 33, in <module>
    sys.exit(load_entry_point('gopro2gpx==0.1', 'console_scripts', 'gopro2gpx')())
TypeError: 'module' object is not callable

KML and GPX files still got generated and have content.

How can I collaborate with this repo?

Hello,

is there some donation button or patreon that can help to continue developing this repo?

Suggestion: create labels like Bug Report, Feature Request or Question for issues.

Thanks in advance

missing epoch times

Hi,

I have a video.mp4 created by my GoPro hero 7 black.

I think that the video's gps/data stream has timestamps, because Racerender v 3.7.3 happily accepts the mp4 file, extracts the data from it, and displays the correct date and local time in edit mode.

However, when I try to extract the data using the command
gopro2gpx -s -vvv video.MP4 video
the file video.klm just contains lat/lon values - no times.

Is this a bug in gopro2gpx? Or in my use of it?

Hope you can help.

Martin

KeyError: 'VPTS'

Traceback (most recent call last):
  File "gopro2gpx.py", line 144, in <module>
    data = parser.readFromMP4()
  File "/mnt/c/Users/Chris Olin/gopro2gpx/gpmf.py", line 59, in readFromMP4
    metadata = self.parseStream(metadata_raw)
  File "/mnt/c/Users/Chris Olin/gopro2gpx/gpmf.py", line 98, in parseStream
    klv = KLVData(data,offset)
  File "/mnt/c/Users/Chris Olin/gopro2gpx/klvdata.py", line 32, in __init__
    self.data = fourCC.Manage(self)
  File "/mnt/c/Users/Chris Olin/gopro2gpx/fourCC.py", line 355, in Manage
    return labels[klvdata.fourCC]().Build(klvdata)
KeyError: 'VPTS'

The video used is from the new GoPro MAX, which added a couple new keys to the GPMF spec. VPTS is one, then there's IORI, CORI, and one more I can't remember. I'm pressed for time and can't give much detail. I'll try troubleshooting this and putting in a PR soon if you don't get to it first. GoPro's GPMF repo has details on the new keys.

UnboundLocalError: local variable 'major' referenced before assignment

I am getting this error with the latest ffmpeg:

D:\projects\JS\goPro-to-geoJson\drive\video>gopro2gpx -s -vvv GH010086.MP4 GH010086
Traceback (most recent call last):
File "C:\Program Files\Python\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\Python\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Program Files\Python\Scripts\gopro2gpx.exe_main
.py", line 7, in
File "C:\Program Files\Python\lib\site-packages\gopro2gpx\gopro2gpx.py", line 191, in main
main_core(args)
File "C:\Program Files\Python\lib\site-packages\gopro2gpx\gopro2gpx.py", line 152, in main_core
ffmpegtools = FFMpegTools(ffprobe=config.ffprobe_cmd, ffmpeg=config.ffmpeg_cmd)
File "C:\Program Files\Python\lib\site-packages\gopro2gpx\ffmpegtools.py", line 34, in init
self.version = self.getVersion()
File "C:\Program Files\Python\lib\site-packages\gopro2gpx\ffmpegtools.py", line 49, in getVersion
return Version(major, medium, minor)
UnboundLocalError: local variable 'major' referenced before assignment

The ffmpeg version:
D:\projects\JS\goPro-to-geoJson\drive\video>ffmpeg -version
ffmpeg version 2022-12-15-git-9adf02247c-essentials_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 12.1.0 (Rev2, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
libavutil 57. 43.100 / 57. 43.100
libavcodec 59. 55.100 / 59. 55.100
libavformat 59. 34.102 / 59. 34.102
libavdevice 59. 8.101 / 59. 8.101
libavfilter 8. 52.100 / 8. 52.100
libswscale 6. 8.112 / 6. 8.112
libswresample 4. 9.100 / 4. 9.100
libpostproc 56. 7.100 / 56. 7.100

GoPro 8 file: AttributeError: 'array.array' object has no attribute 'fromstring'

➜  gopro-workflow gopro2gpx GX040143.mp4 data.gpx
Traceback (most recent call last):
  File "/usr/local/bin/gopro2gpx", line 33, in <module>
    sys.exit(load_entry_point('gopro2gpx==0.1', 'console_scripts', 'gopro2gpx')())
  File "/usr/local/lib/python3.9/site-packages/gopro2gpx/gopro2gpx.py", line 148, in main
    data = parser.readFromMP4()
  File "/usr/local/lib/python3.9/site-packages/gopro2gpx/gpmf.py", line 58, in readFromMP4
    metadata = self.parseStream(metadata_raw)
  File "/usr/local/lib/python3.9/site-packages/gopro2gpx/gpmf.py", line 90, in parseStream
    data.fromstring(data_raw)
AttributeError: 'array.array' object has no attribute 'fromstring'

gps frequency on different gopro models

For some reason the gopro hero 10 black has a frequency of 10hz and takes a GPSU time every 10 points. I don't know how it is in the others camera models.

I fixed the bug by taking only the first GPSU time, changing t_delta = 1/10.0 and setting p equal to:

p = gpshelper.GPSPoint(gpsdata.lat, gpsdata.lon, gpsdata.alt, GPSU + datetime.timedelta(milliseconds=len(points) * t_delta * 1000), gpsdata.speed)

This solves my problem, but it may be different in other models, I don't know if there is a way to read the frequency from the metadata or even if it is possible to directly read the timestamp of each gps point.

the matching of framerate of gps and video

Thanks for your sharing code. I have extract .gpx file of mp4 captured by my GoPro Max. I wonder one question: whether every gps point is related to one frame of mp4 file. Or, the framerate of gps and video is totally none-related?

PermissionError: [WinError 5] Access is denied

Dear juanmcasillas,

installed python and gopro2gpx to extract GPS data from my MP4 files. With some trouble I activated python and your program. But when I try to extract data from a MP4 files I am stuck with "PermissionError: [WinError 5] Access is denied " error. It seems the call to FFMPEG is not going well. I am not familiar with Python or FFMPEG. Searched the internet on the error, found a number of hits but did not find a solution. Maybe you have an idea what might be wrong.

c:\Python39\Scripts>python -m gopro2gpx-script -vvv GX020115.mp4 d:\test
Traceback (most recent call last):
File "C:\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Python39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "c:\Python39\Scripts\gopro2gpx-script.py", line 33, in
sys.exit(load_entry_point('gopro2gpx==0.1', 'console_scripts', 'gopro2gpx')())
File "c:\Python39\Scripts\gopro2gpx-script.py", line 25, in importlib_load_entry_point
return next(matches).load()
File "C:\Python39\lib\importlib\metadata.py", line 77, in load
module = import_module(match.group('module'))
File "C:\Python39\lib\importlib_init
.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 664, in _load_unlocked
File "", line 627, in load_backward_compatible
File "", line 259, in load_module
File "C:\Python39\lib\site-packages\gopro2gpx-0.1-py3.9.egg\gopro2gpx_main
.py", line 3, in
File "C:\Python39\lib\site-packages\gopro2gpx-0.1-py3.9.egg\gopro2gpx\gopro2gpx.py", line 148, in main
File "C:\Python39\lib\site-packages\gopro2gpx-0.1-py3.9.egg\gopro2gpx\gpmf.py", line 43, in readFromMP4
File "C:\Python39\lib\site-packages\gopro2gpx-0.1-py3.9.egg\gopro2gpx\ffmpegtools.py", line 40, in getMetadataTrack
File "C:\Python39\lib\site-packages\gopro2gpx-0.1-py3.9.egg\gopro2gpx\ffmpegtools.py", line 18, in runCmd
File "C:\Python39\lib\subprocess.py", line 505, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Python39\lib\subprocess.py", line 951, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Python39\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
PermissionError: [WinError 5] Toegang geweigerd

Thanks a lot in advance.

TypeError: a bytes-like object is required, not 'NoneType'

Experienced this issue with the MP4 file as well as an extracted BIN GPMF. Other files seem to work fine so there's something specific about this one. Camera is a Hero 8 Black. It was running the GoPro Labs firmware when this video was captured, but no strange settings were enabled.

gopro2gpx -v -b GX010335.bin GX10335
Reading binary file GX010335.bin
Traceback (most recent call last):
File "C:\Program Files\Python39\Scripts\gopro2gpx-script.py", line 33, in
sys.exit(load_entry_point('gopro2gpx==0.1', 'console_scripts', 'gopro2gpx')())
File "C:\Program Files\Python39\Scripts\gopro2gpx-script.py", line 25, in importlib_load_entry_point
return next(matches).load()
File "C:\Program Files\Python39\lib\importlib\metadata.py", line 77, in load
module = import_module(match.group('module'))
File "C:\Program Files\Python39\lib\importlib_init_.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 664, in _load_unlocked
File "", line 627, in load_backward_compatible
File "", line 259, in load_module
File "C:\Program Files\Python39\lib\site-packages\gopro2gpx-0.1-py3.9.egg\gopro2gpx_main
.py", line 3, in
File "C:\Program Files\Python39\lib\site-packages\gopro2gpx-0.1-py3.9.egg\gopro2gpx\gopro2gpx.py", line 150, in main
File "C:\Program Files\Python39\lib\site-packages\gopro2gpx-0.1-py3.9.egg\gopro2gpx\gpmf.py", line 82, in readFromBinary
File "C:\Program Files\Python39\lib\site-packages\gopro2gpx-0.1-py3.9.egg\gopro2gpx\gpmf.py", line 97, in parseStream
File "C:\Program Files\Python39\lib\site-packages\gopro2gpx-0.1-py3.9.egg\gopro2gpx\klvdata.py", line 34, in init
File "C:\Program Files\Python39\lib\site-packages\gopro2gpx-0.1-py3.9.egg\gopro2gpx\fourCC.py", line 391, in Manage
File "C:\Program Files\Python39\lib\site-packages\gopro2gpx-0.1-py3.9.egg\gopro2gpx\fourCC.py", line 133, in Build
TypeError: a bytes-like object is required, not 'NoneType'

In the second and third chapters of the same recording it has a slightly different error:

gopro2gpx -v -s GX020335.mp4 GX020335
Traceback (most recent call last):
File "C:\Program Files\Python39\Scripts\gopro2gpx-script.py", line 33, in
sys.exit(load_entry_point('gopro2gpx==0.1', 'console_scripts', 'gopro2gpx')())
File "C:\Program Files\Python39\Scripts\gopro2gpx-script.py", line 25, in importlib_load_entry_point
return next(matches).load()
File "C:\Program Files\Python39\lib\importlib\metadata.py", line 77, in load
module = import_module(match.group('module'))
File "C:\Program Files\Python39\lib\importlib_init_.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 664, in _load_unlocked
File "", line 627, in load_backward_compatible
File "", line 259, in load_module
File "C:\Program Files\Python39\lib\site-packages\gopro2gpx-0.1-py3.9.egg\gopro2gpx_main
.py", line 3, in
File "C:\Program Files\Python39\lib\site-packages\gopro2gpx-0.1-py3.9.egg\gopro2gpx\gopro2gpx.py", line 148, in main
File "C:\Program Files\Python39\lib\site-packages\gopro2gpx-0.1-py3.9.egg\gopro2gpx\gpmf.py", line 43, in readFromMP4
TypeError: cannot unpack non-iterable NoneType object

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.