FFMPEG 测试--第一个程序

准备Ubuntu 12.04版本

1,下载ffmpeg源码,版本 4.0.2。解压并执行./configure

2,  make , make install

以上完成之后可以在 /usr/local/lib  和 /usr/local/include/ 目录中查看到相应的ffmpeg库和头文件。 

#include "stdio.h"

#include "libavformat/avformat.h"

#include "libavcodec/avcodec.h"
#include "libavutil/avutil.h"

int main(int argc, char* argv[])
{
  printf("this is  a test program for ffmpeg\n");
  av_register_all();
  return 0;
}

编译:

gcc ffmpeg.c -o ffmpeg -I /usr/local/include -L /usr/local/lib -lavutil -lavformat -lavcodec -lavutil -lswresample -lm -lrt -lpthread -lz

执行:

./ffmpeg 

扫描二维码关注公众号,回复: 4289417 查看本文章

注意: 如果linux上没有安装 yasm 编译器,编译的时候会提示找不到yasm ,这是因为 ffmpeg 为了程序的 运行速度加入了汇编指令。如果不使用汇编指令,在配置时加上  –disable-yasm, 安装了yasm 则不会有这个提示。

以上测试成功!下面会探索其他的新功能。

猜你喜欢

转载自www.cnblogs.com/richfire/p/10038393.html