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.
相關文章
相關標籤/搜索