其他分享
首页 > 其他分享> > ffmpeg 转换scale

ffmpeg 转换scale

作者:互联网

uint8_t *dst_data[4];
                    int  dst_linesize[4];
                    int dst_bufsize;
                    struct SwsContext *pSwsCtx;
                    pSwsCtx = sws_getContext(w, h, ic->streams[videoIndex]->codec->pix_fmt,
                        w, h, AV_PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL);
        
                    if ((ret = av_image_alloc(dst_data, dst_linesize,
                        w, h, AV_PIX_FMT_RGB24, 1)) < 0) {
                        fprintf(stderr, "Could not allocate destination image\n");
                        return -1;
                    }
                    dst_bufsize = ret;
            
                    sws_scale(pSwsCtx, (const uint8_t * const*)frame->data,
                        frame->linesize, 0, h, dst_data, dst_linesize);
                    fwrite(dst_data[0], 1, dst_bufsize, f);

 

标签:scale,转换,ffmpeg,linesize,dst,pSwsCtx,NULL,bufsize,data
来源: https://www.cnblogs.com/cnchengv/p/15088078.html