Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何调整Videotoolbox中的属性?_Ios_Objective C_Video Toolbox - Fatal编程技术网

Ios 如何调整Videotoolbox中的属性?

Ios 如何调整Videotoolbox中的属性?,ios,objective-c,video-toolbox,Ios,Objective C,Video Toolbox,我现在使用Videotoolbox处理h.264编码 我找到了一个示例代码,它运行良好: #define VTB_HEIGHT 480 #define VTB_WIDTH 640 int bitRate = VTB_WIDTH * VTB_HEIGHT * 3 * 4 * 8; CFNumberRef bitRateRef = CFNumberCreate(kCFAllocatorDefault,

我现在使用Videotoolbox处理h.264编码

我找到了一个示例代码,它运行良好:

    #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;
正确的使用方法是什么

希望有人能告诉我

谢谢你的时间

来自以下文件:

每个硬限制由以字节为单位的数据大小和 持续时间(秒)

因此,您需要使用2个参数设置此属性(数据大小以字节为单位,持续时间以秒为单位)

从文件中可以看出:

每个硬限制由以字节为单位的数据大小和 持续时间(秒)

因此,您需要使用2个参数设置此属性(数据大小以字节为单位,持续时间以秒为单位)


苹果最近发布了一份关于房产的详细解释。苹果最近发布了一份关于房产的详细解释。
int bitRate = VTB_WIDTH * VTB_HEIGHT * 3 * 4 * 8; 
int bitRateLimit = bitRate / 8; 

// that's say we set data in byte/second
CFNumberRef byteNum = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &bitRateLimit);
int second = 1;
CFNumberRef secNum = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &second);

// add parameters into a array
const void* numbers[2] = {byteNum, secNum};
CFArrayRef dataRateLimits = CFArrayCreate(NULL, numbers, 2, &kCFTypeArrayCallBacks);

// then set property with array
status = VTSessionSetProperty(compressionSession, kVTCompressionPropertyKey_DataRateLimits, arrayValues);