[Develope]/Multimedia

[조각코드]ffmpeg에서 Intra Frame을 YUV420형태의 파일로 저장하기

하늘을닮은호수M 2007. 11. 7. 16:08
반응형

Void
VideoDecodeThread::YUVSave2(AVFrame *pFrame,
                                                           SInt32 width,
                                                           SInt32 height,
                                                           SInt32 iFrame,
                                                           SChar * szFilename)
{
         FILE   *fp =0;
         int   i,j,shift;
         char   * yuv_factor;

         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] > Multimedia' 카테고리의 다른 글

Gstreamer  (0) 2008.08.08
Getting Started with Adobe Flash Media Server 3  (0) 2008.06.09
Darwin Streaming Server  (0) 2007.12.20
V4L2  (0) 2007.12.13
[ffmpeg] avcodec_sample  (0) 2007.11.20