[Libav-user] No AVHWFramesContext pool for videotoolbox

Kateryna K kmk32t at gmail.com
Wed May 1 02:02:21 EEST 2019

I am trying to use videotoolbox to encode yuv frames for macOS. I am able
to find the appropriate device and successfully create AVHWFramesContext. But
when trying to call av_hwframe_get_buffer, I always get the error (
AVERROR(EINVAL)) because my AVHWFramesContext pool is NULL.

Here is code to create device context:

ret = av_hwdevice_ctx_create(&deviceCtx_, hwType, nullptr, nullptr, 0);

And to create frame context:

framesCtx_ = av_hwframe_ctx_alloc(deviceCtx_);

if (!framesCtx_)

    return false;

 AVHWFramesContext *ctx = (AVHWFramesContext*)(framesCtx_->data);

 ctx->format = format_;

 ctx->sw_format = swFormat_;

 ctx->width = width;

 ctx->height = height;

 if ((ret = av_hwframe_ctx_init(framesCtx_)) < 0)


Do I need to set the initial pool size when using videotoolbox? If I do, I
get error when calling av_hwframe_ctx_init. In this case, the internal pool
is NULL.

Do I need to manage the context pool myself or should it be done
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20190430/a85c0bc4/attachment.html>

More information about the Libav-user mailing list