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);

 

上一篇:ffmpeg - FFMPEG: 將YUV數據轉儲到AVFrame結構中


下一篇:一文带你搞定考试复杂表达式求值问题(和bug郭一起学C系列)