time4tea / gopro-dashboard-overlay

Programs to process GoPro MP4 & Generic GPX/FIT files and create video dashboards & maps
GNU General Public License v3.0
357 stars 51 forks source link

[Discussion] Use of GPX file, joining files, multiple recordings #28

Open tve opened 2 years ago

tve commented 2 years ago

I was thinking a bit on what I would need to be able to use gopro-overlay for my use case. My outings are 1-2 hours long and at the moment I'm turning the camera on/off 'cause the battery only lasts an hour or so. In the end, I may want to watch almost the whole recording for myself with overlay, but I really want to produce a 3-10 minute collage of highlights. So, what I've observed:

Does this sound reasonable? I'm not expecting you to implement everything, I can pitch in too, just want to hear whether this matches others' use-cases too.

time4tea commented 2 years ago

Thanks for your thoughts... if you concatenated the GPX files for the various short trips, then the existing code would work almost without change - just would need to not crop the GPX file to the movie, which is easy. Not sure of the exact command line sequences, but should be do-able.

thereticle commented 2 years ago

If I were to run the ffmpeg command by hand, what is the ffmpeg command for chaining two consecutive but detached videos (I stopped recording and restarted it) without losing telemetry data? I tried to figure it out by examining the ffmpeg.py file and made several attempts, but without success (unfortunately I'm not very experienced).

time4tea commented 2 years ago

Based on a few issues raised with joining MP4s and preserving the metadata, I'm going to look into how this might be done.

paxunix commented 1 year ago

It is possible to use exiftool to extract a cumulative GPX file across multiple source MP4s. Presumably, you can feed that GPX to gopro-overlay. (Forgive my ignorance that I'm not currently aware if the GPX data "stream" will take precedence over the MP4 telemetry stream--I guess in my ideal universe, I can have multiple sources of telemetry and pick and choose amongst them). It seems like all the pieces are available, just need to be glued together suitably.

time4tea commented 1 year ago

I realise not much has happened on this thread for a while... but I'm doing some refactoring that should mean that we can get some movement on this....

panjacek commented 2 weeks ago

My use cases is multiple video files from DJI action 3 with one big GPX/FIT from garmin.

There should be way to take GPS data not from start of GPX, but from timestamps of video +/- offset if time was not properly synced.

I rarely ever record whole ride, but will have many 10-90s videos on 2-5 hour ride. If I follow the guide https://github.com/time4tea/gopro-dashboard-overlay/tree/main/docs/bin#create-a-movie-from-gpx-and-video-not-created-with-gopro for a video mid of my ride it will fail

GPX/FIT file:     2024-08-12T07:24:05+00:00 -> 2024-08-12T14:40:56+00:00
Video File Dates: 2024-08-25T12:17:11+00:00 -> 2024-08-25T12:17:22+00:00
Video file and GPX/FIT file don't overlap in time -  See https://github.com/time4tea/gopro-dashboard-overlay/tree/main/docs/bin#create-a-movie-from-gpx-and-video-not-created-with-gopro

I think there should be an option for the app to take the video and parse gpx file to grab only samples based on video time. VID 14:00 - 14:02 --- GPX data 14:00 - 14:02

Although there should be an option to offset this if needed (if time sync was not perfect e.g. I saw camera was 30s behind garmin).

RaveGun commented 2 weeks ago

I am not on the same situation. I would like to add the overlay to the videos I shot during my cycling tour. I recorded with the Wahoo -> Strava all the rides because I needed the navigation. And from time to time I started the action cam on my bike to get some clips.

The normal way of adding the overly works just that there is an offset of about 30s? The clips fit well in the GPX track so the start end end is not a problem.

I have tried to generate the overlay for the whole GPX and then use this and mix it with the clips but, this is just a pain.

Is it easy to add some sort of a offset parameter to the script?

panjacek commented 1 week ago

Is it easy to add some sort of a offset parameter to the script? I've hacked that together with few other changes on this dirty branch: https://github.com/panjacek/gopro-dashboard-overlay/tree/feat/gpx_partial

now i can specify --offset-gpx to adjust +/- gpx/fit vs video. I've found that on DJI action 3 i can use file-modified attribute, but its always a bit off so i am testing atm with 0.7s offset

gopro-dashboard.py --units-speed kph --offset-gpx 0.7  --use-gpx-only --gpx ./data_file.fit --video-time-end=file-modified SOURCE.mp4 test_zjazd.mp4 

Its still only single video processed at the time with one big FIT/GPX file which i am automatically cutting on fly according to video boundaries. e.g. here during fit processing. https://github.com/panjacek/gopro-dashboard-overlay/blob/feat/gpx_partial/gopro_overlay/fit.py#L64-L71

There is an obvious issue with it as gpx timeseries will contain only data from exact duration of video +/- offset so you don't see full track with current state. e.g. I only see a tiny bit from 3h long ride: image

Maybe I need to cut/skip the processing somewhere else not during loading timeseries phase, but somewhere later in main loop.

For the batch processing of many files I am thinking about best way - process few vids separately then join them in video processing in kdenlive like a normal project. This means a lot of rendering, possibly loosing quality during processing and extra work.

ps. I do not have gopro, but DJI Osmo Action 3 so its raw videos and GPX/FIT data from garmin.