ffmpeg学习笔记(3)

2019-08-29 19:56

}

img_convert_ctx =

sws_getCachedContext(img_convert_ctx,pCodeCtx->width,pCodeCtx->height,

pCodeCtx->pix_fmt,pCodeCtx->width,pCodeCtx->height,PIX_FMT_RGB24,SWS_

if (img_convert_ctx == NULL) { }

//将YUV12转换为RGB24

sws_scale(img_convert_ctx, (const uint8_t*

char temp[10];

_itoa_s(num,temp,10);

char path[256] = \;

strcat_s(path,sizeof(path),temp); strcat_s(path,sizeof(path),fileEx); ++num;

pCodeCtx->height, pFrameRGB->data,pFrameRGB->linesize); abort();

BICUBIC,NULL,NULL,NULL);

const*)pFrame->data,pFrame->linesize, 0,

BMP_SaveFile(path,pFrameRGB->data[0],pCodeCtx->width,pCodeCtx->height }

//回收资源

av_free(buffer); av_free(pFrameRGB); av_free(pFrame);

avcodec_close(pCodeCtx);

avformat_close_input(&pFormatCtx); return 0;

}

av_free_packet(&pPacket);

}

,24);

bool BMP_SaveFile(const char* szFile, const void* pBmp, int width, int height, int bitCount)

{ }

void reverseChar(char**strs,int nSize) {

//定义一个指针指向strs的内存地址 char *p = *strs; char tmp;

for (unsigned int i = 0; i < nSize/2 ; i++) return true;

reverseChar((char **)&pBmp,bmp_size); fwrite(pBmp, bmp_size, 1, pFile); fclose(pFile);

BITMAPINFOHEADER bmiHeader;

bmiHeader.biSize = sizeof(bmiHeader); bmiHeader.biWidth = width; bmiHeader.biHeight = height; bmiHeader.biPlanes = 1; bmiHeader.biBitCount = bitCount; bmiHeader.biCompression = 0; bmiHeader.biSizeImage = bmp_size; bmiHeader.biXPelsPerMeter = 0; bmiHeader.biYPelsPerMeter = 0; bmiHeader.biClrUsed = 0; bmiHeader.biClrImportant = 0; fwrite(&bmiHeader, sizeof(bmiHeader), 1, pFile); BITMAPFILEHEADER bmpHeader;

bmpHeader.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) bmpHeader.bfType = 0x4D42;

bmpHeader.bfOffBits = sizeof(BITMAPFILEHEADER) + bmpHeader.bfReserved1 = 0; bmpHeader.bfReserved2 = 0;

fwrite(&bmpHeader, sizeof(bmpHeader), 1, pFile); int bmp_size = width*height*(bitCount/8); FILE* pFile = NULL;

fopen_s(&pFile,szFile, \); ASSERT(pFile != NULL);

+ bmp_size;

sizeof(BITMAPINFOHEADER);

}

{ }

tmp = *(p+i);

*(p+i) = *(p + nSize - 1 - i); *(p + nSize - 1 - i) = tmp;


ffmpeg学习笔记(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:高职考试英语模拟试卷

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: