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
[FEATURE] Add support for GoPro timelapse videos #30
Comments
It's already supported. Actually, gpx2video isn't able to detect time-lapse / time wrap video. But you can use "--time-factor" option to read gpx and compute telemetry data. |
That would work for fixed factor time wrap videos, but with auto mode, the factor varies in time (at least I think so, I will check on some longer timelapse)... |
Indeed, in this case, it can't work. I have to be able to parse time-lapse settings. |
Hmm, I am rendering some longer video with average time factor computed by hand, when I checked few random points from map recognizable in the video, it was giving roughly the same factor (computed by hand), so maybe time factor is constant per video, I will check the result, if there are some sections that are really off and let you know. Anyway, thanks for |
I have tested on some hilly timelapse video and it is not matching, sometimes numbers seems to be ahead and sometimes behind the video, so it is seems to be not constant time factor. I will put some effort to decode GPS data from gopro, split video by these GPS waypoints and use different time factor for each part and then merge the video into one file again. |
I have created some simple python script using In timelapse video, the number of frames equals the number of GPS records, here is the beggining of a timelapse video:
Maybe it is needlessly complex and constant time-factor timelapse is probably better idea anyway. Feel free to close this, if you do not plan to work on this. |
How do you link video frame number with time ? Can you share your script ? Today, gpx2video doesn’t use gpmf stream except to sync video with gpx data. But I have to add support for time-lapse but accelerometer data too and more. |
Matching to the frames is the main challenge, but I have just compared the number of records that the first example here returned for my video and it was exactly the number of frames for timelapse (also the frequency of 1 second pause in GPS data is variable, that is probably decided by that auto setting). For standard 60 fps video the number of GPS records was around 1/6 of the number of frames. Also gpmf-parser states that hero 11 is recording GPS with 10Hz frequency, which matches nicely (but GPS time in the beginning of any video is inaccurate, even if fix is 3 and not bad precision, I guess it then shifts the internal clock once GPS fix is stable enough and it is fine later on). Also, gpmf-parser is in C, so it might help in this project too. |
Small update, I have recorded timewarp video, speed 15x and used The only solution so far is to record the standard video and speed it up with ffmpeg and then |
Thank you for your work Time factor can be computed from gpmf data. We have to understand how is coded time-lapse factor, Then I have to update gpx2video to read gpx AND gpmf stream during encoding. |
I am not sure if it is possible to read 2 streams (video and gpmf) as they go sequentially in MP4 file (if it was possible, it would be probably the best option). If that is not possible, gpx2video could go through gpmf stream, each GPS5 entry contains timestamp (but first few entries are sometimes off, probably if the GoPro time was not GPS corrected yet), and then distribute the entries to frames uniformly. However, this approach would break if there are some realtime sequences in the timewarp video - I have no idea how to map video and gpmf in that case. |
Hmm, I have noticed if I export images to PNG, it goes roughly 2 FPS on my CPU. If I use tiff format, it goes 60 FPS. Then overlaying images to video with ffmpeg and QSV is around 20 FPS on my PC. If I use gpx2video to create video, it goes around 2 FPS - so faster pipeline for me is to write simple script that executes gpx2video image command and then ffmpeg. |
I managed to overlay timelapse video and finally, widget values match the video! I realized, that timelapse video has variable framerate during the process, so it was a challenge to map images to frames. Several passes over the video are required:
So, what I noticed, in timelapse video, it's possible to rely on I am not sure if this process would work for standard video (maybe frequency of |
Great work, I'll study and integrate it it as I'll find a moment. |
I have checked, and in standard time video, the GPS data are evenly distributed evenly every second, so there is no need to sync using metadata. I would add special option, something like |
Are you able to use hardware acceleration? |
Yes. I am using HEVC_QSV codec, but not on very powerfull CPU (laptop i7). |
Hi, Finally I have started to work about timelapse and mainly about GPMF parsing during video rendering. If you run gpx2video tool in command line with options :
I have added new informations :
As you can read, for each frame, I print GPMF extract information. And I can compute timelapse factor (without using GPS data since removed into the GoPro 12) I'm going to continue to work about it. Now I should be able to render each widget from GPMF or GPX (in adding "source" param for each widget inside the layout file). And we can compare computed speed from GPMF or GPX. I need to test timelapse factor... is it possible to have "9" as value, or only 0.5 ; 1 ; 2 ; 5 ; 10 ; 30.... I need to test timelaspse with auto value too. Then, gpx2video take in count the timelaspse factor value. Note: code will be re-factor soon. |
Great, thank you for the effort, I currently have python wrapper over gpx2video and ffmpeg. It works fine, but sometimes I need to tune the starting time manually by eye (+- 20 seconds). Not sure why that happens, even the GPS time with POSITION FIX seems to be noticeably off in some videos. Maybe it might be caused by external GPX, I didn't try GPMF stream from GoPro (I believe more my Garmin watch, but maybe it is better to use GPMF). |
As far as, I'm using mainly garmin device to generate GPX file. But I have noticed that I can have 6 to 8 seconds offset between garmin and gopro. So I can't sync garmin GPX with video in using time information. So as I render a video, I'm using gpx2video to extract gpx from gopro. I haven't yet the time to implement auto sync by geoposition in gpx2video, but it's coming. Note: to look the time issue I have just recorded a gopro video in watching the garmin device. To sum up, gopro has the good time and garmin has the good and more accurate position. |
So, I have added a new option value:
But need to work again for timelapse variable value. It seems to work as expected for constant value. But there are some issues with variable value :( |
Now seems work. I have to fix widget computed values (speed, avg speed...) but time seems ok. |
It would be nice to have support for timelapse videos. This might be a bit tricky. If I am not wrong, GoPro is using variable video speed while taking timelapse in default setting (speed: auto), so distribution of GPX waypoints might not be uniform thoughout the video. But, it should be possible to pair every GPS fix timespamp from the video to the closest waypoint timespamp from GPX file and then distribute rest of GPX waypoints to the video frames between GPS marks in the video.
I see the comment in README stating some GPX interpolation is maybe planned, this seems a bit different direction, but might be related to that.
Thank you!
The text was updated successfully, but these errors were encountered: