Chinaunix首页 | 论坛 | 博客
  • 博客访问: 114388
  • 博文数量: 23
  • 博客积分: 2092
  • 博客等级: 大尉
  • 技术积分: 305
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-10 19:40
文章分类
文章存档

2011年(3)

2010年(17)

2009年(3)

我的朋友

分类: 嵌入式

2011-03-18 17:04:03

官方教程:
只是记录一些东西。
首先是要安装好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 
阅读(1736) | 评论(0) | 转发(0) |
0

上一篇:信号量和互斥锁

下一篇:FFMpeg的解码流程

给主人留下些什么吧!~~