Description
In DaVinci Resolve Studio, when the Gyroflow plugin's filter is applied to a subclip which is a portion of a larger clip with non-zero start timecode, the result is messed up because the gyro data seems to be applied from the start of the larger clip instead of from the start of the subclip.
I checked the fuscript lua script launched from this plugin, and its output does not indicate that the source is a subclip:
$ /opt/resolve/libs/Fusion/fuscript -l lua -x "p = Resolve():GetProjectManager():GetCurrentProject():GetCurrentTimeline():GetCurrentVideoItem():GetMediaPoolItem():GetClipProperty();
print(p['FPS']);print(p['Frames']);print(p['Duration']);print(p['PAR']);print(p['Resolution']);print(p['File Path']);" 2>/dev/null
59.94
90
00:00:01:30
Square
3840x2880
/Volumes/Code/Photos/DJI Album/DJI_20250214115730_0135_D.MP4
So I checked the API docs, and played around in ipython interactive console for a bit, and found the p['Start']
property to be the one we need to fix this. Might also want to consider VideoItem:GetSourceStartFrame()
which also adds the timeline's trimming offset, such that:
MediaPoolItem.GetClipProperty('Start') + TimelineVideoItem.GetLeftOffset() == TimelineVideoItem.GetSourceStartFrame()
For example, the source clip is 59.94 fps and almost a minute long; its subclip starts at 00:00:45.00, ends at 00:00:46.30, so exactly one and a half second long. Say, the timeline is also 59.94 fps and starts at 01:00:00.00 (the default in DaVinci Resolve). The subclip is trimmed by a hald second (30 frames from the start) and placed on at the 01:00:01:00 on the timeline as follow:
$ export RESOLVE_SCRIPT_API="/opt/resolve/Developer/Scripting/"
$ export RESOLVE_SCRIPT_LIB="/opt/resolve/libs/Fusion/fusionscript.so"
$ export PYTHONPATH="$PYTHONPATH:$RESOLVE_SCRIPT_API/Modules/"
$ python
>>> import DaVinciResolveScript as dvr_script
>>> resolve = dvr_script.scriptapp("Resolve")
>>> pManager = resolve.GetProjectManager()
>>> project = pManager.GetCurrentProject()
>>> timeline = project.GetCurrentTimeline()
>>> tvItem = timeline.GetCurrentVideoItem()
>>> mpItem = tvItem.GetMediaPoolItem()
>>> mpItem.GetClipProperty('Start')
2700
>>> tvItem.GetLeftOffset()
30
>>> tvItem.GetSourceStartFrame()
2730
>>> tvItem.GetStart()
216060 # = 01:00:01.00 at 60 fps
>>> tvItem.GetDuration()
60
>>> tvItem.GetEnd()
216120
So in conclusion, the plugin needs to retrieve and somehow account for the clip property 'Start'.