Skip to content

How to correctly set frame rate? #1702

Closed Answered by nagadomi
Zarxrax asked this question in 1. Help
Discussion options

You must be logged in to vote

Fraction(24000/1001)

Fraction(24000, 1001) works.

I encountered the same problem. In the case of my software, users input float value as FPS, so I defined some known FPS to avoid OverflowError. In other cases, limit the int value.

def convert_known_fps(fps):
    if isinstance(fps, float):                                                                
        if fps == 29.97:
            return Fraction(30000, 1001)
        elif fps == 23.976:
            return Fraction(24000, 1001)
        elif fps == 59.94:
            return Fraction(60000, 1001)
        else:
            fps_frac = Fraction(fps)
            fps_frac = fps_frac.limit_denominator(0x7fffffff)
            # if fps_frac…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by Zarxrax
Comment options

You must be logged in to vote
1 reply
@nagadomi
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants