juanmcasillas/gopro2gpx

ffmpeg version is not being well parsed

hdnh2006 opened this issue · 4 comments

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.

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!

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.

Sorry for the bug.
Fixed in last commit

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!!