while GetNextFrame pFormatCtx pCodecCtx videoStream pFrame SwsContext

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
while(GetNextFrame(pFormatCtx, pCodecCtx, videoStream, pFrame))
{
SwsContext *img_convert_ctx = sws_getContext(pCodecCtx->width,
pCodecCtx->height,
pCodecCtx->pix_fmt,
pCodecCtx->width,
pCodecCtx->height,
PIX_FMT_RGB24,
SWS_FAST_BILINEAR,
NULL, NULL, NULL);
sws_scale(img_convert_ctx, pFrame->data, pFrame->linesize, 0,
pCodecCtx->height,
pFrameRGB->data, pFrameRGB->linesize);
SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height, i);
i++;
}