-
-
Notifications
You must be signed in to change notification settings - Fork 90
GPMF Emulation #1
Comments
That's amazing work. Thanks for sharing, I was wondering if anyone else had tried something similar before. Your clip shows that there is some merit to the method. Another issue (I think) with tricking ReelSteady Go with fake GPMF data, is the lack of camera calibration/lens undistortion presets for non-GoPro Cameras. It seems to work decently well in your example, but I doubt it will work well for cameras with a completely different FOV/distortion. I also wanted to try to make something from scratch, which is why I started this project. Hopefully I can figure something out with automatic gyro sync by comparing waveforms programmatically. Small vibrations will probably be hard/impossible to stabilize out as you mentioned, but for now the goal for non-GoPro footage will be to smooth out the user stick input, which should get good results on a low vibration quad + ND filter. The newer Runcams have a built-in gyro for doing in-camera stabilization. Maybe, just maybe, It'll be possible to log that data with a new firmware. It could also be fun to design a PCB for external logging like the virtualGimbal project, but we'll see. Oh, and I would love to take a look at your code. The gyro interpolation code could be useful for what I need to implement. |
Here are the scripts gopro.zip. Some of the scripts were actually stand alone tests and have no relation to the overall project but I have left everything in. If both offsets are equal it means the video and fc clock are ticking in sync and there's no The general logic is as follows:
Besides the GPMF track there's some additional meta data (in the beginning of the Since RSTG is written in Unity it is quite easy to dig inside it using dnSpy and UnityAssetsBundleExtractor. After the basic video data is read, the correct preset is chosen among these: If the source video is 1920x1080 for example the For example, for my video footage with Runcam 3 I have used the So yes, the closer the lens of our camera is to that of gopro - the better. For example if I work on my runcam3 footage with the superview preset the results, as it can be expected, are very distorted. But it seems that the
I have written my own routines for mp4 and gpmf. It turned out that they are quite clear formats so using external libs was not that necessary and furthermore I had to do it in order to understand better their structures. The virtualGimbal project is interesting. In what format does it expect the gyro data? Wouldn't it be possible to convert our bbox data to their format? If I have missed something, please write back and I'll try to explain further. Best~ |
This is absolutely awesome. I'll take a look :) |
Yes, that line is not needed. I'm not sure if the script works as a whole. I don't remember in what state I've left the work. Everything was in active developing, commenting, add, removing code, so I'm not sure if the script is working properly. For example line 45 |
Today I had some success with your code. |
@Cleric-K |
Unless i have missunderstood the explanation, you would probably need to edit the metadata used to identify the camera preset, this seems to be configured in the templates.py file ( |
I don't have the possibility to look into this now but my guess is that, as @soukron says, it'll be needed to get real gopro 4k movie file and get the meta from there. There's one additional caveat. Normally the mp4 format uses 32bit numbers for offsets. This means that file size can not exceed ~4GB (2^32 bytes). Of course, the format has been extended and it does support special kind of offsets that are 64bit. Unfortunately, the scripts do not support this. So if your 4K clip exceeds 4GB it will most certainly not work. |
@Cleric-K |
I extracted the udta binary information from the mp4 but I cannot figure how to convert it to the escaped format used in template file. |
There are different way. One is to use python. If you have the data in a file f = open('meta', 'rb')
print ( repr(f.read()) ) |
@Cleric-K |
Do you get the same much wider format when processing the original gp file? |
@Cleric-K |
Great job! The side-by-side video actually show the results to be pretty good IMO. |
@Cleric-K |
@Cleric-K |
No I don't. If you want you can make your own project. If not, I can make a repo in my account and I'll give you developer access. |
@Cleric-K |
I've created https://github.com/Cleric-K/BlackboxToGPMF |
@Cleric-K hi Cleric-K i wanna ask you can u send me ur email ? thanks |
@Cleric-K |
Great! Let's hope it will see development. @Fifi1717 just write here |
Hey @attilafustos nice work on the UI. Taking some inspiration from that I added a barebone stabilization UI to gyroflow as well to make testing easier. At the moment it only works (with some bugs) when used with GoPro files with internal metadata. Only a few tests using blackbox data were done a while ago, where I was having some difficulty using it with automatic sync (maybe because of the higher sample rate and slight orientation offsets). I was wondering if you would be willing to send me a copy of the modified runcam file to try out and help with generating a lens correction profile for it? If reelsteady can be tricked into thinking it's a gopro file, then maybe gyroflow can be tricked as well. |
I need a way to read the video width/height without using external library? |
At the moment I can't look into this but you can use https://sourceforge.net/projects/mp4-inspector/ |
Yeah, you'll have to find that in roundabout way. If we knew the exact structure of the Gopro meta we would know, but now we have to use tricks. Open the file in Mp4 inspector, right click on the file in the tree and expand all. |
Thank you |
@Cleric-K |
Jaromeyer (who worked on the blackbox2gpmf project) has done something similar with rsgopatcher, where he modified the acceleration data from the original file for use with horizon lock: https://github.com/jaromeyer/rsgopatcher |
I got to the point that I read the original gpmf and I write it back to the resulting mp4. |
@Cleric-K |
@Cleric-K - +1 on @attilafustos's request - Any chance for more Readme explanation on the the process? (or have a visual solution for a Mac). I really like the concept and wants to try it with a Vista DVR video. |
I have created a Discussion section at the project page and propose that we move the talk there. |
Hi,
I just wanted to let you know that I have done something similar for myself some time ago.
I wanted to use ReelSteadyGo so I had to fabricate the GPMF track into the mp4 container.
I was successfully able to do this, by converting the blackbox gyro data into GPMF format and RSTG was fooled to accept it.
I was thinking about packaging all up as a project and publish it but didn't have the time and motivation to do it. In my case I was doing it by a bunch of standalone python scripts that require somewhat low lever understanding of how things work.
The main reason I don't feel strong motivation to make it public is because even if it is packaged in nice wizard-like interface there's still considerable manual work to be done which I guess will put off most average users.
Probably the most tricky part is getting the synchronization between the video and the blackbox data right. Of course, this is done with Blackbox explorer, but in my case it seems that the clocks of the video and FC are running at slightly different rate. For example if I sync the video at the beginning of the BB log then at the end it has already drifted. And vice versa - if I sync at the end, then the at the beginning it is incorret. That's why I had to sync at the beginning, write down some numbers, then sync at the end and write down again. Then these both sync points are used in the script to interpolate. It works, of course, but all this is getting quite laborsome for the normal user. Also the syncing in BB explorer must be done quite accurately, which requires some skills too.
In the end run, everything works but it is a hassle.
If you are interested I can share with you my work and you can use it in any way you like. Honestly, I don't know if I'm ever going to work on this on my own to make it public.
Here's an example. It is shot with Runcam 3, integrated the gyro data and run through RSTG. The results are plausible overall. I suspect that it might never be quite perfect, because if the camera is softmounted the microvibrations can quite easily be out of phase with these of the FC. For this reason I doubt that propwash can be properly eliminated but I guess in some cases it will work fine.
https://www.youtube.com/watch?v=CYlGe_PhRLg
Best~
The text was updated successfully, but these errors were encountered: