gyroflow / gyroflow-ofx

GNU General Public License v3.0
105 stars 7 forks source link

Use relative path #19

Closed MasterTim17 closed 8 months ago

MasterTim17 commented 1 year ago

Hello, i have my gyroflow file in the directory of my video and though i can use relative path "x.gyroflow" instead of absolute path "D:\Video...\x.gyroflow" but it doesnt work. Can this be implemented?

valenokk commented 1 year ago

I think even better option would be an automatic .gyroflow file suggestion For example I'm trying to stabilise "GX010049.MP4" and there is already "GX010049-1(autozoom).gyroflow" in the same folder. Please, just automagically pick up this file. If there is another file with similar name (say, "GX010049-2(nozoom).gyroflow"), just offer a dropdown menu with this 2 options.

Yeah, dropdown option would be really nice!

AdrianEddy commented 1 year ago

Unfortunately there's no way for the OpenFX plugin to get the clip path, but latest dev version has a workaround using external scripting in Resolve

Unfortunately external scripting is only available in paid Resolve Studio

https://nightly.link/gyroflow/gyroflow-ofx/workflows/build/main/gyroflow-ofx-windows.zip https://nightly.link/gyroflow/gyroflow-ofx/workflows/build/main/gyroflow-ofx-linux.zip https://nightly.link/gyroflow/gyroflow-ofx/workflows/build/main/gyroflow-ofx-macosx.zip

I'll keep bugging Blackmagic for such option in the OpenFX api, but I don't think it will happen, it's not in the OpenFX spec

muepla commented 1 year ago

First of all a big THANKS for providing this OFX Plugin. I am using this plugin on Win11 (NVidia RTX3060 GPU, latest NVidia drivers) in DaVinci Resolve Studio.

The nightly build referenced above (downloaded on Jan 31st) works more efficiently than the release build (1.0.11) from last November but seems to have a GPU memory leak that eventually crashes DaVinci during the export when rendering multiple clips on the timeline. With every clip, the Windows task manager shows that DaVinci is using an additional 100-200MB of GPU memory. This problem is repeatable - Da Vinci crashes when the GPU memory is exhausted.

For testing I switched back to build 1.0.11: The export took a very long time but completed without issues and the GPU memory utilization remained at about 50%.

AdrianEddy commented 1 year ago

@muepla good catch! please try this one and let me know if it's working for you Gyroflow.ofx.bundle.zip

muepla commented 1 year ago

Yes, it is working perfectly now. Thank you very much !

I have been using the plug-in quite a bit and I noticed that I can use the plug-in without ever creating Gyroflow project files for my GoPro video clips because you initialize all the stabilization parameters with default values that are editable in DaVinci. I understand that this will not always work if the gyro-data is not embedded in the video file but it would solve the problem of how to archive the DaVinci project (all the "*.gyroflow" file paths would be invalid after moving the clips to a file server).

Question: a) Do you see any issues using the plugin that way ? b) What would happen if the existing "Load for current file" button would simply copy all the stabilization parameters from a user selectable "*.gyroflow" file to the DaVinci project (there would not be a need to persist the filepath in DaVinci) ?

Speaking of absolute paths: The *.gyroflow files use absolute paths to link to the video files. Shouldn't they use relative paths to make everything archivable ?

Regards Christian

------ Original Message ------ From: "AdrianEddy" @.> To: "gyroflow/gyroflow-ofx" @.> Cc: "muepla" @.>; "Mention" @.> Sent: 2/1/2023 7:39:12 PM Subject: Re: [gyroflow/gyroflow-ofx] Use relative path (Issue #19)

@muepla https://github.com/muepla good catch! please try this one and let me know if it's working for you Gyroflow.ofx.bundle.zip https://github.com/gyroflow/gyroflow-ofx/files/10564258/Gyroflow.ofx.bundle.zip

— Reply to this email directly, view it on GitHub https://github.com/gyroflow/gyroflow-ofx/issues/19#issuecomment-1413068978, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIWT6XZDH23KZG5UIWC4UOLWVMM5BANCNFSM56XIV3OQ. You are receiving this because you were mentioned.Message ID: @.***>

latenitefilms commented 1 year ago

The most recent builds of the OpenFX plugin do actually store the Gyroflow project within the DaVinci Resolve project file.

muepla commented 1 year ago

@latenitefilms Thank you for pointing out the feature... but embedding the Gyroflow projects inside DaVinci does not work with the nightly build OFX plugin dated 2/3/2023:

I edited a 40 video clip timeline using the following method: 1) I created gyrowflow project files for each clip via a bulk export using default settings. 2) I used the Gyroflow OFX plugin in DaVinci and it stabilized everything really, REALLY well. Overall, it was a huge time saver compared to the regular DaVinci stabilization functionality because I didn't have to deal with unwanted stabilization artifacts. 3) I enabled the "Embedd gyroflow data" checkbox for each video clip in DaVinci. 3) After completing the timeline, I moved the clips to a file server for archival but that broke Gyroflow stabilization: The Gyroflow "Project file" field of each clip was (of course) still pointing to the old folder that did not exist anymore.

Some clips showed a "Not synced. Open in Gyroflow" status message and stabilization was disabled. Fixing it by opening it in Gyroflow did not work because the project file was not there anymore.

Some other clips showed a "Project not loaded" status message and stabilization was disabled.

Clicking on the "load for current file" button fixed the problem (even if the .gyroflow project file was missing) but this resets all my stabilization edits made in DaVinci.

latenitefilms commented 1 year ago

This sounds like a bug/oversight. Hopefully @AdrianEddy can jump in with some thoughts.

AdrianEddy commented 1 year ago

@muepla I can't reproduce this. Stabilization works fine for me when I use "Embed .gyroflow data in plugin" and I delete original .gyroflow file. Could you please test again? Did you use .gyroflow file for all your clips, or you used mp4 directly?

AdrianEddy commented 1 year ago

@muepla Try with the latest nightly, same links

muepla commented 1 year ago

Steps to reproduce the problem: 1) create a default .gyroflow file for a video clip via bulk export in the same folder as the clip 2) add video clip to DaVinci timeline. 3) apply Gyroflow plugin in DaVinci to clip and click on 'Load for current file' 4) enable 'embed gyroflow data in plugin' 5) close DaVinci, rename folder with video clip 6) restart DaVinci and then "relink" clip to point it to the new folder

Afterwards, the current nightly build plugin shows a "not synced. Open in Gyroflow" status and stabilization isn't working.

7) Interesting observation: if you click on 'Load for current file' again, stabilization works and remains functional even if you repeat steps 4-6

If you simply delete the .gyroflow file but do not rename folders, stabilization works as long as you embed the gyroflow data in the DaVinci project. I have not looked at your source code, but my guess is that the problem is caused by the absolute filepath of the video clip within the '.gyroflow' project file (basically the issue that I described 3 days ago in this thread). If this gyroflow project file gets embedded in the DaVinci project file, this cannot work if folders get renamed.

I don't program in Rust, but could you use this function before writing the gyroflow project file ?

https://stackoverflow.com/questions/39340924/given-two-absolute-paths-how-can-i-express-one-of-the-paths-relative-to-the-oth

AdrianEddy commented 1 year ago

create a default .gyroflow file for a video clip via bulk export in the same folder as the clip

Which option did you use for that step? Project file, Project file with gyro data, or Project file with processed gyro data?

muepla commented 1 year ago

I used the "Project File" option.

------ Original Message ------ From: "AdrianEddy" @.> To: "gyroflow/gyroflow-ofx" @.> Cc: "Christian M" @.>; "Mention" @.> Sent: 2/5/2023 3:23:54 PM Subject: Re: [gyroflow/gyroflow-ofx] Use relative path (Issue #19)

create a default .gyroflow file for a video clip via bulk export in the same folder as the clip

Which option did you use for that step? Project file, Project file with gyro data, or Project file with processed gyro data?

— Reply to this email directly, view it on GitHub https://github.com/gyroflow/gyroflow-ofx/issues/19#issuecomment-1418281325, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIWT6X7FN35RJGOJ2HSEYM3WWAR7VANCNFSM56XIV3OQ. You are receiving this because you were mentioned.Message ID: @.***>

AdrianEddy commented 1 year ago

I used the "Project File" option.

that's the issue, you have to use Project file with gyro data.

If you just use Project file, then the .gyroflow file only contains path to mp4 file which then plugin reads gyro data from. Resolve doesn't provide video file path, so there's no way I can use relative paths, so you have to export gyro data with the project for this to work.

However, with DJI cameras and GoPro 8 and later, you don't have to export .gyroflow project files at all, you can load mp4 directly in plugin in resolve, and with latest nightly build, it should also save the gyro data in project. Please try that

muepla commented 1 year ago

I can confirm that what you described above works.

However, it is confusing and will lead to errors because users will forget to set the 'embed gyroflow data in plugin' checkbox or they will export the project in GyroFlow without the embedded gyro-data.

I would probably enable the 'embed gyroflow data in plugin' option by default and I would change the wording of the 'Load for current file' button to 'Import Gyroflow project' - that way it is clear that this file is not necessary anymore after the import completes.

AdrianEddy commented 1 year ago

Initially I enabled it by default, but the gyro data for longer videos is pretty big and it's common to have many clips in a single project, and this will slow down loading and working with Resolve big time. Most users won't need this anyway so it shouldn't be enabled by default.

"Load for current file" is not "Import Gyroflow project" This button executes a script against Resolve to get the currently displayed file on the current timeline and tries to load that file to the plugin. This may fail and is only available in paid Resolve Studio.

"Import Gyroflow project" is "Browse"

I now changed it so even if you use "Export project file" (without gyro data) and use "Embed .gyroflow data in project", it will embed with gyro data when you click it, so that case should be solved.

muepla commented 1 year ago

Embedding the gyro data in the DaVinci project works as long as you don't use 'Horizon Lock' option. If horizon lock is enabled, my videos end up with a rotation of 45-90 degrees after the clips were moved to a different folder.

Steps to reproduce: 1) I created .gyroflow files for all GoPro video clips with the 'Project file with gyro data' export option as recommended above. 2) I added the videos to the DaVinci timeline, enabled gyroflow stabilization and enabled the 'embed gyroflow data in plugin' checkbox for all clips 3) I moved the videos to a different folder (in my case I moved all videos of the timeline to my file server for archival) and relinked the videos in DaVinci.

Afterwards, stabilization worked for all clips that did NOT have 'horizon lock' enabled. If horizon lock was enabled (I used "100%") the video clips ended up with very strong rotation (45-90 deg). It seems that the horizontal rotation of the horizon lock functionality got applied multiple times.

Other than that, the plugin performed extremely well (I edited a timeline with about 200 clips).

muepla commented 1 year ago

https://user-images.githubusercontent.com/36519775/221247535-35f4a2b0-c19b-4c54-a84e-632a4b7a0581.mov

@AdrianEddy I have attached a short screen capture that illustrates the problem mentioned above: Once you embed the Gyroflow data in the DaVinci plugin, and you move the source file to different location, the plugin becomes unusable if 'Horizon Lock' gets applied. If 'Horizon Lock' is disabled, everything works.

Is there any way to fix this (this is an absolute show stopper for me) ?

Thanks Christian

AdrianEddy commented 1 year ago

Sorry for late reply, I'm super busy recently. Try latest build now. https://nightly.link/gyroflow/gyroflow-ofx/workflows/build/main/gyroflow-ofx-windows.zip https://nightly.link/gyroflow/gyroflow-ofx/workflows/build/main/gyroflow-ofx-linux.zip https://nightly.link/gyroflow/gyroflow-ofx/workflows/build/main/gyroflow-ofx-macosx.zip

(reload the original files data, the bug was on saving)

muepla commented 1 year ago

Thank you for working on this issue ! I really appreciate you working on this and I can't even imagine what it takes to maintain this wonderful plugin and Gyrowflow executable.

Unfortunately, the bug fix does not work for me (maybe I am doing something wrong): I double checked that the new plugin was installed (it would be helpful to display a version number or compile time in the UI !). I added a video to a timeline, clicked the 'Load for current file' button (without first exporting a .gyroflow file), selected the 'Embed gyroflow data' checkbox and then moved the Horizontal Lock slider to 100%. Everything was working up to that point.

Afterwards I renamed the folder with the video file, relinked the file in DaVinci and (unfortunately) the video appeared 90 deg rotated.

AdrianEddy commented 1 year ago

ok I can confirm this, I'll take a second look tomorrow

AdrianEddy commented 1 year ago

Ok please check again once this completes building: https://github.com/gyroflow/gyroflow-ofx/actions/runs/4271000189

muepla commented 1 year ago

Thank you for working on this !

The bug fix works, if you embed the gyroflow data in DaVinci WITHOUT first generating a '.gyroflow' project file.

The bug fix does NOT work, if you generate gyroflow project files beforehand via the 'Project file with gyro data' or 'Project file with processed gyro data' option and then embed it in DaVinci.

AdrianEddy commented 1 year ago

yes that's correct, it will require new gyroflow version, which is not built yet. It will be solved with the release of v1.5.0 in a few days

AdrianEddy commented 8 months ago

Is this still an issue?

muepla commented 8 months ago

This issue has been fixed and Gyroflow is working very well.

------ Original Message ------ From: "AdrianEddy" @.> To: "gyroflow/gyroflow-ofx" @.> Cc: "Christian M" @.>; "Mention" @.> Sent: 10/17/2023 2:37:34 PM Subject: Re: [gyroflow/gyroflow-ofx] Use relative path (Issue #19)

Is this still an issue?

— Reply to this email directly, view it on GitHub https://github.com/gyroflow/gyroflow-ofx/issues/19#issuecomment-1767133955, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIWT6X3S5TGZGAXC3EAT2G3X73UA5AVCNFSM56XIV3O2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZWG4YTGMZZGU2Q. You are receiving this because you were mentioned.Message ID: @.***>

muepla commented 7 months ago

Related issue (OFX plugin version 1.3.0):

I recently moved a DaVinci video project with Gyroflow OFX stabilization from my file server to a laptop so that I can work on it while being away from home. As usual, I had selected the "embed .gyroflow data in plugin" option. Stabilization of the edited clips worked on the laptop even though file paths had changed but the laptop hung for 30 seconds whenever the playhead in DaVinci moved on to the next video clip. My assumption is that for whatever reason the OFX plugin tried to open the associated *.gyroflow file of the current clip on my file server while the server was not reachable by the laptop (i.e. the network request timed out).

Steps to reproduce: 1) Create a .gyroflow file with the Gyroflow Windows application and save it in the same folder as the corresponding video. 2) Add video to the DaVinci timeline, apply the Gyroflow OFX plugin to the clip and enable the "embed .gyroflow data in plugin" option. 3) Close DaVinci 4) Move video file and associated .gyroflow file to a new location. 5) Relink video file in DaVinci.

Since "embed .gyroflow data in plugin" is enabled everything should work without Gyroflow accessing the *.gyroflow file. If this file used to be stored on an unreachable file server, playback in DaVinci will block until a network timeout occurs.

AdrianEddy commented 7 months ago

@muepla please check if it's fixed in latest dev build of the plugin https://gyroflow.xyz/devbuild/

muepla commented 7 months ago

No, unfortunately the issue is NOT fixed (using the nightly build that is available as of 12/7/23 8pm MST).

Here are the steps again:

1) I exported a DaVinci project on my desktop (with videos hosted on a NAS). This project contains Gyroflow stabilized videos *with .gyroflow files** for each video that are stored in the same folder as the videos on the NAS. All video clips have the option "Embed .gyroflow data in plugin" enabled.

2) I imported the project on my laptop and relinked the videos to a local folder on the laptop. This local folder has an exact copy of all videos and *.gyroflow files as on the NAS.

If the network cable is connected to the laptop (i.e. the laptop has access to the NAS) stabilized playback on the laptop works fine. If the network cable is disconnected, playback hangs for about 30 seconds whenever the playback moves to the next video.

If I remove the gyroflow stabilization from the video clips, playback works because all video files are local (i.e. network access is not required).

For debugging, I have attached a screenshot of the DaVinci process accessing the video and *.gyroflow file on the NAS (file path "\nas\videos\") while the network cable was disconnected.

Screenshot 2023-12-07 201231

muepla commented 7 months ago

[For context see my previous post from a couple of minutes ago]

I did another test with the network cable plugged in. The attached screenshot shows how DaVinci Resolve is accessing the video on the local file system (file path "y:\VIDEOS") as well as the *.gyroflow file and video file on the NAS (file path "\nas\videos\")

The screenshot also shows that the video gets opened/closed repeatedly by the plug-in (there might be an opportunity to optimize this to speed up processing). Screenshot 2023-12-07 205016

AdrianEddy commented 6 months ago

@muepla try now https://gyroflow.xyz/devbuild/

muepla commented 6 months ago

No, unfortunately it is not fixed. Here is another way to reproduce the problem:

1) Install 'Process Monitor' from https://learn.microsoft.com/en-us/sysinternals/downloads/procmon 2) Start Process Monitor, press Ctrl-L to open the Filter window and select "Process Name is resolve.exe" and "path contains blabla" (see attached screenshot).

3) Create a new DaVinci Project and add a GoPro video from a local drive to it (there is no need to save a .gyroflow project file first).

2) Apply the Gyroflow OFX plugin to the video, click on "Load for current file" and select "Embed .gyroflow data in plugin." At this point stabilization should work.

3) Manually change the project file path in the Gyroflow plugin page to contain blabla (you are basically pointing the Gyroflow plugin to a non-existing file). 4) Save the DaVinci project by pressing CTRL-S. This is important ! 5) Restart DaVinci. You will notice that the Process monitor indicates that DaVinci accessed the non-existing file with the name blabla

Note that stabilization still works - i.e. the plugin seems to access the video file and when that fails it loads the stabilization data from the embedded Gyroflow data in the DaVinci project. The current scheme works as long as the machine can quickly determine if the file exists. If, however, the project file is stored on a NAS and if the NAS isn't reachable, DaVinci hangs for about 20 sec and video playback stops.

Screenshot 2023-12-12 185346

Screenshot 2023-12-12 190638

AdrianEddy commented 6 months ago

hmm weird, I tested your scenario with a NAS file which I disconnected, and after todays changes it worked correctly for me (fast load when NAS was disconnected)

muepla commented 6 months ago

Attached is the gyroflow log file with some "warning" entries. During the test run, all video files and .gyroflow files were stored locally with the laptop being disconnected from the network (i.e. all the \\nas\videos file accesses resulted in network timeouts).

gyroflow-ofx.log

p.s. If you do decide to install the Process Monitor you can use a 'path' filter that shows you all network accesses (in my case I would filter with '\\nas\videos'

AdrianEddy commented 6 months ago

hmm, that log file doesn't show any filesystem access to file, the only filesystem function is path_to_url which is pure string function (doesn't involve fs)

AdrianEddy commented 6 months ago

@muepla third time's a charm, let's try now https://gyroflow.xyz/devbuild/

muepla commented 6 months ago

Yes, it seems to work (but I have only tested it very briefly). I'll do more testing during the next few days.

Thank you very much for fixing the bug !

------ Original Message ------ From: "AdrianEddy" @.> To: "gyroflow/gyroflow-ofx" @.> Cc: "Christian M" @.>; "Mention" @.> Sent: 12/13/2023 11:42:33 AM Subject: Re: [gyroflow/gyroflow-ofx] Use relative path (Issue #19)

@muepla https://github.com/muepla third time's a charm, let's try now https://gyroflow.xyz/devbuild/

— Reply to this email directly, view it on GitHub https://github.com/gyroflow/gyroflow-ofx/issues/19#issuecomment-1854517794, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIWT6X4P33HFVUMUUYHSQWLYJHZJTAVCNFSM56XIV3O2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBVGQ2TCNZXHE2A. You are receiving this because you were mentioned.Message ID: @.***>