Wowza Community

onBeforeScaleFrame and frame rate

Hi,

I am developing a dynamic overlaying module and actually I don’t understand what is the relation between the invocation frequency of “onBeforeScaleFrame” and the frame rate of my incoming stream to be transcoded. The generated Javadoc in the Server Side API does not contain a single line of documentation for this API call. (Actually it does so for most of the things…)

I experimented with different frame rated input H.264 streams and based on my measurements, this method is called every ~120…130ms regardless of the frame rate.

Please explain why “onBeforeScaleFrame” is not called more frequently for higher frame rated video streams, and what is the exact relation between the invocation rate and the frame rate. The method name would suggest me a one to one relationship.

Thanks,

wtb

Hi,

This is called every frame, as it is called each time before it is scaled, hence the name.

What I would do is make your code as basic as possible to reduce the time it maybe taking for your code to do any additional processing. It is very important any custom code can keep up with the frame rate required.

Andrew

Hi Andrew,

thanks for the quick response. According to your hint, I added a logging to see how long does my method run. Please check this log snipped below, as you can see my method is around 1ms and it is only invoked 7…8 times per second, regardless of the FPS (I tried 10,20,25). As you can see in this particular case the fps was 25.

What’s wrong?

17:47:18 INFO server comment - LiveStreamPacketizerCupertino.handlePacket[clampexample1/definst/myStream_360p][avc1.77.21]: H.264 Video info: {H264CodecConfigInfo: code

c:H264, profile:Main, level:2.1, frameSize:480x360, displaySize:480x360, frameRate:25.0, PAR:1:1, crop: l:0 r:0 t:0 b:4}

17:47:18 INFO server comment - LiveStreamPacketizerSmoothStreaming.startStream[clampexample1/definst/myStream_360p]

17:47:18 INFO server comment - onBeforeScaleFrame took 0ms

17:47:19 INFO server comment - onBeforeScaleFrame took 0ms

17:47:19 INFO server comment - LiveStreamPacketizerPacketHandler.handlePacket[clampexample1/definst/myStream_source]: Video codec:H264 isCompatible:true

17:47:19 INFO server comment - onBeforeScaleFrame took 1ms

17:47:19 INFO server comment - onBeforeScaleFrame took 0ms

17:47:19 INFO server comment - onBeforeScaleFrame took 0ms

17:47:19 INFO server comment - LiveStreamPacketizerPacketHandler.handlePacket[clampexample1/definst/myStream_360p]: Video codec:H264 isCompatible:true

17:47:19 INFO server comment - LiveStreamPacketizerPacketHandler.handlePacket[clampexample1/definst/myStream_160p]: Video codec:H264 isCompatible:true

17:47:19 INFO server comment - onBeforeScaleFrame took 0ms

17:47:19 INFO server comment - onBeforeScaleFrame took 1ms

17:47:19 INFO server comment - onBeforeScaleFrame took 1ms

17:47:19 INFO server comment - onBeforeScaleFrame took 0ms

17:47:20 INFO server comment - onBeforeScaleFrame took 0ms

17:47:20 INFO server comment - onBeforeScaleFrame took 0ms

17:47:20 INFO server comment - onBeforeScaleFrame took 0ms

17:47:20 INFO server comment - onBeforeScaleFrame took 0ms

17:47:20 INFO server comment - onBeforeScaleFrame took 0ms

17:47:20 INFO server comment - onBeforeScaleFrame took 1ms

17:47:20 INFO server comment - onBeforeScaleFrame took 0ms

17:47:21 INFO server comment - onBeforeScaleFrame took 0ms

17:47:21 INFO server comment - onBeforeScaleFrame took 0ms

17:47:21 INFO server comment - onBeforeScaleFrame took 1ms

17:47:21 INFO server comment - onBeforeScaleFrame took 0ms

17:47:21 INFO server comment - onBeforeScaleFrame took 1ms

17:47:21 INFO server comment - onBeforeScaleFrame took 0ms

17:47:21 INFO server comment - onBeforeScaleFrame took 1ms

17:47:21 INFO server comment - onBeforeScaleFrame took 0ms

17:47:22 INFO server comment - onBeforeScaleFrame took 0ms

17:47:22 INFO server comment - onBeforeScaleFrame took 0ms

17:47:22 INFO server comment - onBeforeScaleFrame took 0ms

17:47:22 INFO server comment - onBeforeScaleFrame took 0ms

17:47:22 INFO server comment - onBeforeScaleFrame took 0ms

17:47:22 INFO server comment - onBeforeScaleFrame took 0ms

17:47:22 INFO server comment - onBeforeScaleFrame took 0ms

17:47:22 INFO server comment - onBeforeScaleFrame took 0ms

17:47:23 INFO server comment - onBeforeScaleFrame took 0ms

17:47:23 INFO server comment - onBeforeScaleFrame took 1ms