juanmcasillas / gopro2gpx

Parse the gpmd stream for GOPRO moov track (MP4) and extract the GPS info into a GPX (and kml) file.
GNU General Public License v3.0
181 stars 50 forks source link

ffmpeg version is not being well parsed #40

Closed hdnh2006 closed 1 year ago

hdnh2006 commented 1 year ago

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.

juanmcasillas commented 1 year ago

Good Morning !

I fixed the code to support the weird version coding for ffmpeg. Really, we only use the major, so I refactor lightly the code to support the version as a constant, and map the version numbers acordly. Please use the latest version in repo and try again. I hope it works!

Thanks!

hdnh2006 commented 1 year ago

Wow, I didn't know that.

Ok, I tried again this new version and it returns a similar error:

gopro2gpx GH010220.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 41, in __init__
    if self.version.major >= FFMpegTools.MAJOR_VERSION:
TypeError: '>=' not supported between instances of 'str' and 'int'

I let you know both values you compare in your code:

print(FFMpegTools.MAJOR_VERSION)
print(self.version.major)
4
N

If it is too much problem to change the code, I can try in my other PC.

juanmcasillas commented 1 year ago

Sorry for the bug. Fixed in last commit

hdnh2006 commented 1 year ago

It works!!!

> gopro2gpx GH020208.MP4 output
GPSFIX change to 3 [lock 3D (ok)]
-- stats -----------------
- Ok:              10817
- GPSFIX=0 (bad):      0 (skipped: 0)
- Empty (No data):     0
Total points:      10817
--------------------------

Thanks so much again!!