Skip to content

Improve GPS accuracy when locating videos #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Apr 14, 2023
Merged

Conversation

inode64
Copy link
Contributor

@inode64 inode64 commented Apr 11, 2023

[Improve GPS accuracy when locating videos]

Improves the process of finding the correct gps location of the video.
I have reviewed all my gopro videos and made all improvements to improve the accuracy
I have removed the GpsFix and because some videos recorded with the gopro have the correct location but the gpsfix flag was not active, the same thing also happened with the speed there were videos with the correct location but at speed 0

Then I added a process to select the most repeated and next locations so we discard false locations.
we also control the height because it is an indicator of incorrect position.

That's why in the end I added a filter by country so that they discard the false locations, but this generates an infinite loop that makes the videos repeat over and over again.
I have gone crazy and I have not been able to solve it

Please help

All the best

Type:

  • Bug fix
  • New feature
  • Breaking change
  • Documentation

Camera:

  • GoPro
  • Insta360
  • DJI
  • Android
  • This PR adds a new camera

Component:

  • Core logic
  • Import
  • Merging
  • Firmware Update
  • Video Manipulation

Checklist before approval:

  • Linter pass
  • Build pass

inode64 added 5 commits April 10, 2023 21:18
I have reviewed all my gopro videos and made all improvements to improve accuracy
I have removed the GpsFix and because some videos recorded with the gopro have the correct location but the gpsfix flag was not active, the same thing also happened with the speed that there were videos with the correct location but at speed 0

Then I have added a process to select the most repeated and next locations so we discard false locations.
we also control the height because it is an indicator of incorrect position.

That's why in the end I added a filter by country, so that they discard the false locations, but this generates an infinite loop that makes the videos repeat over and over again.
I have gone crazy and I have not been able to solve it

Please help

All the best
Get max country codes from config
@inode64
Copy link
Contributor Author

inode64 commented Apr 13, 2023

I'm done with the improvements.
I have carried out tests with 377 videos from my GoPro HERO11 Black, after analyzing their GPS coordinates and locations that are correct, mmt has improved the effectiveness of the results.

Before:

  • 161 No location
  • 9 badly located
    After:
  • 133 No location
  • 1 Badly located

Try yours with your videos and tell me what you think

all the best

@KonradIT
Copy link
Owner

Looks like your fix broke a test, which is the intended result: https://github.com/KonradIT/mmt/actions/runs/4690562299/jobs/8313820953?pr=109#step:5:117

Make hero6+ble true: https://github.com/KonradIT/mmt/blob/development/pkg/gopro/location_test.go#L18

Let's see if it returns the data

@KonradIT
Copy link
Owner

Holy crap, nice.

Switch hero7.mp4 and hero8.mp4 to true as well. I have my doubts about removing the GNSS lock setting, but it seems to work fine without it.

There are some linting errors as well, to make sure you push code that's linted, run golangci-lint run before every push.

@inode64
Copy link
Contributor Author

inode64 commented Apr 13, 2023

I don't see what the error is generating by golangci-lint

where is the wrong code?

@KonradIT
Copy link
Owner

https://github.com/KonradIT/mmt/actions/runs/4692809139

  • lint: pkg/gopro/location_test.go:16
    • File is not gci-ed with --skip-generated -s standard,default (gci)
  • lint: pkg/gopro/location.go:5
    • File is not gci-ed with --skip-generated -s standard,default (gci)
  • lint: pkg/gopro/location.go:8
    • File is not gci-ed with --skip-generated -s standard,default (gci)
  • lint: pkg/gopro/config.go:32
    • unnecessary conversion (unconvert)

@KonradIT
Copy link
Owner

Don't skip the files. The root of the problem is the deterministic import rule from golangci-lint.

If you use vscode, I recommend you install the Go extension and turn linting on, much easier.

Use gci to sort out the imports: https://github.com/daixiang0/gci

@inode64
Copy link
Contributor Author

inode64 commented Apr 13, 2023

Na que no hay manera con el Lint :-( y ahora hemos sobrepasado el límite de descargas :-(

@KonradIT
Copy link
Owner

Es temporal lo de el api rate limit, en unos minutos lo correre manualmente.

Para arreglar el lint del deterministic import:

go install github.com/daixiang0/gci@latest
gci write --skip-generated -s standard,default .

Comment on lines 16 to 18
// TODO:
// Invalid length ACCL packet
// "Fusion.mp4": true,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comment, file an issue in this repo instead.

@KonradIT
Copy link
Owner

Orden correcto de location.go:

import (
	"bytes"
	"io"
	"math"
	"path/filepath"
	"strings"

	"github.com/codingsince1985/geo-golang/openstreetmap"
	"github.com/konradit/gopro-utils/telemetry"
	mErrors "github.com/konradit/mmt/pkg/errors"
	"github.com/konradit/mmt/pkg/utils"
	"github.com/konradit/mmt/pkg/videomanipulation"
	"golang.org/x/exp/slices"
)

Comment on lines 20 to 24
type Location struct {
latitude float64
longitude float64
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

La struct de Location ya esta definida en el package de utils, con lat / long exportados, de hecho este mismo archivo ya lo usa (utils.Location). Mejor usarlo y no repetir codigo.

@KonradIT KonradIT self-requested a review April 14, 2023 07:30
@KonradIT
Copy link
Owner

Revert go.mod/go.sum changes y pa alante.

@KonradIT KonradIT merged commit b668c74 into KonradIT:development Apr 14, 2023
@KonradIT
Copy link
Owner

gracias!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants