一些ffmpeg踩坑记录(持续更新)
踩坑
- 报错:sws_scale():bad dst image pointers
- 解决方案:需要分配内存
pFrame_out_yuv->width = sw_frame->width;
pFrame_out_yuv->height = sw_frame->height;
pFrame_out_yuv->format = AV_PIX_FMT_YUV420P;
uint8_t* frame_buffer_YUV = (uint8_t*)av_malloc(av_image_get_buffer_size(AV_PIX_FMT_YUV420P, sw_frame->width, sw_frame->height, 1));
av_image_fill_arrays(pFrame_out_yuv->data, pFrame_out_yuv->linesize, frame_buffer_YUV,
AV_PIX_FMT_YUV420P, pFrame_out_yuv->width, pFrame_out_yuv->height, 1);