- if ((ret = avpicture_layout((const AVPicture *)frame, avctx->pix_fmt, avctx->width,
- avctx->height, pkt->data, pkt->size)) < 0)
+ if ((ret = av_image_copy_to_buffer(pkt->data, pkt->size,
+ frame->data, frame->linesize,
+ frame->format,
+ frame->width, frame->height, 1)) < 0)