VTCompressionSessionEncodeFrame performance decrease

Our team use videotool box to do hardware-accelerated decoding and encoding. From iphone 6 to 7 plus, the performance of encoding increases, and it takes less time to transcode a video. However, the time spent on VTCompressionSessionEncodeFrame increases drastically on iphone 8 and newer models. For example, it takes about 650 us to encode a 720p frame on iphone 8 but 4100 us on iphone xs max. The other problem is, when i compare our app to a simple video recording app (both encode in 1080p), the time we spent on VTCompressionSessionEncodeFrame is almost 8 times as the recoding app. Is this normal?

  • Hello,have you solve it? I meet the same question. It's really strange.

Add a Comment

Replies

So after some experiment, i have the conclusion now. The encode API VTCompressionSessionEncodeFrame will cosume much more time when you increase the frequency of calling it. In our circumstance, the performance of video rendering(mainly GLES) increases on higher models, so we call VTCompressionSessionEncodeFrame more frequently. Those all together result in more video encoding time on higher models. But this phenomenon only become noticeable on iphone 8 and the models above it. And the same problem can be reproduced when you use AVAssetWriter(if you use GPUImage) to encode video. Even you set kVTCompressionPropertyKey_AllowFrameReordering equal to false and kVTCompressionPropertyKey_RealTime equal to true to decrease encoding time. The problem stays the same, a encoder under the same configutation will cosume more time on higher models, starting from iphone 8.

Does anyone has a feasible solution for this?