Skip to content
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

timeline.settings.frame_rate not working correctly with framerates that have a decimal #20

Open
Jarnovat opened this issue Jul 28, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@Jarnovat
Copy link

Describe the bug
timeline.settings.frame_rate & project.get_setting("timelineFrameRate") don't return the same value.

To Reproduce
In Davinci Resolve set the following setttings
Timeline framerate 29.97
Project framerate 29.97

Use the following code:

resolve = davinci.Resolve()

project = resolve.project
timeline = project.timeline
framerate = project.get_setting("timelineFrameRate")

timeline.custom_settings(True)
framerate2 = timeline.settings.frame_rate

Expected behavior
framerate and framerate2 should be the same? Instead framerate = 29.97 (correct) and framerate2 = 29.0 (incorrent)

Screenshots
timeline settings
image

project settings
image

the two variables
image

Desktop (please complete the following information):

  • OS: Windows 10
  • Python Version: 3.10.5 (tags/v3.10.5:f377153, Jun 6 2022, 16:14:13) [MSC v.1929 64 bit (AMD64)]
  • Davinci Resolve Version: 18.0.1 Build 3

Additional context
Same can be reproduced with framerates of 59.94 & probably any other which isn't a whole number.
So it probably has something to do with type casting or conversion.

A project & timeline framerate of 60 works as expected. Both return 60.0

@Jarnovat Jarnovat added the bug Something isn't working label Jul 28, 2022
@pedrolabonia
Copy link
Owner

pedrolabonia commented Jul 16, 2023

Hey @Jarnovat,

This is indeed a bug, mentioned in the test cases.

Davinci is really, really finnicky for changing timeline settings. I even described some of the things I encountered here:

https://github.com/pedrolabonia/pydavinci/blob/bd40574085f19245a79111988df171041f530808/pydavinci/wrappers/settings/map.py#L154C1-L154C1

So for example, for using the original API, when you get the framerate it returns a float, and you can only set it as a str.

Besides that, attached is a showcase of how weird changing timeline framerates in Davinci is.

Resolve_fADG2oHLBm.mp4

There's definitely something funky going on with type conversions, probably the pydantic backend. I spend some time trying to figure it out but couldn't really find it. For some reason when pydantic parses it it rounds down the float. I tried using decimal and the same thing happened.

I'll leave this issue open for now because there's something in the code, but I'd also advise not really using the framerate option specially when there's media in the timeline, since for some reason Davinci doesn't let you change the framerate of the timeline when there's media in it, and also you need to enable/disable custom settings as shown in the MP4 above.

Best practice for now would be to do your settings before adding any media to the timeline using

timeline.custom_settings(True)
timeline.set_setting("timelineFrameRate", "59.94")

Otherwise even if pydavinci was fully functioning in that aspect, you would need to do the dance of enabling/disabling custom settings as shown above. Just some Resolve quirks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants