关于ffmpeg:VideoToolbox对某些H264编码分辨率的不兼容

48次阅读

共计 1131 个字符,预计需要花费 3 分钟才能阅读完成。

ffmpeg 中应用 VideoToolbox 进行解码的过程,如果视频编码的 H264 分辨率比拟怪异,比方 300X180 或者是 320X240 这种,反馈一个 VideoToolbox session not available

    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 的自身库兼容性问题,而后提醒的又不太敌对,实际上苹果官网的文档也没有明确的相干阐明,算是一个很诡异的问题。

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.

正文完
 0