简体   繁体   中英

How to set frame rate when using iOS VTCompression to encode video

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);

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM