[Develope]

[조각코드]ffmpeg을 이용한 디코딩된 I-Frame을 YUV420형태의 파일로 저장하기

하늘을닮은호수M 2007. 8. 10. 11:07
반응형

Void
VideoDecodeThread::YUVSave2(AVFrame *pFrame,
SInt32 width,
SInt32 height,
SInt32 iFrame,
SChar * szFilename)
{

FILE *fp =0;
int i,j,shift;
char * yuv_factor;
// char szFilename[32];

// sprintf(szFilename, "frame%d.bmp", iFrame);
fp = fopen(szFilename,"wb");
if(fp) {
for(i = 0; i < 3; i++) {
shift = (i == 0 ? 0:1);
yuv_factor = (char *)pFrame->data[i];
for(j = 0; j < (height>>shift); j++) {
fwrite(yuv_factor,(width>>shift),1,fp);
yuv_factor += pFrame->linesize[i];
}
}
fclose(fp);
}

}

반응형

'[Develope]' 카테고리의 다른 글

Polling Made Efficient  (0) 2007.11.23
A garbage collector for C and C++  (0) 2007.11.23
Using the devpoll (/dev/poll) Interface  (0) 2007.04.17
epoll Scalability  (0) 2007.04.16
네트웍 관련 볼거리  (0) 2007.04.15