0

In my work, I try to use iOS VideoToolBox to encode my video from capture. It worked . But when I try to set the fps, it can not work, the video encode stream's fps always is 30.

In my code, I used this code to try to set fps (but it not work)

status =VTSessionSetProperty(EncodingSession, kVTCompressionPropertyKey_ProfileLevel,
kVTProfileLevel_H264_Main_AutoLevel);

status =VTSessionSetProperty(EncodingSession, kVTCompressionPropertyKey_AverageBitRate,(__bridge CFTypeRef _Nonnull)(@500000));
status =VTSessionSetProperty(EncodingSession, kVTCompressionPropertyKey_MaxKeyFrameInterval, (__bridge CFTypeRef _Nonnull)(@15));

status =VTSessionSetProperty(EncodingSession, kVTCompressionPropertyKey_H264EntropyMode, kVTH264EntropyMode_CABAC);

status = VTSessionSetProperty(EncodingSession, kVTCompressionPropertyKey_RealTime, kCFBooleanTrue);
A. Leo
  • 1
  • 2

1 Answers1

0

you can set capture(AVCaptureSession) frame rate,so control the video data callback times per seconds;

(void) captureOutput:(AVCaptureOutput *) captureOutput
didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
fromConnection:(AVCaptureConnection *)connection

do you knowns, how to set encoder bitrate?

Sal00m
  • 2,938
  • 3
  • 22
  • 33
  • CFNumberRef bitrateRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &tbitrate); status = VTSessionSetProperty(enCompressionSession,kVTCompressionPropertyKey_AverageBitRate,bitrateRef); CFRelease(bitrateRef); – A. Leo Jun 21 '17 at 02:53
  • CFNumberRef bitrateRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &tbitrate); status = VTSessionSetProperty(enCompressionSession,kVTCompressionPropertyKey_AverageBitRate,bitrateRef); CFRelease(bitrateRef); – A. Leo Jun 21 '17 at 02:53