VideoToolbox对某些H264编码分辨率的不兼容

ffmpeg中使用VideoToolbox进行解码的过程,若是视频编码的H264分辨率比较怪异,好比300X180或者是320X240这种,反馈一个VideoToolbox session not availablesession

status = VTDecompressionSessionCreate(NULL,                      // allocator
                                          videotoolbox->cm_fmt_desc, // videoFormatDescription
                                          decoder_spec,              // videoDecoderSpecification
                                          buf_attr,                  // destinationImageBufferAttributes
                                          &decoder_cb,               // outputCallback
                                          &videotoolbox->session);   // decompressionSessionOut
    //session没法获取到值,若是分辨率不是VideoToolbox能够支持的
    if (decoder_spec)
        CFRelease(decoder_spec);
    if (buf_attr)
        CFRelease(buf_attr);

    switch (status) {
    case kVTVideoDecoderNotAvailableNowErr:
        av_log(avctx, AV_LOG_VERBOSE, "VideoToolbox session not available.\n");

实际上这个问题应该VideoToolbox的自己库兼容性问题,而后提示的又不太友好,实际上苹果官方的文档也没有明确的相关说明,算是一个很诡异的问题。ide

Overview
--------

VideoToolbox is a low-level framework that provides direct access to hardware encoders and decoders. It provides services for video compression and decompression, and for conversion between raster image formats stored in CoreVideo pixel buffers. These services are provided in the form of session objects (compression, decompression, and pixel transfer), which are vended as Core Foundation (CF) types. Apps that don't need direct access to hardware encoders and decoders should not need to use VideoToolbox directly.
相关文章
相关标签/搜索