Chinaunix

标题: FFMPEG tutorial01 笔记 [打印本页]

作者: 飘之叶    时间: 2011-12-20 09:44
标题: FFMPEG tutorial01 笔记
官方教程:http://dranger.com/ffmpeg/tutorial01.html
只是记录一些东西。
首先是要安装好ffmpeg库,然后是安装SDL。
从官方下来的源代码由于是针对旧版本写的,新版本的有替换了原来的接口,编译的时候会提示img_convert未定义的错误。由于新版本使用了swscale,因此我们可以用它去替换。
解决方法是,
  1. img_convert_ctx = sws_getContext(pCodecCtx->width, pCodecCtx->height,
  2.  pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height,
  3.  PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL);
  4.     // Convert the image from its native format to RGB
  5.     //img_convert((AVPicture *)pFrameRGB, PIX_FMT_RGB24,
  6.           // (AVPicture*)pFrame, pCodecCtx->pix_fmt, pCodecCtx->width,
  7.             // pCodecCtx->height);
  8.     sws_scale(img_convert_ctx, (const uint8_t* const*)pFrame->data, pFrame->linesize,
  9.  0, pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize);
详细请看附件。
编译命令:gcc -o tutorial01 tutorial01.c  -lavutil -lavformat -lavcodec -lz -lswscale 
 tutorial01.c.zip   





欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2