Use-case:
I'm trying to encode a video stream in real-time with VideoToolbox hardware encoder for video streaming.
Issue:
The VTCompressionOutputCallback is being called only after 2 or more frames have been passed to the encoder. The last sent frame is stored in the encoder buffer and gets emitted only after the next frame comes in. This behavior causes the 1 frame delay on the decoder side and thus there is no real-time streaming. I checked various encoder properties: kVTCompressionPropertyKey_RealTime, kVTCompressionPropertyKey_MaxFrameDelayCount, kVTCompressionPropertyKey_MoreFramesAfterEnd, but none of them seems to fix the problem. I am also aware of the CompleteFrames function but calling it after each frame forces encoder to emit keyframes only.
Question:
Is there a possibility to reduce the internal encoder frame buffer size to 0 and set the encoder to operate in a 1-in-1-out manner?
My default encoder settings:
EnableHardwareAcceleratedVideoEncoder = true
MoreFramesAfterEnd = false
MoreFramesBeforeStart = false
Profile = H264_Baseline_AutoLevel
FrameReordering = false
RealTime = true
MaxFrameDelayCount = 0
Thanks