Closed latenitefilms closed 11 months ago
Ummm... I'm getting very strange results. In this case it was working fine:
...in this case it returns nothing:
Even though is looks right in Gyroflow:
...and there's definitely file_metadata
in the saved Gyroflow Project:
I'll keep digging, as it's probably something wrong in my code.
Here's an example of a Gyroflow Project that's failing my doesGyroflowProjectContainStabilisationData()
function:
Ahhh.... I think this might be my issue:
I think the problem why my code fails sometimes is a sandbox issue. gyroflow_core
doesn't actually have read access to the R3D file which contains the gyro data, so the import_gyroflow_data
function in gyroflow_core
doesn't seem to just load the gyro data from the JSON in this case.
This shouldn't be a sandbox issue because there's a check if the file can actually be opened and read in this condition you linked
Ummm... well, then I'm not sure why import_gyroflow_data
isn't populating the file_metadata.raw_imu
and file_metadata.quaternions
values properly then.
I might see if there's a way I can just decompress the file_metadata
outside of gyroflow_core
so that I can better debug what's going on.
It is however getting some data though, just not raw_imu
and quaternions
, so there's some logic error in there somewhere.
For example, if I add the following logging:
I get this:
In this case I've granted gyroflow_core
access to the R3D file too.
Note to self, I tried adding recompute_gyro()
:
...but didn't help:
Doing some more digging into gyroflow_core
and this seems to be the issue:
It seems that is_compressed
is returning false
, when in this case it should be returning true
.
let is_compressed = obj.get("raw_imu").map(|x| x.is_string()).unwrap_or_default();
I tweaked the is_compressed
logic, but still not working:
let is_compressed = obj.get("raw_imu").map(|x| !x.is_string()).unwrap_or(true);
...and further down the rabbit hole I go...
Note to self...
Note to self...
Interestingly... if I open up FCPX, and import the Gyroflow project, without granting Gyroflow Toolbox sandbox access to the R3D it works correctly. It still works correctly when I press Reload Gyroflow Project too.
std::fs::File::open(&gyro_path).is_err(): true
However, if I then delete the Gyroflow Toolbox effect, delete the Gyroflow project at the Finder level, then try and import the R3D file - I get errors.
So the problem isn't in the Gyroflow Project/JSON data itself, and it most likely not in how gyroflow_core
reads the data. It might be some kind of caching in StabilizationManager
?
Ok, I'm not sure why, but I can confirm... I can only get my code to work when gyroflow_core
DOESN'T have access to the R3D
file. If gyroflow_core
can't access the R3D
file (due to the macOS sandbox) then my doesGyroflowProjectContainStabilisationData()
check works as intended. However, if it does have sandbox access, then it will return NO
.
I do think there might be a logic error in is_compressed
in gyroflow_core
- i.e. I think this might be the opposite way around?
let is_compressed = obj.get("raw_imu").map(|x| x.is_string()).unwrap_or_default();
...and I also think there might be some logic error somewhere in here:
} else if gyro_path.exists() && blocking {
if let Err(e) = self.load_gyro_data(&util::path_to_str(&gyro_path), is_main_video, &Default::default(), progress_cb, cancel_flag) {
::log::warn!("Failed to load gyro data from {:?}: {:?}", gyro_path, e);
}
}
Note to self... turned out that the issue I was having with R3D files was due to sandbox permissions.
This has been resolved in: https://github.com/gyroflow/gyroflow/commit/10c8853a1d0a54aac5538e0122665f558c7eadc2
However, the original issue - i.e. the OpenFX bug - still needs to be resolved.
Fixed in https://github.com/gyroflow/gyroflow-ofx/commit/33d71a80c0d6cdacc36cdeeb90b779f50535b504#diff-62a6c326342846993ba024144b4abbf39a3bf82efa6a748164b5062ab8254fc4R928
In GyroflowToolbox you can now use StabilizationManager::project_has_motion_data
Looking at this code:
Currently it's reading the Gyroflow Project JSON as a string, and checking for
raw_imu
andquaternions
strings - however, in the current Gyroflow Project JSON,gyro_source
>file_metadata
is stored as a blob of data - so you'll never find theraw_imu
andquaternions
strings.This should be updated to read the
raw_imu
andquaternions
data from thefile_metadata
contents.However, I'm currently using this code in Gyroflow Toolbox:
...and it returns
NO
for an R3D Gyroflow Project that is synced and working, so I think something is wrong ingyroflow_core
too?