Algosyntax Logo

Convert FFrameTime and FFrameNumber To Seconds

Converting FFrameTime and FFrameNumber to seconds while working with UE5 Sequencer API or other keyframe-based  systems in unreal engine.

This tutorial aims to be a soft landing for anyone needing to convert an FFrameTime to seconds while working with Sequencer API or otherwise. We also cover the reverse which is converting Seconds to FFrameTime.

Working With FFrameTime and Seconds

To convert seconds to FFrameTime or FFrameTime we will always need the framerate which is of class FFrameRate.

  1. How To Get FFrameRate In Unreal Engine

Both the UMovieScene and the UMovieScenePlayer are always aware of the FFrameRate of the Sequence. So depending on the class you currently have access to,  there should be a function to call to get the FFrameRate. For you movie scene it’s UMovieScene::GetTickResolution().
For other classes it maybe as simple as GetFrameRate(). Nonetheless there should be a function to get the FrameRate.

  1. How To Convert FFrameTime To Seconds

To convert FFrameTime to Seconds you need to divide it by the FFrameRate of the UMovieScene you’re currently working with. 

				
					double seconds=FFrameTime/FFrameRate;
				
			
  1. How To Convert Seconds To FFrameTime

To convert Seconds to FFrameTime you need to multiply it by the FFrameRate of the UMovieScene you’re currently working with. This is the opposite of the equation used to convert FFrameTime to Seconds.

				
					FFrameTime = Seconds*FFrameRate;
				
			

Working With FFrameNumber and Seconds 

You can work with FFrameNumber almost the same way as you with FFrameTime. FFrameTime seems to include subframes while FFrameNumber does not. Infact, the calculation to get the seconds is the same. 

  1. How To Convert FFrameNumber To Seconds in unreal engine

The calculations for FFrameNumber to seconds are the same with FFrameTime. You can just divide with the FFrameRate to get the seconds

				
					//Get FrameRate...

Seconds=FFrameNumber/FFrameRate;
				
			
  1. How To Convert FFrameNumber To FFrameTime in unreal engine

You can create an FFrameTime from FFrameNumber by using the FFrameTime constructor. FFrameTime has a constructor that takes in an FFrameNumber and from that you will get the FFrameTime.

5/5

Welcome to our audio and rhythm plugins collection! With MidiEngine, you can easily import MIDI files and use midi events to create engaging rhythm gameplay or enhance your videos.

4.5/5

Plugin that helps add UMG Widgets to Level Sequences for Text Layers, Movie Titles, 2D layers and more… directly within sequencer. Cross platform.

5/5

Let your end users Split And Resize The UI at runtime. Perfect for both games and Applications.

Consider investing in some of our plugins. They might save you some time.  Also helps supports these tutorials.

Instantly get access to our plugins like Blender Curves Importer and UMG Cinematics and more when  you support us on Patreon!

 Join Us On Discord For More Daily Tips!