switch main frame rate determination

This commit is contained in:
2023-03-28 15:21:40 +02:00
parent 955ae46e4f
commit d4605924cb
2 changed files with 5 additions and 4 deletions

View File

@@ -99,16 +99,17 @@ class Handler:
self.duration = self.videometa.get( 'duration' ) self.duration = self.videometa.get( 'duration' )
self.frames = self.videometa.get( 'nb_frames' ) self.frames = self.videometa.get( 'nb_frames' )
try: try:
self.framerate = round(float(self.frames) / float(self.duration), 1) self.infos = str( self.videometa.get( 'r_frame_rate' ) )
self.framerate = float( self.infos[:len(self.infos) - 2] )
except TypeError: except TypeError:
self.infos = str( self.videometa.get("r_frame_rate") )
print( '\n\n=> using fallback method to get framerate' ) print( '\n\n=> using fallback method to get framerate' )
self.framerate = float(self.infos[:len(self.infos) - 2]) self.framerate = round(float(self.frames) / float(self.duration), 1)
print( '==> Video duration is: ', self.duration, 's' ) print( '==> Video duration is: ', self.duration, 's' )
print( '==> Framecount is: ', self.frames, ' frames' ) print( '==> Framecount is: ', self.frames, ' frames' )
print( '==> Frame rate is: ', self.framerate, ' FPS' ) print( '==> Frame rate is: ', self.framerate, ' FPS' )
print( '==> Running with ', threads, ' threads\n\n' ) print( '==> Running with: ', threads, ' threads\n\n' )
time.sleep( 2 ); time.sleep( 2 );