sws_scale():bad dst image pointers 简介:sws_scale():bad dst image pointers 两种原因: (1)为给接收数据分配内存空间,此空间并不仅不是结构空间,还有存储音/视频数据的空间。可用如下api分配空间: av_frame_get_buffer(frame, 32); 详细用法,及AVFrame的内存管理见: AVFrame相关api (2)与sws_getContext...
cvtColor(img,img,COLOR_BGR2RGB); uint8_t*dst_data[4]={NULL}; intdst_linesize[4]={0}; av_image_fill_arrays(dst_data,dst_linesize, frame->data[0],AV_PIX_FMT_RGB24, width,height,1); memcpy(dst_data[0],img.data,img.total()*img.elemSize()); // 进行像素格式转换 sws_scale(sw...
scaleFactor int) { input, _, _ := image.Decode(bytes.NewReader(img)) if a, ok := input.(*image.YCbCr); ok { width, height := a.Rect.Dx(), a.Rect.Dy() var format C.enum_AVPixelFormat = C.AV_PIX_FMT_YUV420P context := C.sws_getContext(C.int(width), C.int(height...