1
我現在使用Videotoolbox來處理h.264編碼。如何調整Videotoolbox的屬性?
而且我發現了一個示例代碼,它工作正常:
#define VTB_HEIGHT 480
#define VTB_WIDTH 640
int bitRate = VTB_WIDTH * VTB_HEIGHT * 3 * 4 * 8;
CFNumberRef bitRateRef = CFNumberCreate(kCFAllocatorDefault,
kCFNumberSInt32Type,
&bitRate);
VTSessionSetProperty(encodingSession,
kVTCompressionPropertyKey_AverageBitRate,
bitRateRef);
CFRelease(bitRateRef);
int bitRateLimit = bitRate/8;
CFNumberRef bitRateLimitRef = CFNumberCreate(kCFAllocatorDefault,
kCFNumberSInt32Type,
&bitRateLimit);
VTSessionSetProperty(encodingSession,
kVTCompressionPropertyKey_DataRateLimits,
bitRateLimitRef);
CFRelease(bitRateLimitRef);
但是這兩條線,我不明白:
int bitRate = VTB_WIDTH * VTB_HEIGHT * 3 * 4 * 8;
int bitRateLimit = bitRate/8;
什麼是使用它們的正確方法?
希望有人能告訴我。
謝謝你的時間!
Apple發佈了關於[kVTCompressionPropertyKey_Data RateLimits](https://developer.apple.com/library/content/qa/qa1958/_index.html#//apple_ref/doc/uid/DTS40017665)屬性。 –