Output Frame Rate

scalf's picture

I was wondering if there was a way to output the frame rate of a composition, such as to another computer or device via OSC.

When I pull up the fps patch, there are only inputs and no outs. Is there a way to get the fps number into some sort of output?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

smokris's picture
Re: Output Frame Rate

You could implement your own equivalent of the FPS patch by, for example, feeding Patch Time into a JavaScript patch, and examining the delta between the current Patch Time and the previous frame's Patch Time. (And then optionally perform smoothing, so you get an average framerate, rather than instantaneous framerate, if you want less jitter.)

gtoledo3's picture
Re: Output Frame Rate

I have a related question; what's more accurate, the FPS patch, or the FPS counter on the Viewer? I've always taken it that the FPS counter on the Viewer is more accurate, but I've had people express opposing opinion on that. It seems that the FPS patch has to be delivering old(ish) info, and that if it's having to compute/evaluate, it must not be giving as accurate info as the FPS on the viewer. The main utility of it seems to be when one is viewing the composition loaded by something other than QC, yay or nay?

smokris's picture
Re: Output Frame Rate

Accuracy is in the eye of the beholder. Each of those FPS meters you mention measures something different. (I've not personally reverse-engineered them to figure out what they're measuring, though.) Both affect the result they're trying to measure (cf. Heisenberg).

First precisely define what you want to measure. Then develop a way to measure it.

gtoledo3's picture
Re: Output Frame Rate

smokris wrote:
Accuracy is in the eye of the beholder.

Interesting take... things of opinion are in the eye of the beholder, and I'm not sure whether something is accurate of not is one of them. This is akin to the definition of "stable".

smokris wrote:
Each of those FPS meters you mention measures something different. (I've not personally reverse-engineered them to figure out what they're measuring, though.) Both affect the result they're trying to measure (cf. Heisenberg).

First precisely define what you want to measure. Then develop a way to measure it.

What I want to measure is frames rendered per second (I didn't think this needed to be defined, it seems evident from my question). I don't think I need to develop a way to measure this, there are two existing currently. I'll go ahead and take the time to wade through the machine code some time soon. I was asking because I thought you may have taken a look already. It seems likely from that the FPS patch is relying on some "hacks" to get data, and results are likely to be confounded by the poor Editor.

scalf's picture
Re: Output Frame Rate

Great, so it sounds like there is a way to do it.

I am not the best at implementing JavaScript in Quartz yet, is there an example or perhaps another way to do it via visual patches?

The reason for this whole question being posed is so I can monitor FPS on the computer while using a touch interface away from the screen

scalf's picture
Re: Output Frame Rate

Great, so it sounds like there is a way to do it.

I am not the best at implementing JavaScript in Quartz yet, is there an example or perhaps another way to do it via visual patches?

The reason for this whole question being posed is so I can monitor FPS on the computer while using a touch interface away from the screen

jrs's picture
Re: Output Frame Rate

Here is a composition that does it by working out the difference in time between when the current frame rendered and the last frame rendered. As this will vary it adds this value into a queue and takes the average of the last x frames.

I actually did it two ways, one storing the time the frame rendered in the queue and one storing the time between frames in the queue which doesn't work - for some reason every second value in the queue is 0, does anyone know why?

PreviewAttachmentSize
frame rate.qtz8.51 KB
frame rate.qtz - Editor.jpg
frame rate.qtz - Editor.jpg83.29 KB

usefuldesign.au's picture
Re: Output Frame Rate

Mine's same as jrs's except I smoothed the output. Tried to do it with patches once and got a roadblock so settled for JS which maybe adds a few ms to the frame-rate. I guess it's up to you to decide if max/min interval over what period is more what you want which requires slightly different calculations.

PreviewAttachmentSize
fps JS.qtz12.8 KB

scalf's picture
Re: Output Frame Rate

You guys are awesome!!

It works great, I'll be testing it tonight over OSC to an iPad to keep tabs on the FPS.

Thank you all very much!

scalf's picture
Re: Output Frame Rate

Is there any reason why these might be crashing now? I've used them for a while and a new build won't run them very well. Something with the JS side of things, deprecation?