I'm trying to optimize my video space encoding by setting my keyframe frequency to be once every 25 frames at 5fps instead of once per second. I'm doing this using the VideoEncoder.setKeyframeFrequency()
function, but it doesn't appear to change the behavior. Now, as far as I know there is no way to actually tell which frames are keyframes as you don't expose that in the ImgFrame
class. However, I can tell by looking at the data sizes what are likey keyframes. Below I posted introspection to my frames and you'll notice a clear spike in bytes (about 10-100x increase) every 5 frames, which is once per second. This matches my expectation for keyframe insertion.
Based on this post here, it seems like the camera sets keyframe frequency to match FPS by default, although this FAQ is very very old at this point.
Any ideas why the setKeyframeFrequency()
wouldn't be working properly?
2024-03-21 17:18:09,026 [DEBUG]: -------------------------------------
2024-03-21 17:18:09,032 [DEBUG]: seqNum: 14160, bytes: 377308
2024-03-21 17:18:09,225 [DEBUG]: -------------------------------------
2024-03-21 17:18:09,234 [DEBUG]: seqNum: 14161, bytes: 9718
2024-03-21 17:18:09,417 [DEBUG]: -------------------------------------
2024-03-21 17:18:09,425 [DEBUG]: seqNum: 14162, bytes: 8852
2024-03-21 17:18:09,617 [DEBUG]: -------------------------------------
2024-03-21 17:18:09,625 [DEBUG]: seqNum: 14163, bytes: 7359
2024-03-21 17:18:09,817 [DEBUG]: -------------------------------------
2024-03-21 17:18:09,824 [DEBUG]: seqNum: 14164, bytes: 7324
2024-03-21 17:18:10,028 [DEBUG]: -------------------------------------
2024-03-21 17:18:10,034 [DEBUG]: seqNum: 14165, bytes: 377875
2024-03-21 17:18:10,219 [DEBUG]: -------------------------------------
2024-03-21 17:18:10,231 [DEBUG]: seqNum: 14166, bytes: 8458
2024-03-21 17:18:10,418 [DEBUG]: -------------------------------------
2024-03-21 17:18:10,440 [DEBUG]: seqNum: 14167, bytes: 6521
2024-03-21 17:18:10,618 [DEBUG]: -------------------------------------
2024-03-21 17:18:10,626 [DEBUG]: seqNum: 14168, bytes: 6219
2024-03-21 17:18:10,821 [DEBUG]: -------------------------------------
2024-03-21 17:18:10,826 [DEBUG]: seqNum: 14169, bytes: 7261
2024-03-21 17:18:11,027 [DEBUG]: -------------------------------------
2024-03-21 17:18:11,032 [DEBUG]: seqNum: 14170, bytes: 339044
2024-03-21 17:18:11,220 [DEBUG]: -------------------------------------
2024-03-21 17:18:11,227 [DEBUG]: seqNum: 14171, bytes: 6141
2024-03-21 17:18:11,419 [DEBUG]: -------------------------------------
2024-03-21 17:18:11,427 [DEBUG]: seqNum: 14172, bytes: 8766
2024-03-21 17:18:11,619 [DEBUG]: -------------------------------------
2024-03-21 17:18:11,627 [DEBUG]: seqNum: 14173, bytes: 7560
2024-03-21 17:18:11,819 [DEBUG]: -------------------------------------
2024-03-21 17:18:11,827 [DEBUG]: seqNum: 14174, bytes: 6809
2024-03-21 17:18:12,032 [DEBUG]: -------------------------------------
2024-03-21 17:18:12,038 [DEBUG]: seqNum: 14175, bytes: 423628
2024-03-21 17:18:12,226 [DEBUG]: -------------------------------------
2024-03-21 17:18:12,237 [DEBUG]: seqNum: 14176, bytes: 8527
2024-03-21 17:18:12,420 [DEBUG]: -------------------------------------
2024-03-21 17:18:12,428 [DEBUG]: seqNum: 14177, bytes: 8953
2024-03-21 17:18:12,620 [DEBUG]: -------------------------------------
2024-03-21 17:18:12,628 [DEBUG]: seqNum: 14178, bytes: 7616
2024-03-21 17:18:12,820 [DEBUG]: -------------------------------------
2024-03-21 17:18:12,828 [DEBUG]: seqNum: 14179, bytes: 6790
2024-03-21 17:18:13,033 [DEBUG]: -------------------------------------
2024-03-21 17:18:13,040 [DEBUG]: seqNum: 14180, bytes: 423470
2024-03-21 17:18:13,221 [DEBUG]: -------------------------------------
2024-03-21 17:18:13,228 [DEBUG]: seqNum: 14181, bytes: 9263
2024-03-21 17:18:13,421 [DEBUG]: -------------------------------------
2024-03-21 17:18:13,429 [DEBUG]: seqNum: 14182, bytes: 6707
2024-03-21 17:18:13,621 [DEBUG]: -------------------------------------
2024-03-21 17:18:13,629 [DEBUG]: seqNum: 14183, bytes: 6749
2024-03-21 17:18:13,822 [DEBUG]: -------------------------------------
2024-03-21 17:18:13,830 [DEBUG]: seqNum: 14184, bytes: 6139
2024-03-21 17:18:14,032 [DEBUG]: -------------------------------------
2024-03-21 17:18:14,038 [DEBUG]: seqNum: 14185, bytes: 339444
2024-03-21 17:18:14,222 [DEBUG]: -------------------------------------