if(0)//(got_frame)
{
int size = frame->height * frame->width * 3 / 2;
char* buf = new char[size];
memset(buf, 0, size);
int height = frame->height;
int width = frame->width;
printf("decode video ok format [%d] size [%dX%d] \n",frame->format,width,height);
printf("line[0,1,2]=[%d,%d,%d]\n",frame->linesize[0],frame->linesize[1],frame->linesize[2]);
int a = 0, i;
#if 0
for (i = 0; i<height; i++)
{
memcpy(buf + a, frame->data[0] + i * frame->linesize[0], width);
a += width;
}
for (i = 0; i<height / 2; i++)
{
memcpy(buf + a, frame->data[1] + i * frame->linesize[1], width);
a += width / 2;
}
for (i = 0; i<height / 2; i++)
{
memcpy(buf + a, frame->data[2] + i * frame->linesize[2], width / 2);
a += width / 2;
}
fwrite(buf, 1, frame->height * frame->width * 3 / 2, pFile);
#else
fwrite(frame->data[0],1,frame->height * frame->width,pFile);//Y
fwrite(frame->data[1],1,frame->height * frame->width/4,pFile); //U
fwrite(frame->data[2],1,frame->height * frame->width/4,pFile);
#endif
delete buf;
buf = NULL;
}
ffmpeg 解码出来的YUV数据写文件
于 2022-04-07 18:42:18 首次发布